You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

83 line
3.0 KiB

  1. /*
  2. * neercs console-based window manager
  3. * Copyright (c) 2006-2010 Sam Hocevar <sam@hocevar.net>
  4. * 2008-2010 Jean-Yves Lamoureux <jylam@lnxscene.org>
  5. * All Rights Reserved
  6. *
  7. * This program is free software. It comes without any warranty, to
  8. * the extent permitted by applicable law. You can redistribute it
  9. * and/or modify it under the terms of the Do What The Fuck You Want
  10. * To Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. #if defined HAVE_CONFIG_H
  14. # include "config.h"
  15. #endif
  16. #if !defined _WIN32
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <string.h>
  20. #include <time.h>
  21. #include <sys/wait.h>
  22. #include <sys/types.h>
  23. #include <caca.h>
  24. #include "neercs.h"
  25. int help_handle_key(struct screen_list *screen_list, unsigned int c)
  26. {
  27. if (c == CACA_KEY_ESCAPE || c == '?')
  28. {
  29. screen_list->modals.help = 0;
  30. screen_list->changed = 1;
  31. return 1;
  32. }
  33. else
  34. {
  35. return 0;
  36. }
  37. }
  38. void draw_help(struct screen_list *screen_list)
  39. {
  40. int w = 65, h = 20;
  41. int x = (caca_get_canvas_width(screen_list->cv) - w) / 2;
  42. int y = (caca_get_canvas_height(screen_list->cv) - h) / 2;
  43. caca_set_color_ansi(screen_list->cv, CACA_BLUE, CACA_BLUE);
  44. caca_fill_box(screen_list->cv, x, y, w, h, '#');
  45. caca_set_color_ansi(screen_list->cv, CACA_DEFAULT, CACA_BLUE);
  46. caca_draw_cp437_box(screen_list->cv, x, y, w, h);
  47. x += 2;
  48. y++;
  49. caca_printf(screen_list->cv,
  50. (caca_get_canvas_width(screen_list->cv) -
  51. strlen(PACKAGE_STRING)) / 2, y - 1, PACKAGE_STRING);
  52. caca_printf(screen_list->cv, x, y++, "Copyright (c) 2006-2010");
  53. caca_printf(screen_list->cv, x, y++, " Sam Hocevar <sam@zoy.org>");
  54. caca_printf(screen_list->cv, x, y++, " Jean-Yves Lamoureux <jylam@lnxscene.org>");
  55. caca_printf(screen_list->cv, x, y++, " Pascal Terjan <pterjan@linuxfr.org>");
  56. caca_printf(screen_list->cv, x, y++, "");
  57. caca_printf(screen_list->cv, x, y++, "");
  58. caca_printf(screen_list->cv, x, y++, "All shortcuts are in format 'ctrl-a-X' where X is :");
  59. caca_printf(screen_list->cv, x, y++, "n: Next window");
  60. caca_printf(screen_list->cv, x, y++, "p: Previous window");
  61. caca_printf(screen_list->cv, x, y++, "w: Switch window manager");
  62. caca_printf(screen_list->cv, x, y++, "c: Create new window");
  63. caca_printf(screen_list->cv, x, y++, "m: Thumbnails");
  64. caca_printf(screen_list->cv, x, y++, "d: Detach");
  65. caca_printf(screen_list->cv, x, y++, "k: Close window and kill associated process");
  66. caca_printf(screen_list->cv, x, y++, "h: Dump screen into a file");
  67. caca_printf(screen_list->cv, x, y++, "?: This help");
  68. caca_printf(screen_list->cv, x, y++, "");
  69. caca_printf(screen_list->cv, x, y++, "");
  70. caca_printf(screen_list->cv, x, y, "See http://caca.zoy.org/wiki/neercs for more informations");
  71. }
  72. #endif