Initial commit of pristine erwise source
[erwise] / erwise / TopLevel.c
1 static char *rcsid = "$Id: TopLevel.c,v 1.1 1992/05/18 21:43:03 tvr Exp $";
2
3 #include "Includes.h"
4
5
6 void TopQuitCB(topaddress, htext, htextobject, parameter)
7 char *topaddress;
8 HText_t *htext;
9 HTextObject_t *htextobject;
10 void *parameter;
11 {
12     UiDisplayWarningDialog("Quit Erwise?", NukeErwiseCB);
13 }
14
15
16 void NukeErwiseCB(button)
17 int button;
18 {
19     FILE *fp;
20
21     if (fp = OpenErwiserc("w")) {
22         ConfigSave(fp);
23         fclose(fp);
24     } else
25         fprintf(stderr, "Warning: could not save settings to .erwiserc\n");
26
27     exit(0);
28 }
29
30
31 void TopInfoCB(topaddress, htext, htextobject, parameter)
32 char *topaddress;
33 HText_t *htext;
34 HTextObject_t *htextobject;
35 void *parameter;
36 {
37     UiDisplayInfo();
38 }
39
40
41 void TopOpenCB(topaddress, htext, htextobject, parameter)
42 char *topaddress;
43 HText_t *htext;
44 HTextObject_t *htextobject;
45 void *parameter;
46 {
47     UiDisplaySelectionBox(GetPageCB);
48 }
49
50
51 void GetPageCB(address)
52 char *address;
53 {
54     if (FindPage(Pages, address)) {
55         DisplayWarning("Already loaded");
56         return;
57     }
58     AddPage(&Pages, address, (HText_t *) NULL, (Page_t *) NULL);
59
60     StartLoading(address, address, (char *) NULL);
61 }