-
Notifications
You must be signed in to change notification settings - Fork 1
/
SDDM.c
77 lines (75 loc) · 1.75 KB
/
SDDM.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
#include "headfile.h"
int SDDM ()
{
uint refresh = 2,key;
int index = 0,i;
char ch;
double value[3] = {0.0,0.0,0.0};
const char * context[] = {"Oh=:","Od=:","Or=:"};
value[0]=setup.dmoh;
value[1]=setup.dmod;
value[2]=setup.dmor;
while(1){
if (refresh == REFRESH_ALL){
refresh = REFRESH_PART;
Bdisp_AllClr_VRAM();
DrawPicture (36, 0,60,13,PIC_SD_SET);
for (i=0;i<3;++i){
PrintXY(14,18+i*13,(uchar*)context[i],0);
}
PrintIcon (0,"Rou",1);
PrintIcon (1,"Set",1);
PrintIcon (2,"OK",0);
PrintIcon (3,"Disp",1);
PrintIcon (4,"save",1);
PrintIcon (5,"?",0);
}
if (refresh == REFRESH_PART){
for (i=0;i<3;++i){
PrintFloat(value[i],38,16+i*13,index==i,3);
}
refresh = 0;
}
GetKey(&key);
switch(key){
case KEY_CTRL_F3:
setup.dmoh=value[0];
setup.dmod=value[1];
setup.dmor=value[2];
return 0;
case KEY_CTRL_F4 :
case KEY_CTRL_F5 :
Nodata(); refresh=REFRESH_ALL; break;
case KEY_CTRL_F6 :
About(); refresh=REFRESH_ALL; break;
case KEY_CTRL_UP:
refresh=REFRESH_PART; --index; break;
case KEY_CTRL_DOWN:
refresh=REFRESH_PART; ++index; break;
case KEY_CTRL_EXE:
refresh = REFRESH_PART; index++; break;
case KEY_CTRL_EXIT:
setup.dmoh=value[0];
setup.dmod=value[1];
setup.dmor=value[2];
return 0;
default:
if ((ch=GetPressNumChar(key))!=0){
char buf[14];
int r;
refresh = REFRESH_PART;
buf[0] = ch; buf[1] = '\0';
r = InputString (38,16+index*13,buf,0,12);
if (r != KEY_CTRL_EXIT){
value[index] = atof(buf);
if (r==KEY_CTRL_DOWN) ++index;
if (r==KEY_CTRL_UP) --index;
if (r==KEY_CTRL_EXE ) ++index;
}
break;
}
}
if (index >=3) index = 0;
if (index < 0) index = 2;
}
}