source: neercs/trunk/src/help.c @ 4080

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