⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmdview.c

📁 一个很好的分子动力学程序
💻 C
📖 第 1 页 / 共 5 页
字号:
	*filterB = XtVaCreateManagedWidget("Filter", menuButtonWidgetClass,												  parent, NULL);		*menu = XtCreatePopupShell("menu", simpleMenuWidgetClass,										*filterB, NULL, 0);		*filtnghB = XtVaCreateManagedWidget("Filtngh", smeBSBObjectClass,													*menu, NULL);	*filtnghS = XtVaCreatePopupShell("filtnghShell", transientShellWidgetClass,											 top, NULL);	/* Add the callbacks */	XtAddCallback(*filtnghB, XtNcallback, filtnghButtonFunction, top);	XtAddCallback(*filtnghB, XtNcallback, XtCallbackExclusive, *filtnghS);		return;}	void MakeHelpMenu(Widget parent,					   Widget top,						Widget *helpB,							Widget *menu,						Widget *topicB,						Widget *topicS,						Widget *topicF,						Widget *topicL,						Widget *topicOKB,						Widget *aboutB,						Widget *aboutS,						Widget *aboutD,						Widget *aboutOKB){	String topics="Topics Available:\n\n"					  "QUICK KEYS:\n\n"					  "   NOTE:  Num Lock, Caps Lock, and Scroll Lock\n"					  "          must all be off for the following\n"					  "          keystrokes to work.\n\n"					  "   Up Arrow: First Step\n"					  "   Left Arrow: Previous Step\n"					  "   Right Arrow: Next Step\n"					  "   Down Arrow: Last Step\n"					  "   Home: Reset\n"					  "   Shift + Left Arrow: Rotate Left\n"					  "   Shift + Right Arrow: Rotate Right\n"					  "   Shift + Up Arrow: Rotate Up\n"					  "   Shift + Down Arrow: Rotate Down\n"					  "   Keypad Left Arrow (4): Move Left\n"					  "   Keypad Right Arrow (6): Move Right\n"					  "   Keypad Up Arrow (8): Move Up\n"					  "   Keypad Down Arrow (2): Move Down\n"					  "   Keypad Plus: Zoom In\n"					  "   Keypad Minus: Zoom Out\n"					  "   Keypad Multiply: Enlarge Atoms\n"					  "   Keypad Divide: Shrink Atoms\n"					  "   Plus: Increase Stereo Angle\n"					  "   Minus: Decrease Stereo Angle\n"					  "   Keypad 5: Toggle between Points/Circles\n\n"					  "OTHER TOPICS:\n\n"					  "   Please refer to the documentation at\n"					  "   http://flax.ims.uconn.edu/software.htm\n"					  "   for further information.\n";	*helpB = XtVaCreateManagedWidget("Help", menuButtonWidgetClass,												parent, NULL);		*menu = XtCreatePopupShell("menu", simpleMenuWidgetClass,                              *helpB, NULL, 0);		*topicB = XtVaCreateManagedWidget("Topics", smeBSBObjectClass,												 *menu, NULL);		*aboutB = XtVaCreateManagedWidget("About", smeBSBObjectClass,												 *menu, NULL);	/* Create popup shells and dialogs */	*topicS = XtVaCreatePopupShell("topicShell", transientShellWidgetClass,									       top, NULL);	*topicF = XtVaCreateManagedWidget("topicForm", boxWidgetClass,												 *topicS, NULL);	*topicL = XtVaCreateManagedWidget("topicLabel", labelWidgetClass,												 *topicF, NULL);	*topicOKB = XtVaCreateManagedWidget("OK", commandWidgetClass,													*topicF, NULL);	*aboutS = XtVaCreatePopupShell("aboutShell", transientShellWidgetClass,											 top, NULL);	*aboutD = XtVaCreateManagedWidget("aboutDialog", dialogWidgetClass,												 *aboutS, NULL);	*aboutOKB = XtVaCreateManagedWidget("OK", commandWidgetClass,													*aboutD, NULL);		XtVaSetValues(*topicL, XtNlabel, topics, NULL);	XtVaSetValues(*aboutD, XtNlabel, 					  "XMDView - Version 2.0\nBy: Jon Rifkin & David Clark",					  NULL);	/* Arrange for aboutButton to pop up the aboutBox */	XtAddCallback(*topicB, XtNcallback, ShowTopicsFunction, top);	XtAddCallback(*topicB, XtNcallback, XtCallbackExclusive, *topicS);	XtAddCallback(*topicOKB, XtNcallback, OKTopicFunction, NULL);	XtAddCallback(*aboutB, XtNcallback, ShowAboutFunction, top);	XtAddCallback(*aboutB, XtNcallback, XtCallbackExclusive, *aboutS);	XtAddCallback(*aboutOKB, XtNcallback, OKAboutFunction, NULL);	return;}void MakeToolBar(Widget parent,			 		  Widget *firstToolB,					  Widget *backToolB,			        Widget *nextToolB,			        Widget *lastToolB,			        Widget *resetToolB,			        Widget *rtLeftToolB,			        Widget *rtRightToolB,			        Widget *rtUpToolB,			        Widget *rtDownToolB,			        Widget *mvLeftToolB,			        Widget *mvRightToolB,			        Widget *mvUpToolB,			        Widget *mvDownToolB,			        Widget *zmInToolB,			        Widget *zmOutToolB,			        Widget *atPlusToolB,			        Widget *atMinusToolB,					  Widget *stAnglePlusToolB,					  Widget *stAngleMinusToolB,					  Widget *atTypeToolB){	char KeyStrokes[255];	/* First, create all the toolbar buttons */	*firstToolB = XtVaCreateManagedWidget("|<<", commandWidgetClass,												parent, NULL);	*backToolB = XtVaCreateManagedWidget("< ", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*nextToolB = XtVaCreateManagedWidget(" >", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*lastToolB = XtVaCreateManagedWidget(">>|", commandWidgetClass,												parent, NULL);	*resetToolB = XtVaCreateManagedWidget("RES", commandWidgetClass,												parent, NULL);	*rtLeftToolB = XtVaCreateManagedWidget("Rt<", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*rtRightToolB = XtVaCreateManagedWidget("Rt>", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*rtUpToolB = XtVaCreateManagedWidget("Rt+", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*rtDownToolB = XtVaCreateManagedWidget("Rt-", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*mvLeftToolB = XtVaCreateManagedWidget("Mv<", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*mvRightToolB = XtVaCreateManagedWidget("Mv>", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*mvUpToolB = XtVaCreateManagedWidget("Mv+", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*mvDownToolB = XtVaCreateManagedWidget("Mv-", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*zmInToolB = XtVaCreateManagedWidget("Zm+", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*zmOutToolB = XtVaCreateManagedWidget("Zm-", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*atPlusToolB = XtVaCreateManagedWidget("At+", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*atMinusToolB = XtVaCreateManagedWidget("At-", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*stAnglePlusToolB = XtVaCreateManagedWidget("St+", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*stAngleMinusToolB = XtVaCreateManagedWidget("St-", repeaterWidgetClass,												parent, XtNdecay, 0, NULL);	*atTypeToolB = XtVaCreateManagedWidget("Circles", commandWidgetClass,												parent, NULL);	/* Now, add the callback function to make each button work */	XtAddCallback(*firstToolB, XtNcallback, FirstStepButtonFunction, 0);	XtAddCallback(*backToolB, XtNcallback, BackStepButtonFunction, 0);	XtAddCallback(*nextToolB, XtNcallback, NextStepButtonFunction, 0);	XtAddCallback(*lastToolB, XtNcallback, LastStepButtonFunction, 0);	XtAddCallback(*resetToolB, XtNcallback, ResetButtonFunction, 0);	XtAddCallback(*rtLeftToolB, XtNcallback, RLtButtonFunction, 0);	XtAddCallback(*rtRightToolB, XtNcallback, RRtButtonFunction, 0);	XtAddCallback(*rtUpToolB, XtNcallback, RUpButtonFunction, 0);	XtAddCallback(*rtDownToolB, XtNcallback, RDnButtonFunction, 0);	XtAddCallback(*mvLeftToolB, XtNcallback, MvLtButtonFunction, 0);	XtAddCallback(*mvRightToolB, XtNcallback, MvRtButtonFunction, 0);	XtAddCallback(*mvUpToolB, XtNcallback, MvUpButtonFunction, 0);	XtAddCallback(*mvDownToolB, XtNcallback, MvDnButtonFunction, 0);	XtAddCallback(*zmInToolB, XtNcallback, ZInButtonFunction, 0);	XtAddCallback(*zmOutToolB, XtNcallback, ZOutButtonFunction, 0);	XtAddCallback(*atPlusToolB, XtNcallback, AtPlusButtonFunction, 0);	XtAddCallback(*atMinusToolB, XtNcallback, AtMinusButtonFunction, 0);	XtAddCallback(*stAnglePlusToolB, XtNcallback, StAnglePlusButtonFunction, 0);	XtAddCallback(*stAngleMinusToolB, XtNcallback, StAngleMinusButtonFunction, 0);	XtAddCallback(*atTypeToolB, XtNcallback, AtTypeButtonFunction, 0);	/* Now, add the keyboard accelerators */	strcpy(KeyStrokes, "None<Key>Up: set() notify() reset()");	XtVaSetValues(*firstToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "None<Key>Left: set() notify() reset()");	XtVaSetValues(*backToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "None<Key>Right: set() notify() reset()");	XtVaSetValues(*nextToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "None<Key>Down: set() notify() reset()");	XtVaSetValues(*lastToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "<Key>Home: set() notify() reset()");	XtVaSetValues(*resetToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "Shift<Key>Left: set() notify() reset()");	XtVaSetValues(*rtLeftToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "Shift<Key>Right: set() notify() reset()");	XtVaSetValues(*rtRightToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "Shift<Key>Up: set() notify() reset()");	XtVaSetValues(*rtUpToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "Shift<Key>Down: set() notify() reset()");	XtVaSetValues(*rtDownToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "<Key>KP_4: set() notify() reset()");	XtVaSetValues(*mvLeftToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "<Key>KP_6: set() notify() reset()");	XtVaSetValues(*mvRightToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "<Key>KP_8: set() notify() reset()");	XtVaSetValues(*mvUpToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "<Key>KP_2: set() notify() reset()");	XtVaSetValues(*mvDownToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "<Key>KP_Add: set() notify() reset()");	XtVaSetValues(*zmInToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "<Key>KP_Subtract: set() notify() reset()");	XtVaSetValues(*zmOutToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "<Key>KP_Multiply: set() notify() reset()");	XtVaSetValues(*atPlusToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "<Key>KP_Divide: set() notify() reset()");	XtVaSetValues(*atMinusToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "<Key>+: set() notify() reset()");	XtVaSetValues(*stAnglePlusToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "<Key>-: set() notify() reset()");	XtVaSetValues(*stAngleMinusToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	strcpy(KeyStrokes, "<Key>KP_5: set() notify() reset()");	XtVaSetValues(*atTypeToolB, XtNaccelerators, XtParseAcceleratorTable(KeyStrokes), NULL);	return;}/* * File Menu Button functions */void OpenFileButtonFunction(Widget w, 							 XtPointer client_data,							 XtPointer call_data){	Widget topLevel = (Widget) client_data;	Position x, y;	Dimension width, height;	/* Get the coordinates of the middle of topLevel widget *//*	XtVaGetValues(topLevel, XtNwidth, &width, XtNheight, &height, NULL);*/	/* Translate those coordinates into coordinates from root window origin */	XtTranslateCoords(topLevel, (Position) 0, (Position) 0, &x, &y);		/* Move popup shell to this position (still not visible) */	XtVaSetValues(fileShell_m, XtNx, x, XtNy, y, NULL);		return;}void OKFileFunction(Widget w,								 XtPointer client_data,								 XtPointer call_data){	Widget dialog = (Widget) client_data;	String filename;	XtPopdown(fileShell_m);	XtSetSensitive(openButton_m, TRUE);	/* Get file name */	filename = XawDialogGetValueString(dialog);	RestartProgram(filename);	return;}void CancelFileFunction(Widget w,								XtPointer client_data,								XtPointer call_data){	XtPopdown(fileShell_m);	XtSetSensitive(openButton_m, True);	return;}void PrintButtonFunction(Widget w, 							 XtPointer client_data,							 XtPointer call_data){	Widget topLevel = (Widget) client_data;	Position x, y;	Dimension width, height;	/* Get the coordinates of the middle of topLevel widget *//*	XtVaGetValues(topLevel, XtNwidth, &width, XtNheight, &height, NULL);*/	/* Translate those coordinates into coordinates from root window origin */	XtTranslateCoords(topLevel, (Position) 0, (Position) 0, &x, &y);		/* Move popup shell to this position (still not visible) */	XtVaSetValues(printShell_m, XtNx, x, XtNy, y, NULL);		return;}void OKPrintFunction(Widget w,								 XtPointer client_data,								 XtPointer call_data){	Widget dialog = (Widget) client_data;	char filename[255];	XtPopdown(printShell_m);	XtSetSensitive(printButton_m, TRUE);	/* Get file name */	strcpy(filename, XawDialogGetValueString(dialog));	PrintAtoms(filename);	return;}void CancelPrintFunction(Widget w,								XtPointer client_data,								XtPointer call_data){	XtPopdown(printShell_m);	XtSetSensitive(printButton_m, True);	return;}void QuitFunction(Widget w, 						XtPointer client_data, 						XtPointer call_data) {	CleanBeforeExit();	exit(0);}/* * Options Menu Button functions */void ResetIncrementsFunction(Widget w, 									  XtPointer client_data,									  XtPointer call_data){	RotationIncrement_m = 5.0*DEG_TO_RAD;	MoveIncrement_m = 1e-8;	ZoomIncrement_m = 0.1;	AtomIncrement_m = 0.1e-8;	return;}void SetRefOrientButtonFunction(Widget w, 							 XtPointer client_data,							 XtPointer call_data){	Widget topLevel = (Widget) client_data;	Position x, y;	Dimension width, height;	/* Decide where to put Rotation shell */	/* Translate those coordinates into coordinates from root window origin */	XtTranslateCoords(topLevel, (Position) 0, (Position) 0, &x, &y);		/* Move popup shell to this position (still not visible) */	XtVaSetValues(refOrientShell_m, XtNx, x, XtNy, y, NULL);		return;}void OKRefOrientFunction(Widget w,								XtPointer client_data,								XtPointer call_data){	Widget dialog = (Widget) client_data;	String input;	char *Str;	int i, j;		XtPopdown(refOrientShell_m);	XtSetSensitive(refOrientButton_m, True);	input = XawDialogGetValueString(dialog);	Str = input;	for (i=0; i<3; ++i)		for (j=0; j<3; ++j)			RefOrient_m[i][j] = strtod(Str, &Str);	GetSurfaceOrient(Orient_m, Rotation_m, RefOrient_m);	REFRESH	return;}void CancelRefOrientFunction(Widget w,								XtPointer client_data,								XtPointer call_data){	XtPopdown(refOrientShell_m);	XtSetSensitive(refOrientButton_m, True);	return;}void SetRotationButtonFunction(Widget w, 							 XtPointer client_data,							 XtPointer call_data){	Widget topLevel = (Widget) client_data;	Position x, y;	Dimension width, height;	/* Decide where to put Rotation shell */	/* Translate those coordinates into coordinates from root window origin */	XtTranslateCoords(topLevel, (Position) 0, (Position) 0, &x, &y);		/* Move popup shell to this position (still not visible) */	XtVaSetValues(rotationShell_m, XtNx, x, XtNy, y, NULL);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -