Ejemplo n.º 1
0
static bool will_print_blank(cell c)
{
    return (((cell_style(c) == PICTURE_STYLE) && !show_pictures)
	|| ((cell_char(c) == ' ')
	 && ((cell_style(c) != REVERSE_STYLE)
	|| (rv_blank_char == ' '))));
}
Ejemplo n.º 2
0
/* Print a cell to stdout.  */
static void show_cell(cell cel)
{
  char c = cell_char(cel);
  switch (cell_style(cel)) {
  case 0:
    putchar(c);
    break;
  case PICTURE_STYLE:
    putchar(show_pictures ? c : ' ');
    break;
  case REVERSE_STYLE:
    if (c == ' ')
      putchar(rv_blank_char);
    else
      switch (rv_mode) {
      case RV_NONE: putchar(c); break;
      case RV_CAPS: putchar(toupper(c)); break;
      case RV_UNDERLINE: putchar('_'); putchar('\b'); putchar(c); break;
      case RV_DOUBLESTRIKE: putchar(c); putchar('\b'); putchar(c); break;
      }
    break;
  }
}
Ejemplo n.º 3
0
bool dumb_output_handle_setting(const char *setting, bool show_cursor,
				bool startup)
{
  char *p;
  int i;

  if (!strncmp(setting, "pb", 2)) {
    toggle(&show_pictures, setting[2]);
    printf("Picture outlines display %s\n", show_pictures ? "ON" : "OFF");
    if (startup)
      return TRUE;
    for (i = 0; i < screen_cells; i++)
      screen_changes[i] = (cell_style(screen_data[i]) == PICTURE_STYLE);
    dumb_show_screen(show_cursor);

  } else if (!strncmp(setting, "vb", 2)) {
    toggle(&visual_bell, setting[2]);
    printf("Visual bell %s\n", visual_bell ? "ON" : "OFF");
    os_beep(1); os_beep(2);

  } else if (!strncmp(setting, "ln", 2)) {
    toggle(&show_line_numbers, setting[2]);
    printf("Line numbering %s\n", show_line_numbers ? "ON" : "OFF");

  } else if (!strncmp(setting, "lt", 2)) {
    toggle(&show_line_types, setting[2]);
    printf("Line-type display %s\n", show_line_types ? "ON" : "OFF");

  } else if (*setting == 'c') {
    switch (setting[1]) {
    case 'm': compression_mode = COMPRESSION_MAX; break;
    case 's': compression_mode = COMPRESSION_SPANS; break;
    case 'n': compression_mode = COMPRESSION_NONE; break;
    case 'h': hide_lines = atoi(&setting[2]); break;
    default: return FALSE;
    }
    printf("Compression mode %s, hiding top %d lines\n",
	   compression_names[compression_mode], hide_lines);

  } else if (*setting == 'r') {
    switch (setting[1]) {
    case 'n': rv_mode = RV_NONE; break;
    case 'o': rv_mode = RV_DOUBLESTRIKE; break;
    case 'u': rv_mode = RV_UNDERLINE; break;
    case 'c': rv_mode = RV_CAPS; break;
    case 'b': rv_blank_char = setting[2] ? setting[2] : ' '; break;
    default: return FALSE;
    }
    printf("Reverse-video mode %s, blanks reverse to '%c': ",
	   rv_names[rv_mode], rv_blank_char);
    for (p = "sample reverse text"; *p; p++)
      show_cell(make_cell(REVERSE_STYLE, *p));
    putchar('\n');
    for (i = 0; i < screen_cells; i++)
      screen_changes[i] = (cell_style(screen_data[i]) == REVERSE_STYLE);
    dumb_show_screen(show_cursor);

  } else if (!strcmp(setting, "set")) {
    printf("Compression Mode %s, hiding top %d lines\n",
	   compression_names[compression_mode], hide_lines);
    printf("Picture Boxes display %s\n", show_pictures ? "ON" : "OFF");
    printf("Visual Bell %s\n", visual_bell ? "ON" : "OFF");
    os_beep(1); os_beep(2);
    printf("Line Numbering %s\n", show_line_numbers ? "ON" : "OFF");
    printf("Line-Type display %s\n", show_line_types ? "ON" : "OFF");
    printf("Reverse-Video mode %s, Blanks reverse to '%c': ",
	   rv_names[rv_mode], rv_blank_char);
    for (p = "sample reverse text"; *p; p++)
      show_cell(make_cell(REVERSE_STYLE, *p));
    putchar('\n');
  } else
    return FALSE;
  return TRUE;
}
Ejemplo n.º 4
0
/* Check if a cell is a blank or will display as one.
 * (Used to help decide if contents are worth printing.)  */
static bool is_blank(cell c)
{
  return ((cell_char(c) == ' ')
	  || ((cell_style(c) == PICTURE_STYLE) && !show_pictures));
}