source: trunk/tools/neercs/old/help.c @ 1656

Last change on this file since 1656 was 1656, checked in by sam, 7 years ago

neercs: start porting the old code to Windows; this breaks the Visual Studio
build until further fixes are made.

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