static int SCW_VLine(lua_State *L){ WINDOW **w = checkSelCWindow(L); int n = luaL_checkint(L, 2); char ch = '|'; if(lua_gettop(L) > 2) switch( lua_type(L, 3 )){ case LUA_TNUMBER: ch = lua_tointeger(L, 3 ); break; case LUA_TSTRING: ch = *lua_tostring(L, 3 ); break; default : lua_pushnil(L); lua_pushstring(L, "Vline() expects an integer or a string"); return 2; } if(wvline( *w, ch, n ) == ERR){ lua_pushnil(L); lua_pushstring(L, "wvline() returned an error"); return 2; } return 0; }
void introTest(WINDOW *win) { werase(win); wmove(win, height / 2 - 5, width / 2); wvline(win, ACS_VLINE, 10); wmove(win, height / 2, width / 2 - 10); whline(win, ACS_HLINE, 20); Continue(win); beep(); werase(win); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); cbreak(); mvwaddstr(win, 1, 1, "You should have a rectangle in the middle of the screen"); mvwaddstr(win, 2, 1, "You should have heard a beep"); Continue(win); flash(); mvwaddstr(win, 3, 1, "You should have seen a flash"); Continue(win); }
void do_wvline(state *st) { int arity; long slot, ch, max; ei_decode_tuple_header(st->args, &(st->index), &arity); ei_decode_long(st->args, &(st->index), &slot); ei_decode_long(st->args, &(st->index), &ch); ei_decode_long(st->args, &(st->index), &max); encode_ok_reply(st, wvline(st->win[slot], (chtype)ch, (int)max)); }
int mvvline(int y, int x, chtype ch, int n) { PDC_LOG(("mvvline() - called\n")); if (move(y, x) == ERR) return ERR; return wvline(stdscr, ch, n); }
int mvwvline(WINDOW *win, int y, int x, chtype ch, int n) { PDC_LOG(("mvwvline() - called\n")); if (wmove(win, y, x) == ERR) return ERR; return wvline(win, ch, n); }
int vline(chtype v, int n) { int code; #ifdef M_CURSES_TRACE __m_trace("vline(%ld, %d)", v, n); #endif code = wvline(stdscr, v, n); return __m_return_code("vline", code); }
void tic_display_board_nc(void){ refresh(); ticwin = newwin(0, 0, 0, 0); getmaxyx(ticwin,hscr,wscr); hbrd = hscr; wbrd = wscr; hcel = hbrd / 3; wcel = wbrd / 3; box(ticwin, 0 , 0); /* 0, 0 gives default characters */ wrefresh(ticwin); wmove(ticwin, hcel, 0); whline(ticwin, '-', wbrd); wmove(ticwin, 2*hcel, 0); whline(ticwin, '-', wbrd); wmove(ticwin, 0, wcel); wvline(ticwin, '|', hbrd); wmove(ticwin, 0, 2*wcel); wvline(ticwin, '|', hbrd); start_color(); init_pair(1, COLOR_BLACK, COLOR_WHITE); wbkgd(ticwin, COLOR_PAIR(1)); wrefresh(ticwin); //mvprintw(0,0,"wscr=%d, hscr=%d, wbrd=%d, hbrd=%d, wcel=%d, hcel=%d\n", wscr, hscr, wbrd, hbrd, wcel, hcel); //mvprintw(2,0,"wscr=%d, hscr=%d, wbrd=%d, hbrd=%d, wcel=%d, hcel=%d\n", wscr, hscr, wbrd, hbrd, wcel, hcel); //mvprintw(4,0,"wscr=%d, hscr=%d, wbrd=%d, hbrd=%d, wcel=%d, hcel=%d\n", wscr, hscr, wbrd, hbrd, wcel, hcel); //wmove(ticwin, hcel, 0); whline(ticwin, '-', 3*wcel); //move(hbrd-3, wbrd); hline('-', 3*wcel); //move(hbrd-(1*hcel), wbrd-(3*wcel)); hline('-', 3*wcel); //move(hbrd-(1*hcel), wbrd-(1*wcel)); hline('-', 3*wcel); //move(hbrd-(3*hcel), wbrd-(3*wcel)); vline('-', 3*hcel); //move(hbrd-(3*hcel), wbrd-(3*wcel)); vline('-', 3*hcel); #if 0 mvprintw((hscr/2)-5, (wscr/2)-4, " | | "); mvprintw((hscr/2)-4, (wscr/2)-4, "-------"); mvprintw((hscr/2)-3, (wscr/2)-4, " | | "); mvprintw((hscr/2)-2, (wscr/2)-4, "-------"); mvprintw((hscr/2)-1, (wscr/2)-4, " | | "); #endif //refresh(); }
int mvvline(int y, int x, chtype v, int n) { int code; #ifdef M_CURSES_TRACE __m_trace("mvvline(%d, %d, %ld, %d)", y, x, v, n); #endif if ((code = wmove(stdscr, y, x)) == OK) code = wvline(stdscr, v, n); return __m_return_code("mvvline", code); }
int mvwvline(WINDOW *w, int y, int x, chtype v, int n) { int code; #ifdef M_CURSES_TRACE __m_trace("mvwvline(%p, %d, %d, %ld, %d)", w, y, x, v, n); #endif if ((code = wmove(w, y, x)) == OK) code = wvline(w, v, n); return __m_return_code("mvwvline", code); }
WINDOW *create_newgrid(int starty, int startx, int nbRow, int nbCol, int spaceBetween, bool gameOverRh) { WINDOW *local_win; local_win = newwin(nbRow * spaceBetween + 1, nbCol * (spaceBetween * 2) + 1, starty, startx); box(local_win, 0, 0); /* 0, 0 gives default characters * for the vertical and horizontal * lines */ for (int i = 1; i < spaceBetween * nbRow; i++) { wmove(local_win, spaceBetween*i, 1); whline(local_win, 0, (nbRow * spaceBetween)*2 - 2); } for (int i = 1; i < spaceBetween * nbCol; i++) { wmove(local_win, 1, (spaceBetween * i)*2); wvline(local_win, 0, nbRow * spaceBetween - 1); } wmove(local_win, 0, 0); if (gameOverRh) { wmove(local_win, (spaceBetween)*2, (spaceBetween * 2) * nbCol); wattron(local_win, COLOR_PAIR(1)); //COLOR init with init_pair wattron(local_win, A_BOLD); //Bold char wvline(local_win, '#', spaceBetween + 1); wattroff(local_win, A_BOLD); wattroff(local_win, COLOR_PAIR(1)); } else { wmove(local_win, spaceBetween * nbRow, (spaceBetween * 2)); wattron(local_win, COLOR_PAIR(1)); //COLOR init with init_pair wattron(local_win, A_BOLD); //Bold char whline(local_win, '#', (spaceBetween * 2)*2 + 1); wattroff(local_win, A_BOLD); wattroff(local_win, COLOR_PAIR(1)); } wrefresh(local_win); /* Show that box */ return local_win; }
/* * set the scroll pointer and redraw * the window elevator */ static void wdg_set_scroll(struct wdg_object *wo, int s) { WDG_WO_EXT(struct wdg_scroll, ww); size_t c = wdg_get_ncols(wo); size_t l = wdg_get_nlines(wo); int min = 0; int max = ww->y_max - l + 1; size_t height, vpos; /* don't go above max and below min */ if (s < min) s = min; if (s > max) s = max; ww->y_scroll = s; /* compute the scroller cohordinates */ height = (l - 2) * (l - 2) / ww->y_max; vpos = l * ww->y_scroll / ww->y_max; height = (height < 1) ? 1 : height; vpos = (vpos == 0) ? 1 : vpos; vpos = (vpos > (l - 1) - height) ? (l - 1) - height : vpos; /* hack to make sure to hit the bottom */ if (ww->y_scroll == (size_t)max) vpos = l - 1 - height; /* draw the scroller */ wmove(ww->win, 1, c - 1); wvline(ww->win, ACS_CKBOARD, l - 2); wattron(ww->win, A_REVERSE); wmove(ww->win, vpos, c - 1); wvline(ww->win, ACS_DIAMOND, height); wattroff(ww->win, A_REVERSE); }
void separe(WINDOW *win) { int attrs, x, y; short pair; /* Saving current state */ wattr_get(win, &attrs, &pair, NULL); /* Print sepration */ wattrset(win, COLOR_PAIR(2)); wvline(win, ACS_VLINE, 1); getyx(win, y, x); wmove(win, y, x + 1); /* Restoring */ wattr_set(win, attrs, pair, NULL); }
static void introTest(WINDOW *win) { wmove(win, height / 2 - 5, width / 2); wvline(win, ACS_VLINE, 10); wmove(win, height / 2, width / 2 - 10); whline(win, ACS_HLINE, 20); Continue(win); beep(); werase(win); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); cbreak(); MvWAddStr(win, 1, 1, "You should have rectangle in the middle of the screen"); MvWAddStr(win, 2, 1, "You should have heard a beep"); Continue(win); return; }
static TACommandVerdict wvline_cmd(TAThread thread,TAInputStream stream) { WINDOW *win; chtype ch; int n; int res; win = readPointer(&stream); ch = readChType(&stream); n = readInt(&stream); START_TARGET_OPERATION(thread); res = wvline(win, ch, n); END_TARGET_OPERATION(thread); writeInt(thread, res); sendResponse(thread); return taDefaultVerdict; }
int wvline_set(WINDOW *win, const cchar_t *wch, int n) { PDC_LOG(("wvline_set() - called\n")); return wch ? wvline(win, *wch, n) : ERR; }
NCURSES_EXPORT(int) (vline) (chtype a1, int z) { T((T_CALLED("vline(%s,%d)"), _tracechtype2(0,a1), z)); returnCode(wvline(stdscr, a1, z)); }
int vline(chtype ch, int n) { PDC_LOG(("vline() - called\n")); return wvline(stdscr, ch, n); }
int vline(chtype ch, int n) { return wvline(mainwin, ch, n); }
NCURSES_EXPORT(int) (mvwvline) (WINDOW * a1, int a2, int a3, chtype a4, int z) { T((T_CALLED("mvwvline(%p,%d,%d,%s,%d)"), (const void *)a1, a2, a3, _tracechtype2(3,a4), z)); returnCode((wmove(a1,a2,a3) == (-1) ? (-1) : wvline(a1,a4,z))); }
int chkr_wvline(WINDOW *win,chtype arg1,int arg2) { CHECK_WIN(win); return(wvline(win,arg1,arg2)); }
int vline(chtype vertch, int num_chars) { return (wvline(stdscr, vertch, num_chars)); }
void dlg_draw_scrollbar(WINDOW *win, long first_data, long this_data, long next_data, long total_data, int left, int right, int top, int bottom, chtype attr, chtype borderattr) { char buffer[80]; int percent; int len; int oldy, oldx; chtype save = dlg_get_attrs(win); int top_arrow = (first_data != 0); int bottom_arrow = (next_data < total_data); getyx(win, oldy, oldx); dlg_draw_helpline(win, TRUE); if (bottom_arrow || top_arrow || dialog_state.use_scrollbar) { percent = (!total_data ? 100 : (int) ((next_data * 100) / total_data)); if (percent < 0) percent = 0; else if (percent > 100) percent = 100; (void) wattrset(win, position_indicator_attr); (void) sprintf(buffer, "%d%%", percent); (void) wmove(win, bottom, right - 7); (void) waddstr(win, buffer); if ((len = dlg_count_columns(buffer)) < 4) { (void) wattrset(win, border_attr); whline(win, dlg_boxchar(ACS_HLINE), 4 - len); } } #define BARSIZE(num) (int) (0.5 + (double) ((all_high * (int) (num)) / (double) total_data)) #define ORDSIZE(num) (int) ((double) ((all_high * (int) (num)) / (double) all_diff)) if (dialog_state.use_scrollbar) { int all_high = (bottom - top - 1); this_data = MAX(0, this_data); if (total_data > 0 && all_high > 0) { int all_diff = (int) (total_data + 1); int bar_diff = (int) (next_data + 1 - this_data); int bar_high; int bar_y; bar_high = ORDSIZE(bar_diff); if (bar_high <= 0) bar_high = 1; if (bar_high < all_high) { int bar_last = BARSIZE(next_data); wmove(win, top + 1, right); (void) wattrset(win, save); wvline(win, ACS_VLINE | A_REVERSE, all_high); bar_y = ORDSIZE(this_data); if (bar_y >= bar_last && bar_y > 0) bar_y = bar_last - 1; if (bar_last - bar_y > bar_high && bar_high > 1) ++bar_y; bar_last = MIN(bar_last, all_high); wmove(win, top + 1 + bar_y, right); (void) wattrset(win, position_indicator_attr); wattron(win, A_REVERSE); #if defined(WACS_BLOCK) && defined(NCURSES_VERSION) && defined(USE_WIDE_CURSES) wvline_set(win, WACS_BLOCK, bar_last - bar_y); #else wvline(win, ACS_BLOCK, bar_last - bar_y); #endif } } } dlg_draw_arrows2(win, top_arrow, bottom_arrow, left + ARROWS_COL, top, bottom, attr, borderattr); (void) wattrset(win, save); wmove(win, oldy, oldx); }
EIF_INTEGER c_ecurses_wvline (EIF_POINTER w, EIF_INTEGER ch, EIF_INTEGER n) { return wvline( ((WINDOW *) w) , (chtype) ch,(int) n) ; };
NCURSES_EXPORT(int) (mvvline) (int a1, int a2, chtype a3, int z) { T((T_CALLED("mvvline(%d,%d,%s,%d)"), a1, a2, _tracechtype2(2,a3), z)); returnCode((wmove(stdscr,a1,a2) == (-1) ? (-1) : wvline(stdscr,a3,z))); }