File: gutil2.c

package info (click to toggle)
acm 5.0-19
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,852 kB
  • ctags: 4,792
  • sloc: ansic: 42,427; makefile: 706; cpp: 293; perl: 280; sh: 198
file content (81 lines) | stat: -rw-r--r-- 2,043 bytes parent folder | download | duplicates (9)
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
/*
 *  Copyright (c) 1994, Riley Rainey,  riley@netcon.com
 *
 *  Permission to use, copy, modify and distribute (without charge) this
 *  software, documentation, images, etc. is granted, provided that this 
 *  comment and the author's name is retained.
 *
 *  This software is provided by the author as is, and without any expressed
 *  or implied warranties, including, but not limited to, the implied
 *  warranties of merchantability and fitness for a particular purpose.  In no
 *  event shall the author be liable for any direct, indirect, incidental, or
 *  consequential damages arising in any way out of the use of this software.
 */

#include <Xm/PushB.h>
#include <Xm/RowColumn.h>
#include <Xm/CascadeB.h>

#include "gedit.h"
#include <stdio.h>
#include <X11/Xos.h>

char *markers[] = {
	"Pilot's Head Location",
	"Nose/Tail Gear Ground Contact Point",
	"Main Gear Ground Contact Point",
	"Tail Ground Contact Point",
	NULL
	};

extern void MenuCB();

void
CreateMarkerList(parent)
Widget	parent;
{

	register char	**p;
	register int	count = 0, i, n;
	XmString	string;
	Widget		item, menu, cascade;
	Arg		args[4];
	char		s[32];

	for (p=markers; *p; ++p) {
		++count;
	}

	marker_count = count;

	n = 0;
	menu = XmCreatePulldownMenu (parent, "marker_menu", args, n);

	marker_list = (marker_t *) XtMalloc (count * sizeof(marker_t));

	for (i=0; i<count; ++i) {
		marker_list[i].defined = False;
		marker_list[i].id = i;
		strncpy (marker_list[i].name, markers[i],
			sizeof(marker_list[i].name));
		string = XmStringCreateSimple(markers[i]);
		sprintf (s, "marker_%d", i);
		item = XtVaCreateWidget (s, xmPushButtonWidgetClass,
			menu,
			XmNlabelString,	string,
			NULL);
		XtManageChild (item);
		XtAddCallback (item, XmNactivateCallback, MenuCB,
			(XtPointer) (MENU_MARKER + i));
		XmStringFree (string);
	}

	XtManageChild (menu);

	n = 0;
	XtSetArg (args[n], XmNsubMenuId, menu);  n++;
	XtSetArg (args[n], XmNmnemonic, 'M');  n++;
	cascade = XmCreateCascadeButton (parent, "Markers", args, n);
	XtManageChild (cascade);

}