File: cphlpfs.c

package info (click to toggle)
ocp 1%3A0.1.21-5
  • links: PTS
  • area: main
  • in suites: buster
  • size: 5,528 kB
  • sloc: ansic: 91,461; cpp: 9,729; sh: 3,119; makefile: 2,493
file content (92 lines) | stat: -rw-r--r-- 2,072 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* OpenCP Module Player
 * copyright (c) '94-'10 Niklas Beisert <nbeisert@physik.tu-muenchen.de>
 *
 * CP hypertext help viewer (Fileselector wrapper)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * revision history: (please note changes here)
 *  -fg980924  Fabian Giesen <gfabian@jdcs.su.nw.schule.de>
 *    -first release
 */

#include "config.h"
#include "types.h"
#include "stuff/poutput.h"
#include "help/cphelper.h"
#include "stuff/framelock.h"
#include "cphlpfs.h"

#include <curses.h>

int fsmode;

/* ripped from fileselector */


/* the wrapper */

static int plHelpKey(unsigned short key)
{
	switch(key)
	{
		case 'h': case 'H': case '?': case '!': case KEY_F(1): case KEY_ESC:
			fsmode=0;
			break;
		default:
			return brHelpKey(key);
	}
	return 1;
}

unsigned char fsHelp2(void)
{
	unsigned short sbuf[CONSOLE_MAX_X];
	helppage *cont;

	plSetTextMode(0);

	fillstr(sbuf, 0, 0x30, 0, CONSOLE_MAX_X);
	writestring(sbuf, 2, 0x30, "opencp help", 11);
	writestring(sbuf, plScrWidth-29, 0x30, "(c) 1994-2011 Stian Skjelstad", 27);
	displaystrattr(0, 0, sbuf, plScrWidth);

	cont=brDecodeRef("Contents");

	if (!cont)
		displaystr(1, 0, 0x04, "shit!", 5);

	brSetPage(cont);

	brSetWinStart(2);
	brSetWinHeight(plScrHeight-2);

	fsmode=1;

	while (fsmode)
	{
		unsigned short key;
		brDisplayHelp();

		while (!ekbhit())
			framelock();
		key=egetch();

		plHelpKey(key);
		framelock();
	};

	return 1;
}