-
Notifications
You must be signed in to change notification settings - Fork 69
/
gui.c
95 lines (69 loc) · 2.62 KB
/
gui.c
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
93
94
95
#include "gui.h"
#include <string.h>
WINDOW *create_help_win(int height, int width, int starty, int startx);
void destroy_help_win(WINDOW *local_win);
WINDOW *create_help_win(int height, int width, int starty, int startx)
{
WINDOW *local_win;
char buffer [80];
local_win = newwin(height, width, starty, startx);
box(local_win, 0 , 0); /* 0, 0 gives default characters
* for the vertical and horizontal
* lines */
wbkgd( local_win, COLOR_PAIR(1));
color_set(1, NULL );
sprintf( buffer, " Command set for the LoRa Gateway ");
mvaddstr( 1, ( 80 - strlen( buffer ) ) / 2, buffer );
sprintf( buffer, "Channel 0 commands are lower case (a-z)");
mvaddstr( 3, ( 80 - strlen( buffer ) ) / 2, buffer );
sprintf( buffer, "Channel 1 commands are upper case (A-Z)");
mvaddstr( 4, ( 80 - strlen( buffer ) ) / 2, buffer );
sprintf( buffer, "a/A = +100kHz z/Z= -100kHz");
mvaddstr( 6, ( 80 - strlen( buffer ) ) / 2, buffer );
sprintf( buffer, "s/S = +10kHz x/X= -10kHz ");
mvaddstr( 7, ( 80 - strlen( buffer ) ) / 2, buffer );
sprintf( buffer, "d/D = +1kHz c/C= -1kHz ");
mvaddstr( 8, ( 80 - strlen( buffer ) ) / 2, buffer );
sprintf( buffer, "F = Toggle AFC ");
mvaddstr( 10, ( 80 - strlen( buffer ) ) / 2, buffer );
sprintf( buffer, "M = Toggle Modes (This is not implemented yet!!!) ");
mvaddstr( 12, ( 80 - strlen( buffer ) ) / 2, buffer );
wrefresh(local_win); /* Show that box */
return local_win;
}
void destroy_help_win(WINDOW *local_win)
{
int i = 0;
char buffer [80];
// Remove the border
wborder(local_win, ' ', ' ', ' ',' ',' ',' ',' ',' ');
color_set(2, NULL );
for (i=1;i<15;i++)
mvaddstr(i, 39, " ");
// Put the HELP message back
sprintf( buffer, " Press (H) for Help ");
color_set(2, NULL );
mvaddstr( 15, ( 80 - strlen( buffer ) ) / 2, buffer );
wrefresh(local_win);
delwin(local_win);
}
void gui_show_help ()
{
char ch;
char buffer [80];
int startx, starty, width, height;
WINDOW *help_win;
height = 14;
width = 76;
starty = 1; /* Calculating for a center placement */
startx = 2; /* of the window */
help_win = create_help_win(height, width, starty, startx);
sprintf( buffer, "Press any key to return to the main screen!");
color_set(2, NULL );
mvaddstr( 15, ( 80 - strlen( buffer ) ) / 2, buffer );
// Wait for any key to be pressed
while ((ch=getch()) == 255)
{
};
destroy_help_win(help_win);
}