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

📄 xmdview.c

📁 一个很好的分子动力学程序
💻 C
📖 第 1 页 / 共 5 页
字号:
				ColorFileName_m = strdup (argv[2]);				iopt=3;				}			else 				PrintUsage();			}		else if ('-'==argv[1][0]) 			PrintUsage();		}	/* Set initial size of window */	XtVaSetValues(topLevel, XtNheight, 500, NULL);	/*	 * Make other widgets.	 */	frameWindow = XtVaCreateManagedWidget("frameWindow", boxWidgetClass, topLevel, NULL);	XtAddEventHandler(frameWindow, ExposureMask, False, (XtEventHandler)RefreshScreen, NULL);	XtAddEventHandler(frameWindow, ButtonPress, True, (XtEventHandler)ShowAtomsPosFunction, NULL);	menuBar = XtVaCreateManagedWidget("menuBar", boxWidgetClass, frameWindow, XtNx, 0, XtNy, 0, NULL);	XtVaSetValues(menuBar, XtNorientation, XtorientHorizontal, XtNborderWidth, 0, NULL);		/*	 * Create the various menus and buttons. 	 */	MakeFileMenu(menuBar, topLevel, &fileButton, &fileMenu,					&openButton_m, &fileShell_m, &fileSelDialog,					&fileOKButton, &fileCancelButton,					&printButton_m, &printShell_m,					&printDialog, &printOKButton, &printCancelButton,               &quitButton);	MakeOptionsMenu(menuBar, topLevel, &optionsButton, &optionsMenu,					&resetButton, 					&setRotationButton_m, &rotationShell_m,					&rotationDialog, &rotationOKButton, &rotationCancelButton,					&setMoveButton_m, &moveShell_m,					&moveDialog, &moveOKButton, &moveCancelButton,					&setZoomButton_m, &zoomShell_m,				   &zoomDialog, &zoomOKButton, &zoomCancelButton,					&setAtomButton_m, &atomShell_m,					&atomDialog, &atomOKButton, &atomCancelButton,					&refOrientButton_m, &refOrientShell_m,					&refOrientDialog, &refOrientOKButton, &refOrientCancelButton,					&setAtomCenSizeButton_m, &atomCenSizeShell_m,					&atomCenSizeDialog, &atomCenSizeOKButton, &atomCenSizeCancelButton,					&setAtomCenPosButton_m, &atomCenPosShell_m,					&atomCenPosDialog, &atomCenPosOKButton, &atomCenPosCancelButton,					&atNumButton_m, &stereoButton_m, &hideAtomsButton_m,               &unHideAtomsButton, &clipAtomsButton_m,				   &gotoButton_m, &gotoShell_m,					&gotoDialog, &gotoOKButton, &gotoCancelButton);	MakeFilterMenu(menuBar, topLevel, &filterButton, &filterMenu, &filtnghButton_m,						&filtnghShell_m, &filtnghDialog);	MakeHelpMenu(menuBar, topLevel, &helpButton, &helpMenu,					&topicButton_m, &topicShell_m, &topicForm, &topicLabel, &topicOKButton,					&aboutButton_m, &aboutShell_m, &aboutDialog, &aboutOKButton);	MakeToolBar(menuBar, &firstToolButton, &backToolButton, 					&nextToolButton, &lastToolButton, &resetToolButton,					&rtLeftToolButton, &rtRightToolButton, &rtUpToolButton,					&rtDownToolButton, &mvLeftToolButton, &mvRightToolButton,					&mvUpToolButton, &mvDownToolButton, &zmInToolButton,					&zmOutToolButton, &atPlusToolButton, &atMinusToolButton,					&stAnglePlusToolButton, &stAngleMinusToolButton,					&atTypeToolButton_m);	/*	 * Add keyboard accelerators to allow keyboard command entry     */	XtInstallAllAccelerators(frameWindow, menuBar);	/*	 * Create windows for widgets and map them, i.e. make everything visible.	 */	XtRealizeWidget(topLevel);	/*    * Set up Display_m, Window_m, Graphics Contexts, and Mark_m (inside SetUpGCs)    */	Display_m = XtDisplay(frameWindow);	Window_m = XtWindow(frameWindow);	SetUpGCs(&frameWindow);	/*  Get data file name  */	if (iopt<argc)		{		strcpy(InputFileName_m, argv[iopt]);		if (OpenFile(InputFileName_m, &InputFile_m) == TRUE)			{			InitializeParticle(&a);			ReadNextStep(InputFile_m, InputFileName_m, a, &Step_m, 								 CenterGeom_m, TypeList_m);			UnHideAtomsButtonFunction(NULL, NULL, NULL);			RefreshScreen(frameWindow, NULL, NULL);			/* Initialize file mark list */			InitList(&FileMarkers_m);			AddNodeToList(&FileMarkers_m, 0, Step_m);			CurLocation_m = FileMarkers_m.Head;			}		}			/*	 * Loop for events.	 */	XtAppMainLoop(app_context);}/* * Menu creation functions */void MakeFileMenu(Widget parent, 						Widget top,						Widget *fileB,						Widget *menu,						Widget *openB,						Widget *fileS,						Widget *fileSelD,					   Widget *fileOKB,						Widget *fileCancelB,						Widget *printB,						Widget *printS,						Widget *printD,						Widget *printOKB,						Widget *printCancelB,						Widget *quitB){	*fileB = XtVaCreateManagedWidget(						"File",          /* Name to appear on widget */						menuButtonWidgetClass, /* Class of widget */						parent,                /* Parent of widget */						NULL);                 /* Terminate varargs list */	*menu = XtCreatePopupShell("menu", simpleMenuWidgetClass,										*fileB, NULL, 0);	/* Create the buttons inside the menu */		*openB = XtVaCreateManagedWidget("Open", smeBSBObjectClass,											 *menu, NULL);	*printB = XtVaCreateManagedWidget("Print", smeBSBObjectClass,												 *menu, NULL);	*quitB = XtVaCreateManagedWidget("Quit", smeBSBObjectClass,											 *menu, NULL);		/* Create the Open File dialog box and buttons */	*fileS = XtVaCreatePopupShell("fileShell", transientShellWidgetClass,											top, NULL);	*fileSelD = XtVaCreateManagedWidget("fileSelectionDialog", dialogWidgetClass,													*fileS, NULL);	*fileOKB = XtVaCreateManagedWidget("OK", commandWidgetClass,								              *fileSelD, NULL);	*fileCancelB = XtVaCreateManagedWidget("Cancel", commandWidgetClass,													   *fileSelD, NULL);	/* Create the Print dialog box and buttons */	*printS = XtVaCreatePopupShell("printShell", transientShellWidgetClass,											 top, NULL);	*printD = XtVaCreateManagedWidget("printDialog", dialogWidgetClass,												 *printS, NULL);	*printOKB = XtVaCreateManagedWidget("OK", commandWidgetClass,													*printD, NULL);	*printCancelB = XtVaCreateManagedWidget("Cancel", commandWidgetClass,													    *printD, NULL);	/* Set label and default text for file dialog */	XtVaSetValues(*fileS, XtNwidth, 500, NULL);	XtVaSetValues(*fileSelD, XtNlabel, "New File", XtNvalue, "file", NULL);	/* Set the label and default text for print dialog */	XtVaSetValues(*printS, XtNwidth, 500, NULL);	XtVaSetValues(*printD, XtNlabel, "Print PostScript File", XtNvalue, "file.ps", NULL);	/* Add the callback functions */	XtAddCallback(*openB, XtNcallback, OpenFileButtonFunction, top);	XtAddCallback(*openB, XtNcallback, XtCallbackExclusive, *fileS);		XtAddCallback(*fileOKB, XtNcallback, OKFileFunction, *fileSelD);	XtAddCallback(*fileCancelB, XtNcallback, CancelFileFunction, NULL);	XtAddCallback(*printB, XtNcallback, PrintButtonFunction, top);	XtAddCallback(*printB, XtNcallback, XtCallbackExclusive, *printS);	XtAddCallback(*printOKB, XtNcallback, OKPrintFunction, *printD);	XtAddCallback(*printCancelB, XtNcallback, CancelPrintFunction, NULL);	XtAddCallback(*quitB,               /* Button which calls the function */						XtNcallback,         /* When to call the function */						QuitFunction,        /* Name of the function to call */						NULL);               /* No data to pass to the function */	return;}void MakeOptionsMenu(Widget parent,						Widget top,					 	Widget *optionsB, 						Widget *menu,						Widget *resetB,						Widget *setRotationB,						Widget *rotationS,						Widget *rotationD,						Widget *rotationOKB,						Widget *rotationCancelB,						Widget *setMoveB,						Widget *moveS,						Widget *moveD,						Widget *moveOKB,						Widget *moveCancelB,						Widget *setZoomB,						Widget *zoomS,						Widget *zoomD,						Widget *zoomOKB,						Widget *zoomCancelB,						Widget *setAtomB,						Widget *atomS,						Widget *atomD,						Widget *atomOKB,						Widget *atomCancelB,						Widget *refOrientB,						Widget *refOrientS,						Widget *refOrientD,						Widget *refOrientOKB,						Widget *refOrientCancelB,						Widget *setAtomCenSizeB,						Widget *atomCenSizeS,						Widget *atomCenSizeD,						Widget *atomCenSizeOKB,						Widget *atomCenSizeCancelB,						Widget *setAtomCenPosB,						Widget *atomCenPosS,						Widget *atomCenPosD,						Widget *atomCenPosOKB,						Widget *atomCenPosCancelB,						Widget *atNumB,						Widget *stereoB,					   Widget *hideAtomsB,						Widget *unHideAtomsB,						Widget *clipAtomsB,						Widget *gotoB,						Widget *gotoS,						Widget *gotoD,						Widget *gotoOKB,						Widget *gotoCancelB){	*optionsB = XtVaCreateManagedWidget("Options", menuButtonWidgetClass,												    parent, NULL);	*menu = XtCreatePopupShell("menu", simpleMenuWidgetClass,                              *optionsB, NULL, 0);	/* Create the buttons inside the menu */	*resetB = XtVaCreateManagedWidget("Reset Increments", smeBSBObjectClass,												 *menu, NULL);	*setRotationB = XtVaCreateManagedWidget("Set Rotation Increment", smeBSBObjectClass,												  *menu, NULL);	*setMoveB = XtVaCreateManagedWidget("Set Move Increment", smeBSBObjectClass,												  *menu, NULL);			*setZoomB = XtVaCreateManagedWidget("Set Zoom Increment", smeBSBObjectClass,												 *menu, NULL);	*setAtomB = XtVaCreateManagedWidget("Set Atom Increment", smeBSBObjectClass,													  *menu, NULL);	*refOrientB = XtVaCreateManagedWidget("Set Reference Orientation", smeBSBObjectClass,													  *menu, NULL);	*setAtomCenSizeB = XtVaCreateManagedWidget("Set Atom Center Size", smeBSBObjectClass,													  *menu, NULL);	*setAtomCenPosB = XtVaCreateManagedWidget("Set Atom Center Position", smeBSBObjectClass,															*menu, NULL);	*atNumB = XtVaCreateManagedWidget("Atom Numbers", smeBSBObjectClass,												  *menu, NULL);	*stereoB = XtVaCreateManagedWidget("Stereo Vision", smeBSBObjectClass,													*menu, NULL);	*hideAtomsB = XtVaCreateManagedWidget("Hide Atoms", smeBSBObjectClass,													  *menu, NULL);		*unHideAtomsB = XtVaCreateManagedWidget("Show All Atoms", smeBSBObjectClass,													  *menu, NULL);		*clipAtomsB = XtVaCreateManagedWidget("Clip Atoms", smeBSBObjectClass,													  *menu, NULL);		*gotoB = XtVaCreateManagedWidget("Goto Step", smeBSBObjectClass,												*menu, NULL);	/* Create the Set Reference Orientation dialog and buttons */	*refOrientS = XtVaCreatePopupShell("refOrientShell", transientShellWidgetClass,													top, NULL);	*refOrientD = XtVaCreateManagedWidget("refOrientDialog", dialogWidgetClass,													  *refOrientS, NULL);	*refOrientOKB = XtVaCreateManagedWidget("OK", commandWidgetClass,													    *refOrientD, NULL);	*refOrientCancelB = XtVaCreateManagedWidget("Cancel", commandWidgetClass,																*refOrientD, NULL);	/* Create the Set Rotation dialog and buttons */	*rotationS = XtVaCreatePopupShell("rotationShell", transientShellWidgetClass,												 top, NULL);	*rotationD = XtVaCreateManagedWidget("rotationDialog", dialogWidgetClass,													 *rotationS, NULL);	*rotationOKB = XtVaCreateManagedWidget("OK", commandWidgetClass,														*rotationD, NULL);	*rotationCancelB = XtVaCreateManagedWidget("Cancel", commandWidgetClass,															 *rotationD, NULL);	/* Create the Set Move dialog and buttons */	*moveS = XtVaCreatePopupShell("moveShell", transientShellWidgetClass,										  top, NULL);	*moveD = XtVaCreateManagedWidget("moveDialog", dialogWidgetClass,												*moveS, NULL);	*moveOKB = XtVaCreateManagedWidget("OK", commandWidgetClass,												  *moveD, NULL);	*moveCancelB = XtVaCreateManagedWidget("Cancel", commandWidgetClass,													   *moveD, NULL);	/* Create the Set Zoom dialog and buttons */	*zoomS = XtVaCreatePopupShell("zoomShell", transientShellWidgetClass,										   top, NULL);	*zoomD = XtVaCreateManagedWidget("zoomDialog", dialogWidgetClass,											   *zoomS, NULL);	*zoomOKB = XtVaCreateManagedWidget("OK", commandWidgetClass,												  *zoomD, NULL);	*zoomCancelB = XtVaCreateManagedWidget("Cancel", commandWidgetClass,														*zoomD, NULL);	/* Create the Set Atom dialog and buttons */	*atomS = XtVaCreatePopupShell("atomShell", transientShellWidgetClass,										   top, NULL);	*atomD = XtVaCreateManagedWidget("atomDialog", dialogWidgetClass,											   *atomS, NULL);	*atomOKB = XtVaCreateManagedWidget("OK", commandWidgetClass,												  *atomD, NULL);	*atomCancelB = XtVaCreateManagedWidget("Cancel", commandWidgetClass,														*atomD, NULL);	/* Create the Set Atom Center Size dialog and buttons */	*atomCenSizeS = XtVaCreatePopupShell("atomCenSizeShell", transientShellWidgetClass,									   top, NULL);	*atomCenSizeD = XtVaCreateManagedWidget("atomCenSizeDialog", dialogWidgetClass,											   *atomCenSizeS, NULL);	*atomCenSizeOKB = XtVaCreateManagedWidget("OK", commandWidgetClass,												  *atomCenSizeD, NULL);	*atomCenSizeCancelB = XtVaCreateManagedWidget("Cancel", commandWidgetClass,														*atomCenSizeD, NULL);	/* Create the Set Atom Center Position dialog and buttons */	*atomCenPosS = XtVaCreatePopupShell("atomCenPosShell", transientShellWidgetClass,									   top, NULL);	*atomCenPosD = XtVaCreateManagedWidget("atomCenPosDialog", dialogWidgetClass,											   *atomCenPosS, NULL);	*atomCenPosOKB = XtVaCreateManagedWidget("OK", commandWidgetClass,												  *atomCenPosD, NULL);	*atomCenPosCancelB = XtVaCreateManagedWidget("Cancel", commandWidgetClass,														*atomCenPosD, NULL);	/* Create the Goto Step dialog and buttons */	*gotoS = XtVaCreatePopupShell("gotoShell", transientShellWidgetClass,										   top, NULL);	*gotoD = XtVaCreateManagedWidget("gotoDialog", dialogWidgetClass,											   *gotoS, NULL);	*gotoOKB = XtVaCreateManagedWidget("OK", commandWidgetClass,												  *gotoD, NULL);	*gotoCancelB = XtVaCreateManagedWidget("Cancel", commandWidgetClass,														*gotoD, NULL);	/* Set labels and default values for dialogs */	XtVaSetValues(*refOrientS, XtNwidth, 500, NULL);	XtVaSetValues(*refOrientD, XtNlabel, "Reference Orientation Axes\n"                                        "x1 y1 z1 x2 y2 z2 x3 y3 z3\n"                                        "(default = 1 0 0 0 1 0 0 0 1)",                  XtNvalue, "1 0 0 0 1 0 0 0 1", NULL);	XtVaSetValues(*rotationD, XtNlabel, "Rotation Increment (degrees)", 					  XtNvalue, "5.0", NULL);	XtVaSetValues(*moveD, XtNlabel, "Move Increment (cm)", XtNvalue, "1e-8", NULL);	XtVaSetValues(*zoomD, XtNlabel, "Zoom Factor Increment", XtNvalue, "0.1", NULL);	XtVaSetValues(*atomD, XtNlabel, "Atom Size Increment", XtNvalue, "0.1e-8", NULL);		XtVaSetValues(*atomCenSizeD, XtNlabel, "Atom Center Size (percentage, 0 to 100)", XtNvalue, "0", NULL);	XtVaSetValues(*atomCenPosD, XtNlabel, "Atom Center Position (percentage, -100 to 100)\n"                                         "xValue yValue (default = 0 0)",                  XtNvalue, "0", NULL); 	XtVaSetValues(*gotoD, XtNlabel, "Goto Step", XtNvalue, "0", NULL);		/* Add the callback functions */	XtAddCallback(*resetB, XtNcallback, ResetIncrementsFunction, NULL);	XtAddCallback(*refOrientB, XtNcallback, SetRefOrientButtonFunction, top);	XtAddCallback(*refOrientB, XtNcallback, XtCallbackExclusive, *refOrientS);	XtAddCallback(*refOrientOKB, XtNcallback, OKRefOrientFunction, *refOrientD);	XtAddCallback(*refOrientCancelB, XtNcallback, CancelRefOrientFunction, *refOrientD);	XtAddCallback(*setRotationB, XtNcallback, SetRotationButtonFunction, top);	XtAddCallback(*setRotationB, XtNcallback, XtCallbackExclusive, *rotationS);	XtAddCallback(*rotationOKB, XtNcallback, OKRotationFunction, *rotationD);	XtAddCallback(*rotationCancelB, XtNcallback, CancelRotationFunction, *rotationD);	XtAddCallback(*setMoveB, XtNcallback, SetMoveButtonFunction, top);	XtAddCallback(*setMoveB, XtNcallback, XtCallbackExclusive, *moveS);	XtAddCallback(*moveOKB, XtNcallback, OKMoveFunction, *moveD);	XtAddCallback(*moveCancelB, XtNcallback, CancelMoveFunction, *moveD);	XtAddCallback(*setZoomB, XtNcallback, SetZoomButtonFunction, top);	XtAddCallback(*setZoomB, XtNcallback, XtCallbackExclusive, *zoomS);		XtAddCallback(*zoomOKB, XtNcallback, OKZoomFunction, *zoomD);	XtAddCallback(*zoomCancelB, XtNcallback, CancelZoomFunction, *zoomD);	XtAddCallback(*setAtomB, XtNcallback, SetAtomButtonFunction, top);	XtAddCallback(*setAtomB, XtNcallback, XtCallbackExclusive, *atomS);		XtAddCallback(*atomOKB, XtNcallback, OKAtomFunction, *atomD);	XtAddCallback(*atomCancelB, XtNcallback, CancelAtomFunction, *atomD);	XtAddCallback(*setAtomCenSizeB, XtNcallback, SetAtomCenSizeButtonFunction, top);	XtAddCallback(*setAtomCenSizeB, XtNcallback, XtCallbackExclusive, *atomCenSizeS);		XtAddCallback(*atomCenSizeOKB, XtNcallback, OKAtomCenSizeFunction, *atomCenSizeD);	XtAddCallback(*atomCenSizeCancelB, XtNcallback, CancelAtomCenSizeFunction, *atomCenSizeD);	XtAddCallback(*setAtomCenPosB, XtNcallback, SetAtomCenPosButtonFunction, top);	XtAddCallback(*setAtomCenPosB, XtNcallback, XtCallbackExclusive, *atomCenPosS);		XtAddCallback(*atomCenPosOKB, XtNcallback, OKAtomCenPosFunction, *atomCenPosD);	XtAddCallback(*atomCenPosCancelB, XtNcallback, CancelAtomCenPosFunction, *atomCenPosD);	XtAddCallback(*atNumB, XtNcallback, AtNumsButtonFunction, NULL);	XtAddCallback(*stereoB, XtNcallback, StereoButtonFunction, NULL);	XtAddCallback(*hideAtomsB, XtNcallback, HideAtomsButtonFunction, NULL);	XtAddCallback(*unHideAtomsB, XtNcallback, UnHideAtomsButtonFunction, NULL);	XtAddCallback(*clipAtomsB, XtNcallback, ClipAtomsButtonFunction, NULL);	XtAddCallback(*gotoB, XtNcallback, GotoStepButtonFunction, top);	XtAddCallback(*gotoB, XtNcallback, XtCallbackExclusive, *gotoS);		XtAddCallback(*gotoOKB, XtNcallback, OKGotoFunction, *gotoD);	XtAddCallback(*gotoCancelB, XtNcallback, CancelGotoFunction, *gotoD);	return;}void MakeFilterMenu(Widget parent,						  Widget top,						  Widget *filterB,						  Widget *menu,						  Widget *filtnghB,						  Widget *filtnghS,						  Widget *filtnghD){

⌨️ 快捷键说明

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