Beispiel #1
0
static void screen_draw() {
  switch(pstate) {
    case ST_CALC:   calc_draw();   break;
    case ST_BROWSE: browse_draw(); break;
    case ST_HELP:   help_draw();   break;
    case ST_DEL:    delete_draw(); break;
  }
}
Beispiel #2
0
void dir_draw() {
  switch(dir_ui) {
  case 0:
    if(dir_fatalerr)
      fprintf(stderr, "%s.\n", dir_fatalerr);
    break;
  case 1:
    if(dir_fatalerr)
      fprintf(stderr, "\r%s.\n", dir_fatalerr);
    else if(dir_output.size)
      fprintf(stderr, "\r%-55s %8d files /%s",
        cropstr(dir_curpath, 55), dir_output.items, formatsize(dir_output.size));
    else
      fprintf(stderr, "\r%-65s %8d files", cropstr(dir_curpath, 65), dir_output.items);
    break;
  case 2:
    browse_draw();
    if(dir_fatalerr)
      draw_error(dir_curpath, dir_fatalerr);
    else
      draw_progress();
    break;
  }
}
Beispiel #3
0
void help_draw() {
  int i, line;

  browse_draw();

  nccreate(15, 60, "ncdu help");
  ncaddstr(13, 38, "Press q to continue");

  if(page == 1)
    attron(A_REVERSE);
  ncaddstr(0, 30, "1:Keys");
  attroff(A_REVERSE);
  if(page == 2)
    attron(A_REVERSE);
  ncaddstr(0, 39, "2:Format");
  attroff(A_REVERSE);
  if(page == 3)
    attron(A_REVERSE);
  ncaddstr(0, 50, "3:About");
  attroff(A_REVERSE);

  switch(page) {
    case 1:
      line = 1;
      for(i=start*2; i<start*2+20; i+=2) {
        attron(A_BOLD);
        ncaddstr(++line, 13-strlen(keys[i]), keys[i]);
        attroff(A_BOLD);
        ncaddstr(line, 15, keys[i+1]);
      }
      if(start != KEYS-10)
        ncaddstr(12, 25, "-- more --");
      break;
    case 2:
      attron(A_BOLD);
      ncaddstr(2, 3, "X  [size] [graph] [file or directory]");
      attroff(A_BOLD);
      ncaddstr(3, 4, "The X is only present in the following cases:");
      attron(A_BOLD);
      ncaddch( 5, 4, '!');
      ncaddch( 6, 4, '.');
      ncaddch( 7, 4, '<');
      ncaddch( 8, 4, '>');
      ncaddch( 9, 4, '@');
      ncaddch(10, 4, 'H');
      ncaddch(11, 4, 'e');
      attroff(A_BOLD);
      ncaddstr( 5, 7, "An error occured while reading this directory");
      ncaddstr( 6, 7, "An error occured while reading a subdirectory");
      ncaddstr( 7, 7, "File or directory is excluded from the statistics");
      ncaddstr( 8, 7, "Directory was on an other filesystem");
      ncaddstr( 9, 7, "This is not a file nor a dir (symlink, socket, ...)");
      ncaddstr(10, 7, "Same file was already counted (hard link)");
      ncaddstr(11, 7, "Empty directory");
      break;
    case 3:
      /* Indeed, too much spare time */
      attron(A_REVERSE);
#define x 12
#define y 3
      /* N */
      ncaddstr(y+0, x+0, "      ");
      ncaddstr(y+1, x+0, "  ");
      ncaddstr(y+2, x+0, "  ");
      ncaddstr(y+3, x+0, "  ");
      ncaddstr(y+4, x+0, "  ");
      ncaddstr(y+1, x+4, "  ");
      ncaddstr(y+2, x+4, "  ");
      ncaddstr(y+3, x+4, "  ");
      ncaddstr(y+4, x+4, "  ");
      /* C */
      ncaddstr(y+0, x+8, "     ");
      ncaddstr(y+1, x+8, "  ");
      ncaddstr(y+2, x+8, "  ");
      ncaddstr(y+3, x+8, "  ");
      ncaddstr(y+4, x+8, "     ");
      /* D */
      ncaddstr(y+0, x+19, "  ");
      ncaddstr(y+1, x+19, "  ");
      ncaddstr(y+2, x+15, "      ");
      ncaddstr(y+3, x+15, "  ");
      ncaddstr(y+3, x+19, "  ");
      ncaddstr(y+4, x+15, "      ");
      /* U */
      ncaddstr(y+0, x+23, "  ");
      ncaddstr(y+1, x+23, "  ");
      ncaddstr(y+2, x+23, "  ");
      ncaddstr(y+3, x+23, "  ");
      ncaddstr(y+0, x+27, "  ");
      ncaddstr(y+1, x+27, "  ");
      ncaddstr(y+2, x+27, "  ");
      ncaddstr(y+3, x+27, "  ");
      ncaddstr(y+4, x+23, "      ");
      attroff(A_REVERSE);
      ncaddstr(y+0, x+30, "NCurses");
      ncaddstr(y+1, x+30, "Disk");
      ncaddstr(y+2, x+30, "Usage");
      ncprint( y+4, x+30, "%s", PACKAGE_VERSION);
      ncaddstr( 9,  7, "Written by Yoran Heling <*****@*****.**>");
      ncaddstr(10, 16, "http://dev.yorhel.nl/ncdu/");
      break;
  }
}
Beispiel #4
0
void quit_draw() {
  browse_draw();

  nccreate(4,30, "ncdu confirm quit");
  ncaddstr(2,2, "Really quit? (y/N)");
}