static int addstr4(SCR *sp, const void *str, size_t len, int wide) { WINDOW *win; size_t y, x; int iv; win = CLSP(sp) ? CLSP(sp) : stdscr; /* * If ex isn't in control, it's the last line of the screen and * it's a split screen, use inverse video. */ iv = 0; getyx(win, y, x); __USE(x); if (!F_ISSET(sp, SC_SCR_EXWROTE) && y == RLNO(sp, LASTLINE(sp)) && IS_SPLIT(sp)) { iv = 1; (void)wstandout(win); } #ifdef USE_WIDECHAR if (wide) { if (waddnwstr(win, str, len) == ERR) return (1); } else #endif if (waddnstr(win, str, len) == ERR) return (1); if (iv) (void)wstandend(win); return (0); }
int putch(unsigned char c) { wchar_t w = cp437[c]; int res; res = waddnwstr(win, &w, 1); wrefresh(win); return res; }
int mvwaddnwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n) { PDC_LOG(("mvwaddnstr() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return waddnwstr(win, wstr, n); }
int mvaddnwstr(int y, int x, const wchar_t *wstr, int n) { PDC_LOG(("mvaddnstr() - called\n")); if (move(y, x) == ERR) return ERR; return waddnwstr(stdscr, wstr, n); }
/** * wcch -- write a complex character and rendition to a window * @win : pointer to a WINDOW * @wch : pointer to the wchar_t to be written * @attr: the desired window attributes * @pair: the desired color pair */ void wcch(WINDOW *win, const wchar_t *wch, attr_t attr, short pair) { SAVEWIN(win); wattr_set(win, attr, pair, NULL); if (wch && (*wch != L'\0')) { waddnwstr(win, wch, 1); } RESTORE(win); }
int t_wprintn(WINDOW *win, int n, t_char *fmt, ...) { wchar_t buf[MAX_PRINT_LEN]; va_list args; va_start(args, fmt); vswprintf(buf, MAX_PRINT_LEN, fmt, args); va_end(args); return waddnwstr(win, buf, n); }
/* * print_char() * * wy¶wietla w danym okienku znak, bior±c pod uwagê znaki ,,niewy¶wietlalne''. * gdy attr A_UNDERLINE wtedy podkreslony */ static void print_char(WINDOW *w, CHAR_T ch, int attr) { ch = ncurses_fixchar(ch, &attr); wattrset(w, attr); #if USE_UNICODE waddnwstr(w, &ch, 1); #else waddch(w, ch); #endif }
static void uiview_draw_mainwin(void) { int i = 0; wchar_t *tracktmp = NULL; wchar_t displaytitle[MAX_TRACK_SZ + 1] = { 0 }; char displayshuffle = ' '; char displayrepeat = ' '; gint64 now_us = 0; gint64 offs = 0; /* Get current time */ now_us = g_get_monotonic_time(); /* Only perform update at certain interval (currently 100ms) */ if((now_us - last_ui_update_us) > UI_UPDATE_US) { /* Main window border */ wborder(mainwin, 0, 0, 0, 0, 0, 0, 0, 0); /* Main window title */ if(!listwinflag) { wattron(mainwin, A_BOLD); mvwprintw(mainwin, 0, 17, " namp "); wattroff(mainwin, A_BOLD); } else { mvwprintw(mainwin, 0, 17, " namp "); } /* Current track position */ mvwprintw(mainwin, 1, 3, " %02d:%02d", (trackposition / SECS_PER_MIN), (trackposition % SECS_PER_MIN)); /* Track title */ if(trackname == NULL) { tracktmp = notracktitle; } else { tracktmp = trackname; } swprintf(displaytitle, MAX_TRACK_SZ, L"%ls", tracktmp + tracknameposition); mvwprintw(mainwin, 1, 11, "%-" STR(MAX_TRACK_SZ) "s", ""); mvwaddnwstr(mainwin, 1, 11, displaytitle, sizeof(displaytitle)); if(wcslen(tracktmp) > MAX_TRACK_SZ) { if((now_us - last_title_start_us) > TITLEHOLD_US) { offs = (((now_us-last_title_start_us)-TITLEHOLD_US)/TITLESTEP_US); tracknameposition = offs; if(tracknameposition > ((int)wcslen(tracktmp) - MAX_TRACK_SZ + 1)) { if(last_title_stop_us < last_title_start_us) { last_title_stop_us = now_us; } if((now_us - last_title_stop_us) > TITLEHOLD_US) { tracknameposition = 0; last_title_start_us = now_us; } else { tracknameposition = (wcslen(tracktmp) - MAX_TRACK_SZ + 1); } } } } /* Volume */ mvwprintw(mainwin, 2, 11, "- + PL"); volume_draw_cnt = (19 * volumepercent) / 100; mvwhline(mainwin, 2, 12, 0, volume_draw_cnt); /* Progress */ mvwprintw(mainwin, 3, 2, "| |"); if(trackduration != 0) { duration_draw_cnt = (34 * trackposition) / trackduration; mvwhline(mainwin, 3, 3, 0, duration_draw_cnt); } else { duration_draw_cnt = 0; } /* Spectrum */ wmove(mainwin, 2, 2); for(i = 0; i < 8; i++) { waddnwstr(mainwin, &spectrum_wchars[spectrum[i]], 1); } /* Playback control buttons */ if(shuffleflag) { displayshuffle = 'X'; } if(repeatflag) { displayrepeat = 'X'; } mvwprintw(mainwin, 4, 2, "|< |> || [] >| [%c] Shuffle [%c] Rep", displayshuffle, displayrepeat); /* Refresh window */ wrefresh(mainwin); /* Store time */ last_ui_update_us = now_us; } }
int waddwstr(WINDOW *win, const wchar_t *wstr) { PDC_LOG(("waddwstr() - called\n")); return waddnwstr(win, wstr, -1); }
int addnwstr(const wchar_t *wstr, int n) { PDC_LOG(("addnwstr() - called\n")); return waddnwstr(stdscr, wstr, n); }
int t_vwprintn(WINDOW *win, int n, t_char *fmt, va_list args) { wchar_t buf[MAX_PRINT_LEN]; vswprintf(buf, MAX_PRINT_LEN, fmt, args); return waddnwstr(win, buf, n); }
NCURSES_EXPORT(int) (addwstr) (const wchar_t * z) { T((T_CALLED("addwstr(%p)"), (const void *)z)); returnCode(waddnwstr(stdscr,z,-1)); }
NCURSES_EXPORT(int) (addnwstr) (const wchar_t * a1, int z) { T((T_CALLED("addnwstr(%p,%d)"), (const void *)a1, z)); returnCode(waddnwstr(stdscr,a1,z)); }
NCURSES_EXPORT(int) (waddwstr) (WINDOW * a1, const wchar_t * z) { T((T_CALLED("waddwstr(%p,%p)"), (const void *)a1, (const void *)z)); returnCode(waddnwstr(a1,z,-1)); }
NCURSES_EXPORT(int) (mvwaddwstr) (WINDOW * a1, int a2, int a3, const wchar_t * z) { T((T_CALLED("mvwaddwstr(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); returnCode((wmove(a1,a2,a3) == (-1) ? (-1) : waddnwstr(a1,z,-1))); }
NCURSES_EXPORT(int) (mvaddwstr) (int a1, int a2, const wchar_t * z) { T((T_CALLED("mvaddwstr(%d,%d,%p)"), a1, a2, (const void *)z)); returnCode((wmove(stdscr,a1,a2) == (-1) ? (-1) : waddnwstr(stdscr,z,-1))); }