Advertisement
Guest User

Untitled

a guest
Sep 20th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. // This prints a red '>' in the inputLine window properly. //
  2. wattron(inputLine, A_BOLD | COLOR_PAIR(COLOR_RED));
  3. wprintw(inputLine, "n> ");
  4. wattroff(inputLine, A_BOLD | COLOR_PAIR(COLOR_RED));
  5.  
  6. // This prints a light grey "Le Testing." to stdscr. Why isn't it red? //
  7. wattron(stdscr, A_BOLD | COLOR_PAIR(COLOR_RED));
  8. cout << "nLe Testing.n";
  9. wattroff(stdscr, A_BOLD | COLOR_PAIR(COLOR_RED));
  10.  
  11. // This does nothing. I have no idea why. //
  12. wattron(stdscr, A_BOLD | COLOR_PAIR(COLOR_RED));
  13. wprintw(stdstc, "nLe Testing.n");
  14. wattroff(stdscr, A_BOLD | COLOR_PAIR(COLOR_RED));
  15.  
  16. // Open the output log which will mimic stdout. //
  17. if (userPath)
  18. {
  19. string filename = string(userPath) + LOG_FILENAME;
  20. log.open(filename.c_str());
  21. }
  22.  
  23. // Initialize the pdCurses screen. //
  24. initscr();
  25.  
  26. // Resize the stdout screen and create a line for input. //
  27. resize_window(stdscr, LINES - 1, COLS);
  28. inputLine = newwin(1, COLS, LINES - 1, 0);
  29.  
  30. // Initialize colors. //
  31. if (has_colors())
  32. {
  33. start_color();
  34. for (int i = 1; i <= COLOR_WHITE; ++i)
  35. {
  36. init_pair(i, i, COLOR_BLACK);
  37. }
  38. }
  39. else
  40. {
  41. cout << "Terminal cannot print colors.n";
  42. if (log.is_open())
  43. log << "Terminal cannot print colors.n";
  44. }
  45.  
  46. scrollok(stdscr, true);
  47. scrollok(inputLine, true);
  48.  
  49. leaveok(stdscr, true);
  50. leaveok(inputLine, true);
  51.  
  52. nodelay(inputLine, true);
  53. cbreak();
  54. noecho();
  55. keypad(inputLine, true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement