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

Last change on this file since 4413 was 4413, checked in by pterjan, 4 years ago
  • Update copyright in help
File size: 2.9 KB
Line 
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
14#include "config.h"
15
16#include <stdio.h>
17#include <stdlib.h>
18#include <string.h>
19#include <time.h>
20#include <sys/wait.h>
21#include <sys/types.h>
22#include <caca.h>
23
24#include "neercs.h"
25
26int help_handle_key(struct screen_list *screen_list, unsigned int c)
27{
28    if (c == CACA_KEY_ESCAPE || c == '?')
29    {
30        screen_list->modals.help = 0;
31        screen_list->changed = 1;
32        return 1;
33    }
34    else
35    {
36        return 0;
37    }
38}
39
40void draw_help(struct screen_list *screen_list)
41{
42    int w = 65, h = 20;
43    int x = (caca_get_canvas_width(screen_list->cv) - w) / 2;
44    int y = (caca_get_canvas_height(screen_list->cv) - h) / 2;
45
46
47    caca_set_color_ansi(screen_list->cv, CACA_BLUE, CACA_BLUE);
48    caca_fill_box(screen_list->cv, x, y, w, h, '#');
49    caca_set_color_ansi(screen_list->cv, CACA_DEFAULT, CACA_BLUE);
50    caca_draw_cp437_box(screen_list->cv, x, y, w, h);
51
52    x += 2;
53    y++;
54    caca_printf(screen_list->cv,
55                (caca_get_canvas_width(screen_list->cv) -
56                 strlen(PACKAGE_STRING)) / 2, y - 1, PACKAGE_STRING);
57    caca_printf(screen_list->cv, x, y++, "Copyright (c) 2006-2010");
58    caca_printf(screen_list->cv, x, y++, "              Sam Hocevar <sam@zoy.org>");
59    caca_printf(screen_list->cv, x, y++, "              Jean-Yves Lamoureux <jylam@lnxscene.org>");
60    caca_printf(screen_list->cv, x, y++, "              Pascal Terjan <pterjan@linuxfr.org>");
61    caca_printf(screen_list->cv, x, y++, "");
62    caca_printf(screen_list->cv, x, y++, "");
63    caca_printf(screen_list->cv, x, y++, "All shortcuts are in format 'ctrl-a-X' where X is :");
64    caca_printf(screen_list->cv, x, y++, "n:        Next window");
65    caca_printf(screen_list->cv, x, y++, "p:        Previous window");
66    caca_printf(screen_list->cv, x, y++, "w:        Switch window manager");
67    caca_printf(screen_list->cv, x, y++, "c:        Create new window");
68    caca_printf(screen_list->cv, x, y++, "m:        Thumbnails");
69    caca_printf(screen_list->cv, x, y++, "d:        Detach");
70    caca_printf(screen_list->cv, x, y++, "k:        Close window and kill associated process");
71    caca_printf(screen_list->cv, x, y++, "h:        Dump screen into a file");
72    caca_printf(screen_list->cv, x, y++, "?:        This help");
73    caca_printf(screen_list->cv, x, y++, "");
74    caca_printf(screen_list->cv, x, y++, "");
75    caca_printf(screen_list->cv, x, y, "See http://caca.zoy.org/wiki/neercs for more informations");
76}
Note: See TracBrowser for help on using the repository browser.