-
Notifications
You must be signed in to change notification settings - Fork 2
/
guidance.c
112 lines (100 loc) · 3.36 KB
/
guidance.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 Deutches Elektronen-Synchrotron in der Helmholtz-
* Gemelnschaft (DESY).
* Copyright (c) 2002 Berliner Speicherring-Gesellschaft fuer Synchrotron-
* Strahlung mbH (BESSY).
* Copyright (c) 2002 Southeastern Universities Research Association, as
* Operator of Thomas Jefferson National Accelerator Facility.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* This file is distributed subject to a Software License Agreement found
* in the file LICENSE that is included with this distribution.
\*************************************************************************/
/* guidance.c */
/************************DESCRIPTION***********************************
This file contains routines for displaying guidance text
**********************************************************************/
#include <stdlib.h>
#include <Xm/Xm.h>
#include "alLib.h"
#include "ax.h"
/************************************************************************
Guidance display callback
***********************************************************************/
void guidanceCallback(Widget w,GCLINK *gclink,XmAnyCallbackStruct *cbs)
{
SNODE *pt;
struct guideLink *guidelist;
char *guidance_str[200];
int i=0;
if (guidanceExists(gclink)) {
if (gclink->guidanceLocation ) {
callBrowser(gclink->guidanceLocation);
} else {
pt = sllFirst(&(gclink->GuideList));
i=0;
while (pt) {
guidelist = (struct guideLink *)pt;
guidance_str[i] = guidelist->list;
pt = sllNext(pt);
i++;
}
guidance_str[i] = "";
guidance_str[i+1] = "";
xs_help_callback(w,guidance_str,cbs);
}
}
else {
if (gclink->pgcData->alias){
createDialog(w,XmDIALOG_WARNING,"No guidance for ",
gclink->pgcData->alias);
} else {
createDialog(w,XmDIALOG_WARNING,"No guidance for ",
gclink->pgcData->name);
}
}
}
/************************************************************************
Guidance exists test
***********************************************************************/
int guidanceExists(GCLINK *link)
{
if (sllFirst(&(link->GuideList)) || link->guidanceLocation) return(TRUE);
else return(FALSE);
}
/************************************************************************
Delete guidance
***********************************************************************/
void guidanceDeleteGuideList(SLIST *pGuideList)
{
SNODE *node,*next;
struct guideLink *guidelist;
node = sllFirst(pGuideList);
while (node) {
next = sllNext(node);
guidelist = (struct guideLink *)node;
free(guidelist->list);
free(guidelist);
node = next;
}
}
/************************************************************************
Copy guidance
***********************************************************************/
void guidanceCopyGuideList(SLIST *pToGuideList,SLIST *pFromGuideList)
{
char *buff;
struct guideLink *guideLink;
SNODE *node;
node = sllFirst(pFromGuideList);
while (node) {
buff = ((struct guideLink *)node)->list;
guideLink = (struct guideLink *)calloc(1,sizeof(struct guideLink));
guideLink->list = (char *)calloc(1,strlen(buff)+1);
strcpy(guideLink->list,buff);
sllAdd(pToGuideList,(SNODE *)guideLink);
node = sllNext(node);
}
}