-
Notifications
You must be signed in to change notification settings - Fork 0
/
FSEDIT.C
executable file
·81 lines (65 loc) · 1.78 KB
/
FSEDIT.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
#include "gcomm.h"
#include "majorbbs.h"
#include "globals.h"
#include "submod.h"
#include "mbbsemu.h"
static void copyToPrfptr(const char *str) {
strcpy(prfptr, str);
prfptr += strlen(str);
}
static int onDoneEditing(int quitex) {
UserData *userData = getUserData();
// full screen editing wipes our state, restore it
usrptr->state = moduleState;
usrptr->substt = 1;
setmbk(mcv);
if (quitex == 0) {
prfmsg(OUTPUT);
copyToPrfptr(userData->fullScreenEditorData.topic);
*(prfptr++) = '\r';
*prfptr = 0;
outprf(usrnum);
prfmsg(OUTPUT);
copyToPrfptr(userData->fullScreenEditorData.text);
*(prfptr++) = '\r';
*prfptr = 0;
outprf(usrnum);
}
return 1;
}
static int fullScreenEditorEntryHandler() {
UserData *userData = getUserData();
do {
usrptr->substt = 0;
bgncnc();
switch (usrptr->substt) {
case 0:
cncchr();
// print message here?
strcpy(
userData->fullScreenEditorData.text,
"Starter text - edit this\r");
userData->fullScreenEditorData.topic[0] = 0;
bgnedt(
FSED_TEXT_LENGTH,
userData->fullScreenEditorData.text,
FSED_TOPIC_LENGTH,
userData->fullScreenEditorData.topic,
onDoneEditing,
ED_CLRTOP);
break;
}
} while (!endcnc());
setmbk(mcv);
return popSubModule();
}
static int fullScreenEditorInputHandler() {
return 1;
}
void initFullScreenEditorSubModule() {
SubModule subModule;
memset(&subModule, 0, sizeof(subModule));
subModule.onEnter = fullScreenEditorEntryHandler;
subModule.onInput = fullScreenEditorInputHandler;
registerSubModule(SUBMODULE_FULL_SCREEN_EDIT, &subModule);
};