void display_page_draw_frame(const struct display_page *display_page, int height) { const struct display_table *table; const struct display_column *col; wattron(win_stat, A_BOLD); wbkgdset(win_stat, COLOR_PAIR(YELLOW_ON_NOTHING)); for (int i = 0; i < display_page->n_tables; ++i) { table = &display_page->tables[i]; if (i != 0) mvwvline(win_stat, 0, table->offset - 1, ACS_VLINE, height + 2); mvwaddstrf(win_stat, 0, table->offset + table->width / 2 - strlen(table->title) / 2, "%s", table->title); for (int j = 0; j < table->n_cols; ++j) { col = &table->cols[j]; if (j != 0) mvwvline(win_stat, 1, col->offset - 1, ACS_VLINE, height + 1); mvwaddstrf(win_stat, 1, col->offset + col->width / 2 - strlen(col->title) / 2, "%s", col->title); } if (i + 1 == display_page->n_tables) mvwvline(win_stat, 0, table->offset + table->width, ACS_VLINE, height + 2); } wbkgdset(win_stat, COLOR_PAIR(NO_COLOR)); wattroff(win_stat, A_BOLD); }
/* Draw a frame */ static void frame(WINDOW *win, int starty, int startx, int endy, int endx, char *label) { if(opts->color) { init_pair(DEFAULT_COLOR, COLOR_BLACK, COLOR_WHITE); wattron(win, COLOR_PAIR(DEFAULT_COLOR)); } /* Horizontal lines */ mvwhline(win, starty, startx, 0, endx - startx); mvwhline(win, endy, startx, 0, endx - startx); /* Vertical lines */ mvwvline(win, starty, startx, 0, endy - starty); mvwvline(win, starty, endx - 1, 0, endy - starty); /* Corners */ mvwhline(win, starty, startx, ACS_ULCORNER, 1); mvwhline(win, endy, startx, ACS_LLCORNER, 1); mvwhline(win, starty, endx - 1, ACS_URCORNER, 1); mvwhline(win, endy, endx - 1, ACS_LRCORNER, 1); /* Title */ mvwprintwc(win, starty, startx + 2, DEFAULT_COLOR, "%s", label); if(opts->color) wattroff(win, COLOR_PAIR(DEFAULT_COLOR)); }
void mod_ui::draw_layering_ui_lines(WINDOW *win) { // make window border wborder(win, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX, LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX ); // make appropriate lines mvwhline(win, 3, 1, 0, FULL_SCREEN_WIDTH - 2); mvwhline(win, FULL_SCREEN_HEIGHT - 7, 1, 0, FULL_SCREEN_WIDTH - 2); mvwhline(win, 5, 1, 0, (FULL_SCREEN_WIDTH / 2) - 4); mvwhline(win, 5, (FULL_SCREEN_WIDTH / 2) + 2, 0, (FULL_SCREEN_WIDTH / 2) - 3); mvwvline(win, 3, (FULL_SCREEN_WIDTH / 2) - 4, 0, FULL_SCREEN_HEIGHT - 10); mvwvline(win, 3, (FULL_SCREEN_WIDTH / 2) + 2, 0, FULL_SCREEN_HEIGHT - 10); // Add in connective characters mvwaddch(win, 3, 0, LINE_XXXO); mvwaddch(win, 5, 0, LINE_XXXO); mvwaddch(win, FULL_SCREEN_HEIGHT - 7, 0, LINE_XXXO); mvwaddch(win, 5, (FULL_SCREEN_WIDTH / 2) + 2, LINE_XXXO); mvwaddch(win, 3, FULL_SCREEN_WIDTH - 1, LINE_XOXX); mvwaddch(win, 5, FULL_SCREEN_WIDTH - 1, LINE_XOXX); mvwaddch(win, FULL_SCREEN_HEIGHT - 7, FULL_SCREEN_WIDTH - 1, LINE_XOXX); mvwaddch(win, 5, (FULL_SCREEN_WIDTH / 2) - 4, LINE_XOXX); mvwaddch(win, 3, FULL_SCREEN_WIDTH / 2 - 4, LINE_OXXX); mvwaddch(win, 3, FULL_SCREEN_WIDTH / 2 + 2, LINE_OXXX); mvwaddch(win, FULL_SCREEN_HEIGHT - 7, FULL_SCREEN_WIDTH / 2 - 4, LINE_XXOX); mvwaddch(win, FULL_SCREEN_HEIGHT - 7, FULL_SCREEN_WIDTH / 2 + 2, LINE_XXOX); }
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ void CDrawer::DrawColumns () const { if ( m_cursor->Move( SHEET_BORDER, m_list->m_Psize.m_maxLines.length() + SHEET_BORDER ) == true ) mvwvline( stdscr, m_cursor->GetY(), m_cursor->GetX(), ACS_VLINE, m_list->m_Psize.m_lines ); int x_coord = m_list->m_Psize.m_maxLines.length() + m_list->m_Psize.m_cellWidth + SHEET_BORDER + CELL_BORDER; for ( register int i = 0; i < m_list->m_Vsize.m_columns.m_columnsMax; i++ ) { if ( m_cursor->Move( SHEET_BORDER, x_coord ) == true ) { const std::string& name = m_list->m_Vsize.m_columns.m_column[i]->ShowMyName(); int y = COLUMN_NAME_POS; int x = m_cursor->GetX() - ( (m_list->m_Psize.m_cellWidth - name.length()) / 2 ) - name.length(); mvwprintw(stdscr, y, x, "%s", name.c_str()); if ( i == m_list->m_Vsize.m_columns.m_columnsMax - 1 ) mvwvline( stdscr, m_cursor->GetY(), m_cursor->GetX(), ACS_VLINE, m_list->m_Psize.m_lines ); else { mvwvline( stdscr, m_cursor->GetY(), m_cursor->GetX(), ACS_VLINE, CELL_HEIGHT ); mvwvline( stdscr, m_cursor->GetY() + SPACE_FOR_EDITLINE, m_cursor->GetX(), ACS_VLINE, m_list->m_Psize.m_lines - SPACE_FOR_EDITLINE ); } } x_coord += m_list->m_Psize.m_cellWidth + CELL_BORDER; } }
int show_teacher_info(char *database, int choice) { int c; teacher xteacher; xteacher = get_teacher(database,choice); refresh(); noecho(); curs_set(0); WINDOW *win; int y,x; start_color(); getmaxyx(stdscr,y,x); win = newwin(0, 0, 0, 0); init_pair(1, COLOR_RED, COLOR_BLACK); box(win, 0, 0); print_in_middle(win, y/4 + 1, 0, x, "Info", COLOR_PAIR(1)); mvwhline(win, y/4, x/4, ACS_HLINE, x/2); mvwhline(win, y/4 + 2, x/4, ACS_HLINE, x/2); mvwhline(win, y/2, x/4, ACS_HLINE, x/2); mvwvline(win, y/4 + 1, x/4 , ACS_VLINE, y/4 - 1); mvwaddch(win, y/4, x/4 , ACS_ULCORNER); mvwaddch(win, y/2, x/4 , ACS_LLCORNER); mvwaddch(win, y/4, 3*x/4 , ACS_URCORNER); mvwaddch(win, y/2, 3*x/4 , ACS_LRCORNER); mvwvline(win, y/4 + 1, 3*x/4, ACS_VLINE, y/4 - 1); mvwaddch(win, y/4 + 2, 3*x/4 , ACS_RTEE); mvwaddch(win, y/4 + 2, x/4 , ACS_LTEE); wrefresh(win); mvwaddch(win, y - 3, 0, ACS_LTEE); mvwhline(win, y - 3, 1, ACS_HLINE, x - 2); mvwaddch(win, y - 3, x - 1, ACS_RTEE); move(y/4 + 3,x/3 + 2); printw("Name - %s",xteacher.name); move(y/4 + 5,x/3 + 2); printw("Max Weekly Hours - %d",xteacher.week_time); mvwprintw(win,y - 2, 2,"A:Add Allocation\tB:Back\tQ:Quit"); refresh(); while((c = wgetch(win))){ switch(c) { case KEY_DOWN: case KEY_UP: return 0; case 'B': case 'b': curs_set(1); return 1; case 'Q': case 'q': curs_set(1); return INT_MIN; case 'A': case 'a': return 2; default: break; } wrefresh(win); } curs_set(1); return 0; }
static void draw_color_tile(Vector2i top_left, color_t c) { chtype pair; bool is_def = c == stgs.colors->def; int y = top_left.y, x = top_left.x, s = MENU_TILE_SIZE; /* Draw tile */ wattrset(menuw, pair = GET_PAIR_FOR(c)); if (is_def) { wattron(menuw, A_REVERSE); } draw_square(menuw, top_left, s); /* Draw direction arrow */ if (!is_def) { wattron(menuw, A_REVERSE); mvwaddch(menuw, y+s/2, x+s/2, turn2arrow(stgs.colors->turn[c])); } /* Draw frame */ wattrset(menuw, is_def ? pair : fg_pair); mvwhline(menuw, y, x, ACS_BLOCK, s); mvwvline(menuw, y, x, ACS_BLOCK, s); mvwhline(menuw, y+s-1, x, ACS_BLOCK, s); mvwvline(menuw, y, x+s-1, ACS_BLOCK, s); }
Vector2i get_menu_cdef_pos(void) { return (Vector2i) { .y = get_menu_tile_pos(min(stgs.colors->n, MENU_TILES_PER_COL)).y + MENU_TILE_SIZE + MENU_TILE_VSEP + 1, .x = rules_pos.x - MENU_TILE_SIZE - MENU_TILE_HSEP + 1 }; } static void draw_edge(void) { Simulation *sim = stgs.linked_sim; size_t h = MENU_WINDOW_WIDTH, v = MENU_WINDOW_HEIGHT; if (sim && is_grid_sparse(sim->grid)) { wattrset(menuw, GET_PAIR_FOR(MENU_EDGE_COLOR_S)); mvwaddstr(menuw, sparse_msg_pos.y, sparse_msg_pos.x, sparse_msg); } else { wattrset(menuw, GET_PAIR_FOR(MENU_EDGE_COLOR)); mvwhline(menuw, sparse_msg_pos.y, sparse_msg_pos.x, ' ', strlen(sparse_msg)); } mvwhline(menuw, 0, 0, ACS_BLOCK, h); mvwvline(menuw, 0, 0, ACS_BLOCK, v); mvwhline(menuw, v-1, 0, ACS_BLOCK, h); mvwvline(menuw, 0, h-1, ACS_BLOCK, v); }
static void draw_io_buttons(void) { Vector2i inner1 = { menu_load_pos.y+1, menu_load_pos.x+1 }; Vector2i inner2 = { menu_save_pos.y+1, menu_save_pos.x+1 }; wattrset(menuw, ui_pair); draw_rect(menuw, menu_load_pos, MENU_BUTTON_WIDTH, MENU_BUTTON_HEIGHT); draw_rect(menuw, menu_save_pos, MENU_BUTTON_WIDTH, MENU_BUTTON_HEIGHT); wattron(menuw, A_REVERSE); draw_rect(menuw, inner1, MENU_BUTTON_WIDTH-2, MENU_BUTTON_HEIGHT-2); draw_rect(menuw, inner2, MENU_BUTTON_WIDTH-2, MENU_BUTTON_HEIGHT-2); wattrset(menuw, fg_pair); mvwaddstr(menuw, inner1.y+1, inner1.x, " LOAD "); mvwaddstr(menuw, inner1.y+2, inner1.x, " FROM "); mvwaddstr(menuw, inner1.y+3, inner1.x, " FILE "); mvwaddstr(menuw, inner2.y+1, inner2.x, " SAVE "); mvwaddstr(menuw, inner2.y+2, inner2.x, " TO "); mvwaddstr(menuw, inner2.y+3, inner2.x, " FILE "); /* Draw status indicators */ if (load_status != STATUS_NONE) { wattrset(menuw, GET_PAIR_FOR((load_status == STATUS_SUCCESS) ? COLOR_LIME : COLOR_RED)); mvwvline(menuw, menu_load_pos.y, menu_load_pos.x+MENU_BUTTON_WIDTH, ACS_BLOCK, MENU_BUTTON_HEIGHT); } if (save_status != STATUS_NONE) { wattrset(menuw, GET_PAIR_FOR((save_status == STATUS_SUCCESS) ? COLOR_LIME : COLOR_RED)); mvwvline(menuw, menu_save_pos.y, menu_save_pos.x+MENU_BUTTON_WIDTH, ACS_BLOCK, MENU_BUTTON_HEIGHT); } }
void DrawBox(WINDOW* win, int height, int width, int starty, int startx, bool isFirst, bool isLast) { mvwhline(win, starty, startx + 1, ACS_HLINE, width ); mvwhline(win, starty + height - 1, startx + 1, ACS_HLINE, width ); mvwvline(win, starty + 1, startx, ACS_VLINE, height - 2 ); //mvwvline(win, starty + 1 , width + startx, ACS_VLINE, height - 2 ); zlog_info(c, "Drawing box (h=%3d, w=%3d, starty=%3d, startx=%3d, f=%d, l=%d", height, width, starty, startx, isFirst, isLast); wmove(win, starty + 1, startx + 2); wprintw(win, "%d,%d,%d", startx, starty, (starty % 3)); if (isFirst) { wmove(win, starty, startx); waddch(win, ACS_ULCORNER); wmove(win, starty + height - 1, startx); waddch(win, ACS_LLCORNER); } if (!isLast) { wmove(win, starty, startx + width); waddch(win, ACS_TTEE); wmove(win, starty + height - 1, startx + width); waddch(win, ACS_BTEE); }else{ wmove(win, starty, startx + width); waddch(win, ACS_URCORNER); wmove(win, starty + height - 1, startx + width); waddch(win, ACS_LRCORNER); mvwvline(win, starty + 1, width + startx, ACS_VLINE, height - 2 ); } }
/* * This draws a box with attributes and lets the user define * each element of the box. */ void attrbox (WINDOW *win, chtype tlc, chtype trc, chtype blc, chtype brc, chtype horz, chtype vert, chtype attr) { /* *INDENT-EQLS* */ int x1 = 0; int y1 = 0; int y2 = getmaxy (win) - 1; int x2 = getmaxx (win) - 1; int count = 0; /* Draw horizontal lines. */ if (horz != 0) { mvwhline (win, y1, 0, horz | attr, getmaxx (win)); mvwhline (win, y2, 0, horz | attr, getmaxx (win)); count++; } /* Draw vertical lines. */ if (vert != 0) { mvwvline (win, 0, x1, vert | attr, getmaxy (win)); mvwvline (win, 0, x2, vert | attr, getmaxy (win)); count++; } /* Draw in the corners. */ if (tlc != 0) { mvwaddch (win, y1, x1, tlc | attr); count++; } if (trc != 0) { mvwaddch (win, y1, x2, trc | attr); count++; } if (blc != 0) { mvwaddch (win, y2, x1, blc | attr); count++; } if (brc != 0) { mvwaddch (win, y2, x2, brc | attr); count++; } if (count != 0) { wrefresh (win); } }
void Window::printBox(int x, int y, int w, int h) const { mvwaddch(window_white, y, x, ACS_PLUS); mvwaddch(window_white, y, x + w, ACS_PLUS); mvwaddch(window_white, y + h, x, ACS_PLUS); mvwaddch(window_white, y + h, x + w, ACS_PLUS); mvwhline(window_white, y, x + 1, ACS_HLINE, w - 1); mvwhline(window_white, y + h, x + 1, ACS_HLINE, w - 1); mvwvline(window_white, y + 1, x, '|', h - 1); mvwvline(window_white, y + 1, x + w, '|', h - 1); }
void draw_background(int x_size, int y_size) { // TODO use same calculations as the actual windows // cmd_win uses 20 characters, divide the rest of the screen between game_win and log_win int gamew_width = (x_size - 20)/2; // the position of the line between game_win and log_win gamew_logw_sep = gamew_width + 20; wclear(background_win); box(background_win, 0, 0); // line between cmd_win and game_win mvwvline(background_win, 1, 20, ACS_VLINE, y_size-2); // line between game_win and log_win mvwvline(background_win, 1, gamew_logw_sep, ACS_VLINE, y_size-2); // line between cmd_win and skills_win mvwhline(background_win, y_size-SKILLS_Y, 1, ACS_HLINE, 20-1); logw_inputw_sep(); // line between logwindow and input window // corner characters mvwaddch(background_win, 0, 20, ACS_TTEE); mvwaddch(background_win, 0, gamew_logw_sep, ACS_TTEE); mvwaddch(background_win, y_size-1, 20, ACS_BTEE); mvwaddch(background_win, y_size-1, gamew_logw_sep, ACS_BTEE); mvwaddch(background_win, y_size-SKILLS_Y, 0, ACS_LTEE); /* Skills window horizontal line */ mvwaddch(background_win, y_size-SKILLS_Y, 20, ACS_RTEE); /* Skills window horizontal line */ mvwaddch(background_win, y_size-3, gamew_logw_sep, ACS_LTEE); mvwaddch(background_win, y_size-3, x_size-1, ACS_RTEE); /* 'W' for WEAPON in Weapon & Skills */ mvwaddch(background_win, (y_size-SKILLS_Y+1), 2, ('W') | A_BOLD); // skill numbers for Weapon & Skills for (int i = 1; i < 5; i++) { mvwaddch(background_win, (y_size-SKILLS_Y+1)+i, 2, ('0' + i) | A_BOLD); } // input prompt mvwaddch(background_win, y_size-2, gamew_logw_sep+1, ACS_RARROW | A_BOLD); //window titles mvwaddstr(background_win, 0, 2, "Actions"); mvwaddstr(background_win, y_size-7, 2, "Weapon & Skills"); mvwaddstr(background_win, 0, 22, "GameW"); mvwaddstr(background_win, 0, gamew_logw_sep+2, "Log"); mvwaddstr(background_win, y_size-3, gamew_logw_sep+2, "Press TAB for Input"); // version number wattron(background_win, A_DIM); mvwprintw(background_win, y_size-1, 20 + (gamew_width/2) - 5, "ToDD %s", REVID); wattroff(background_win, A_DIM); }
int win_ini(int *fil, int *col, char creq, unsigned int inv) { int p_fil,p_col; chtype wc; if (hi_ha_win) return(-1); /* error si ja s'havia creat la finestra */ if (initscr() == NULL) return(-2); /* error en iniciar les curses */ if ((*fil > LINES) || (*col > COLS)) /* error en les mides */ { endwin(); return(-3); } if (*fil == 0) *fil = LINES; /* cas de mida maxima */ if (*col == 0) *col = COLS; p_fil = (LINES - *fil)/ 2; /* posicio de la finestra centrada */ p_col = (COLS - *col) / 2; /* canviar interrupcio de final de proces */ oldsig = signal(SIGINT,win_fi); /* configuracio preliminar de les curses */ cbreak(); /* rep tecles sense buffering */ noecho(); /* no fa echo de les tecles llegides */ nonl(); /* el newline \n no es tradueix a CR i LF */ intrflush(stdscr,FALSE); /* ^C no s'esborra del buffer d'entrada */ keypad(stdscr,TRUE); /* s'activa el teclat numeric i mov. cursor */ win = newwin(*fil, *col, p_fil, p_col); if (win == NULL) /* error en la creacio de la finestra */ { endwin(); return(-4); } hi_ha_win = TRUE; leaveok(win,TRUE); /* dibuixar en pantalla no modificara el cursor */ curs_set(0); /* fixa el cursor com a invisible */ nodelay(win,TRUE); refresh(); /* refresca la pantalla (inicialment l'esborra) */ ufil = *fil; /* memoritza numero files */ ucol = *col; /* memoritza numero columnes */ wc = creq; /* dibuixa el requadre */ if (inv) wc |= A_REVERSE; mvwhline(win,0,0,wc,ucol); /* fila superior */ mvwhline(win,ufil-2,0,wc,ucol); /* fila inferior */ mvwvline(win,1,0,wc,ufil-2); /* columna dreta */ mvwvline(win,1,ucol-1,wc,ufil-2); /* columna esquerra */ wrefresh(win); /* redibuixa el contingut de la finestra */ return(0); /* retorna OK */ }
static int SCW_VLineAt(lua_State *L){ WINDOW **w = checkSelCWindow(L); int x = luaL_checkint(L, 2); int y = luaL_checkint(L, 3); int n = luaL_checkint(L, 4); char ch = '|'; if(lua_gettop(L) > 4) switch( lua_type(L, 5 )){ case LUA_TNUMBER: ch = lua_tointeger(L, 5 ); break; case LUA_TSTRING: ch = *lua_tostring(L, 5 ); break; default : lua_pushnil(L); lua_pushstring(L, "VlineAt() expects an integer or a string"); return 2; } if(mvwvline( *w, y ,x, ch, n ) == ERR){ lua_pushnil(L); lua_pushstring(L, "wvline() returned an error"); return 2; } return 0; }
void draw_vscrollbar(WINDOW *win, int value, int max, int left) { int height, width, cline, scrollen, scrollypos, scrollxpos; // Get window available space getmaxyx(win, height, width); // If no even a screen has been filled, don't draw it if (max < height) return; // Display the scrollbar left or right scrollxpos = (left) ? 0 : width - 1; // Initialize scrollbar line mvwvline(win, 0, scrollxpos, ACS_VLINE, height); // How long the scroll will be if (!(scrollen = (height * 1.0f / max * height) + 0.5)) scrollen = 1; // Where will the scroll start scrollypos = height * (value * 1.0f / max); // Draw the N blocks of the scrollbar for (cline = 0; cline < scrollen; cline++) mvwaddch(win, cline + scrollypos, scrollxpos, ACS_CKBOARD); }
void mk_subcol(int menu, int col, int inter, int start) { mvwaddch(g_ctrl.menu[menu].win, start - 1, col, ACS_TTEE); mvwvline(g_ctrl.menu[menu].win, start, col, 0, WHEIGHT - 1); mvwaddch(g_ctrl.menu[menu].win, inter, col, ACS_PLUS); mvwaddch(g_ctrl.menu[menu].win, WHEIGHT - 1, col, ACS_BTEE); }
void ui_scrollbar_draw(scrollbar_t sb) { int height, width, cline, scrollen, scrollypos, scrollxpos; // Get window available space getmaxyx(sb.win, height, width); // If no even a screen has been filled, don't draw it if (sb.max < height) return; // Display the scrollbar left or right scrollxpos = (sb.dock == SB_LEFT) ? 0 : width - 1; // Initialize scrollbar line mvwvline(sb.win, 0, scrollxpos, ACS_VLINE, height); // How long the scroll will be if (!(scrollen = (height * 1.0f / sb.max * height) + 0.5)) scrollen = 1; // Where will the scroll start scrollypos = height * (sb.pos * 1.0f / sb.max); // Draw the N blocks of the scrollbar for (cline = 0; cline < scrollen; cline++) { mvwaddch(sb.win, cline + scrollypos, scrollxpos, ACS_CKBOARD); } }
static TACommandVerdict mvwvline_cmd(TAThread thread,TAInputStream stream) { WINDOW *win; chtype ch; int n; int y; int x; int res; win = readPointer(&stream); y = readInt(&stream); x = readInt(&stream); ch = readChType(&stream); n = readInt(&stream); START_TARGET_OPERATION(thread); res = mvwvline(win, y, x, ch, n); END_TARGET_OPERATION(thread); writeInt(thread, res); sendResponse(thread); return taDefaultVerdict; }
/* * This draws a line on the given window. (odd angle lines not working yet) */ void drawLine (WINDOW *window, int startx, int starty, int endx, int endy, chtype line) { /* *INDENT-EQLS* */ int xdiff = endx - startx; int ydiff = endy - starty; int x = 0; int y = 0; /* Determine if we are drawing a horizontal or vertical line. */ if (ydiff == 0) { if (xdiff > 0) mvwhline (window, starty, startx, line, xdiff); } else if (xdiff == 0) { if (ydiff > 0) mvwvline (window, starty, startx, line, ydiff); } else { /* We need to determine the angle of the line. */ /* *INDENT-EQLS* */ int height = xdiff; int width = ydiff; int xratio = (height > width ? 1 : (width / height)); int yratio = (width > height ? (width / height) : 1); int xadj = 0; int yadj = 0; /* Set the vars. */ x = startx; y = starty; while (x != endx && y != endy) { /* Add the char to the window. */ mvwaddch (window, y, x, line); /* Make the x and y adjustments. */ if (xadj != xratio) { x = (xdiff < 0 ? x - 1 : x + 1); xadj++; } else { xadj = 0; } if (yadj != yratio) { y = (ydiff < 0 ? y - 1 : y + 1); yadj++; } else { yadj = 0; } } } }
/* * Draw board for Three Man Morris */ WINDOW * create_3board(const game *g) { WINDOW *local_win; int r = 0; char c = 'a'; local_win = newwin(13 + legendsep, 21 + legendsep, brdrow, brdcol); /* Draw the legend */ for (r = 0; r < 3; r++) { mvwprintw(local_win, 6*r, 0, "%d", 3-r); } c = 'a'; for (r = 0; r < 21; r += 9) { mvwaddch(local_win, 14, legendsep + r, c++); } /* Draw the board lines */ for (r = 0; r < 3; r++) { mvwhline(local_win, 6*r, legendsep, '-', 18); mvwvline(local_win, 1, legendsep + 9*r, '|', 11); } update_3board(local_win, g); return local_win; }
// Board::getMiss(int i) // { // // } void Board::drawBoard(Fleet *pFleet) { int i; refresh(); wrefresh(m_pBoard); box(m_pBoard,0,0); for(i=m_heightStep;i<m_height-1;i+=m_heightStep){ mvwhline(m_pBoard,i,1,ACS_HLINE,m_horizontalLength); } for(i=m_widthStep;i<m_width-1;i+=m_widthStep){ mvwvline(m_pBoard,1,i,ACS_VLINE,m_verticalLength); } if(pFleet!=NULL) { pFleet->printFleet(); } for(i=0;i<m_missCount;i+=2){ mvwprintw(m_pBoard,m_missTab[i],m_missTab[i+1],"O"); } // for(i=0;i<m_logicalY;i++){ // if(m_missTab[i*m_logicalY]){ // mvwprintw(m_pBoard,m_missTab[i*m_logicalY],m_missTab[i*m_logicalY+1],"O"); // } // } refresh(); wrefresh(m_pBoard); }
void msg_diff_create(ui_t *ui) { int hwidth; msg_diff_info_t *info; // Create a new panel to fill all the screen ui_panel_create(ui, LINES, COLS); // Initialize panel specific data info = sng_malloc(sizeof(msg_diff_info_t)); // Store it into panel userptr set_panel_userptr(ui->panel, (void*) info); // Calculate subwindows width hwidth = ui->width / 2 - 1; // Create 2 subwindows, one for each message info->one_win = subwin(ui->win, ui->height - 2, hwidth, 1, 0); info->two_win = subwin(ui->win, ui->height - 2, hwidth, 1, hwidth + 1); // Header - Footer - Address // Draw a vertical line to separe both subwindows mvwvline(ui->win, 0, hwidth, ACS_VLINE, ui->height); // Draw title ui_set_title(ui, "sngrep - SIP messages flow viewer"); // Draw keybindings msg_diff_draw_footer(ui); }
void printgraphw(WINDOW *win, char *name, unsigned long *array, unsigned long max, bool siunits, int lines, int cols, int color) { int y, x; werase(win); box(win, 0, 0); mvwvline(win, 0, 1, '-', lines-1); if (name) mvwprintw(win, 0, cols - 5 - strlen(name), "[ %s ]",name); mvwprintw(win, 0, 1, "[ %s/s ]", bytestostr(max, siunits)); mvwprintw(win, lines-1, 1, "[ %s/s ]", bytestostr(0.0, siunits)); wattron(win, color); for (y = 0; y < (lines - 2); y++) { for (x = 0; x < (cols - 3); x++) { if (array[x] && max) { if (lines - 3 - ((double) array[x] / max * lines) < y) mvwaddch(win, y + 1, x + 2, '*'); } } } wattroff(win, color); wnoutrefresh(win); }
static void envelope_buddylist(GntWidget *win) { int w, h; gnt_widget_get_size(win, &w, &h); wresize(win->window, h, w + 1); mvwvline(win->window, 0, w, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), h); touchwin(win->window); }
static void drawBuilding(building_st* build) { int x = build->xPos * GRID_SCALE_X; int y = build->yPos * GRID_SCALE_Y; int xSize = build->xSize * (GRID_SCALE_X-1); int ySize = build->ySize * (GRID_SCALE_Y-1); int type = build->type; mvwhline(win, y, x, 0, xSize); mvwhline(win, y+ySize, x, 0, xSize); if (!(type & NO_RWALL)) mvwvline(win, y, x, 0, ySize); if (!(type & NO_LWALL)) mvwvline(win, y, x+xSize, 0, ySize); int tl, tr, ll, lr; //corners tl = ACS_ULCORNER; tr = ACS_URCORNER; ll = ACS_LLCORNER; lr = ACS_LRCORNER; if (type & NO_LWALL) { tr = ACS_HLINE; lr = ACS_HLINE; } if (type & NO_RWALL) { tl = ACS_HLINE; ll = ACS_HLINE; } if (type & RUNWAY) //print dashed line in middle of runway mvwaddch(win, (y+y+ySize)/2, (x+x+xSize)/2, '-'); else if (type & TERMINAL) mvwprintw(win, y+ySize-1, x+1, "terminal"); mvwaddch(win, y, x, tl); //corners clockwise mvwaddch(win, y, x+xSize, tr); mvwaddch(win, y+ySize, x, ll); mvwaddch(win, y+ySize, x+xSize, lr); }
void drawBox(WINDOW* window, const WindowRegion& region) { // draw the corners mvwaddch(window, region.y, region.x, ACS_ULCORNER); // upper left corner. mvwaddch(window, region.y, region.x + region.width - 1, ACS_URCORNER); // upper right corner. mvwaddch(window, region.y + region.height - 1, region.x, ACS_LLCORNER); // lower left corner. mvwaddch(window, region.y + region.height - 1, region.x + region.width - 1, ACS_LRCORNER); // lower right corner. // draw al the lines if(region.width > 2) { mvwhline(window, region.y, region.x + 1, ACS_HLINE, region.width - 2); // top line mvwhline(window, region.y + region.height - 1, region.x + 1, ACS_HLINE, region.width - 2); // bottom line } if(region.height > 2) { mvwvline(window, region.y + 1, region.x, ACS_VLINE, region.height - 2); // left line mvwvline(window, region.y + 1, region.x + region.width - 1, ACS_VLINE, region.height - 2); // right line } }
void wnicebox(WINDOW *win, int y, int x, int height, int width, char *boxname) { height += 1; width += 1; wattrset(win, modify_attr(COLOR_PAIR(C_BORDER))); mvwaddch(win, y, x, ACS_ULCORNER); whline(win, ACS_HLINE, width); mvwaddch(win, y, x + width, ACS_URCORNER); mvwaddch(win, y + height, x, ACS_LLCORNER); whline(win, ACS_HLINE, width); mvwaddch(win, y + height, x + width, ACS_LRCORNER); mvwvline(win, y + 1, x + width, ACS_VLINE, height - 1); mvwvline(win, y + 1, x, ACS_VLINE, height - 1); mvwprintw(win, y, x + 2, boxname); return; }
/* * Draw board for Nine Man Morris */ WINDOW * create_9board(const game *g) { WINDOW *local_win; int r = 0; char c = 'a'; local_win = newwin(13 + legendsep, 21 + legendsep, brdrow, brdcol); /* Draw the legend */ for (r = 0; r < 7; r++) { mvwprintw(local_win, 2*r, 0, "%d", 7-r); } c = 'a'; for (r = 0; r < 21; r += 3) { mvwaddch(local_win, 14, legendsep + r, c++); } /* Draw the board lines */ for (r = 0; r < 3; r++) { /* Top line */ mvwhline(local_win, 2*r, legendsep + 3*r, '-', 18 - 6*r); /* Left line */ mvwvline(local_win, 2*r, legendsep + 3*r, '|', 13 - 4*r); /* Bottom line */ mvwhline(local_win, 12 - 2*r, legendsep + 3*r, '-', 18 - 6*r); /* Right line */ mvwvline(local_win, 2*r, 18 + legendsep - 3*r, '|', 13 - 4*r); } /* TV crossline */ mvwvline(local_win, 1, legendsep + 9, '|', 3); /* LH crossline */ mvwhline(local_win, 6, legendsep + 1, '-', 5); /* BV crossline */ mvwvline(local_win, 9, legendsep + 9, '|', 3); /* RH crossline */ mvwhline(local_win, 6, legendsep + 13, '-', 5); update_9board(local_win, g); return local_win; }
static void gnt_slider_draw(GntWidget *widget) { GntSlider *slider = GNT_SLIDER(widget); int attr = 0; int position, size = 0; if (slider->vertical) size = widget->priv.height; else size = widget->priv.width; if (gnt_widget_has_focus(widget)) attr |= GNT_COLOR_HIGHLIGHT; else attr |= GNT_COLOR_HIGHLIGHT_D; if (slider->max != slider->min) position = ((size - 1) * (slider->current - slider->min)) / (slider->max - slider->min); else position = 0; if (slider->vertical) { mvwvline(widget->window, size-position, 0, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL) | A_BOLD, position); mvwvline(widget->window, 0, 0, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL), size-position); } else { mvwhline(widget->window, 0, 0, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL) | A_BOLD, position); mvwhline(widget->window, 0, position, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL), size - position); } mvwaddch(widget->window, slider->vertical ? (size - position - 1) : 0, slider->vertical ? 0 : position, ACS_CKBOARD | gnt_color_pair(attr)); }
bool mrutils::ColChooser::init() { mrutils::mutexAcquire(updateMutex); refresh(); if (createdWin) { use_default_colors(); start_color(); } keypad(stdscr, TRUE); if (enableMouse) mousemask(ALL_MOUSE_EVENTS, NULL); init_pair(COL_BLANK , -1, -1); init_pair(COL_SELECTED, 0, 12); init_pair(COL_INPUT , 0, 8); init_pair(COL_TARGETED, 0, 11); if (data.size() > 1) { int columns = data.size(); int width = (cols - data[0].colWidth) / (columns - 1); data[columns-1].colWidth = cols - data[0].colWidth; for (int i = 1; i < columns-1; ++i) { data[i].colWidth = width; data[columns-1].colWidth -= width; mvwvline((WINDOW*)chooserWin, 0, data[i-1].colWidth, ACS_VLINE, lines-1); } mvwvline((WINDOW*)chooserWin, 0, cols - data[columns-1].colWidth, ACS_VLINE, lines-1); } wmove((WINDOW*)chooserWin,0,0); mrutils::mutexRelease(updateMutex); return true; }