📄 xmdview.c
字号:
return;}/* * Help Menu Button functions */void ShowTopicsFunction(Widget w, XtPointer client_data, XtPointer call_data){ Widget topLevel = (Widget) client_data; Position x, y; XtTranslateCoords(topLevel, (Position) 0, (Position) 0, &x, &y); XtVaSetValues(topicShell_m, XtNx, x, XtNy, y, NULL); return;}void OKTopicFunction(Widget w, XtPointer client_data, XtPointer call_data){ XtPopdown(topicShell_m); XtSetSensitive(topicButton_m, True); return;}void ShowAboutFunction(Widget w, XtPointer client_data, XtPointer call_data){ Widget topLevel = (Widget) client_data; Position x, y; XtTranslateCoords(topLevel, (Position) 0, (Position) 0, &x, &y); XtVaSetValues(aboutShell_m, XtNx, x, XtNy, y, NULL); return;}void OKAboutFunction(Widget w, XtPointer client_data, XtPointer call_data){ XtPopdown(aboutShell_m); XtSetSensitive(aboutButton_m, True); return;}/* * ToolBar Button functions */void ResetButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ int i; Zoom_m = 1.0; Move_m[X] = 0.0; Move_m[Y] = 0.0; Rotation_m[0][X] = 1; Rotation_m[1][X] = 0; Rotation_m[2][X] = 0; Rotation_m[0][Y] = 0; Rotation_m[1][Y] = 1; Rotation_m[2][Y] = 0; Rotation_m[0][Z] = 0; Rotation_m[1][Z] = 0; Rotation_m[2][Z] = 1; GetSurfaceOrient(Orient_m, Rotation_m, RefOrient_m); AtomRadius_m = ATOM_RADIUS_0; AtomDisplayRadius_m = Scale_m * AtomRadius_m + 0.5; SelectAtom_m = -1; NeighAtom_m = -1; AtomDrawType_m = Points; StereoAngle_m = STEREO_INC*DEG_TO_RAD; XtVaSetValues(atTypeToolButton_m, XtNlabel, "Circles", NULL); XtVaSetValues(atNumButton_m, XtNleftMargin, 4, XtNleftBitmap, None, NULL); AtomCenSize_m = 0.0; AtomCenPos_m[0] = 0.0; AtomCenPos_m[1] = 0.0; HideAtoms_m = FALSE; XtVaSetValues(hideAtomsButton_m, XtNleftMargin, 4, XtNleftBitmap, None, NULL); UnHideAtomsButtonFunction(NULL, NULL, NULL); Clip_m = FALSE; XtVaSetValues(clipAtomsButton_m, XtNleftMargin, 4, XtNleftBitmap, None, NULL); REFRESH return;}void FirstStepButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ if (InputFile_m == NULL) return; CurLocation_m = FileMarkers_m.Head; rewind(InputFile_m); ReadNextStep(InputFile_m, InputFileName_m, a, &Step_m, CenterGeom_m, TypeList_m); REFRESH return;}void BackStepButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ if (InputFile_m == NULL) return; if (CurLocation_m->Prev != NULL) { CurLocation_m = CurLocation_m->Prev; fseek(InputFile_m, CurLocation_m->Mark, SEEK_SET); ReadNextStep(InputFile_m, InputFileName_m, a, &Step_m, CenterGeom_m, TypeList_m); } REFRESH return;}void NextStepButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ int filepos; if (InputFile_m == NULL) return; if (CurLocation_m->Next != NULL) { CurLocation_m = CurLocation_m->Next; fseek(InputFile_m, CurLocation_m->Mark, SEEK_SET); ReadNextStep(InputFile_m, InputFileName_m, a, &Step_m, CenterGeom_m, TypeList_m); } else { filepos = ftell(InputFile_m); ReadNextStep(InputFile_m, InputFileName_m, a, &Step_m, CenterGeom_m, TypeList_m); if (AddNodeToList(&FileMarkers_m, filepos, Step_m)) { CurLocation_m = CurLocation_m->Next; if (feof(InputFile_m)) { /* Last node will be junk so get rid of it. */ RemLastNodeFromList(&FileMarkers_m); CloseList(&FileMarkers_m); CurLocation_m = FileMarkers_m.Head; rewind(InputFile_m); ReadNextStep(InputFile_m, InputFileName_m, a, &Step_m, CenterGeom_m, TypeList_m); } /* End if eof. */ } /* End if added file mark okay. */ } /* End if file mark list is not closed. */ REFRESH return;}void LastStepButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ int filepos; if (InputFile_m == NULL) return; if (FileMarkers_m.Closed == TRUE) { CurLocation_m = FileMarkers_m.Tail; fseek(InputFile_m, CurLocation_m->Mark, SEEK_SET); ReadNextStep(InputFile_m, InputFileName_m, a, &Step_m, CenterGeom_m, TypeList_m); } else { while (FileMarkers_m.Closed == FALSE) { filepos = ftell(InputFile_m); ReadNextStep(InputFile_m, InputFileName_m, a, &Step_m, CenterGeom_m, TypeList_m); if (AddNodeToList(&FileMarkers_m, filepos, Step_m)) { CurLocation_m = CurLocation_m->Next; if (feof(InputFile_m)) { /* Last node will be junk so get rid of it. */ RemLastNodeFromList(&FileMarkers_m); CloseList(&FileMarkers_m); CurLocation_m = FileMarkers_m.Tail; fseek(InputFile_m, CurLocation_m->Mark, SEEK_SET); ReadNextStep(InputFile_m, InputFileName_m, a, &Step_m, CenterGeom_m, TypeList_m); } /* End if eof. */ } /* End if added file mark okay. */ } /* End while file mark list is not closed. */ } /* End if file mark list is not closed. */ REFRESH return;}/*Rotate Left*/void RLtButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ double DeltaRotation[NDIR][NDIR] = {1,0,0, 0,1,0, 0,0,1}; DeltaRotation[X][X] = cos(RotationIncrement_m); DeltaRotation[X][Z] = -sin(RotationIncrement_m); DeltaRotation[Z][X] = sin(RotationIncrement_m); DeltaRotation[Z][Z] = cos(RotationIncrement_m); RotateMatrix(Rotation_m, DeltaRotation); GetSurfaceOrient(Orient_m, Rotation_m, RefOrient_m); REFRESH return;}/*Rotate Right*/void RRtButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ double DeltaRotation[NDIR][NDIR] = {1,0,0, 0,1,0, 0,0,1}; DeltaRotation[X][X] = cos(RotationIncrement_m); DeltaRotation[X][Z] = sin(RotationIncrement_m); DeltaRotation[Z][X] = -sin(RotationIncrement_m); DeltaRotation[Z][Z] = cos(RotationIncrement_m); RotateMatrix(Rotation_m, DeltaRotation); GetSurfaceOrient(Orient_m, Rotation_m, RefOrient_m); REFRESH return;}/*Rotate Up*/void RUpButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ double DeltaRotation[NDIR][NDIR] = {1,0,0, 0,1,0, 0,0,1}; DeltaRotation[Y][Y] = cos(RotationIncrement_m); DeltaRotation[Y][Z] = sin(RotationIncrement_m); DeltaRotation[Z][Y] = -sin(RotationIncrement_m); DeltaRotation[Z][Z] = cos(RotationIncrement_m); RotateMatrix(Rotation_m, DeltaRotation); GetSurfaceOrient(Orient_m, Rotation_m, RefOrient_m); REFRESH return;}/*Rotate Down*/void RDnButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ double DeltaRotation[NDIR][NDIR] = {1,0,0, 0,1,0, 0,0,1}; DeltaRotation[Y][Y] = cos(RotationIncrement_m); DeltaRotation[Y][Z] = -sin(RotationIncrement_m); DeltaRotation[Z][Y] = sin(RotationIncrement_m); DeltaRotation[Z][Z] = cos(RotationIncrement_m); RotateMatrix(Rotation_m, DeltaRotation); GetSurfaceOrient(Orient_m, Rotation_m, RefOrient_m); REFRESH return;}/*Move Left*/void MvLtButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ Move_m[X] -= MoveIncrement_m; REFRESH return;}/*Move Right*/void MvRtButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ Move_m[X] += MoveIncrement_m; REFRESH return;}/*Move Up*/void MvUpButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ Move_m[Y] -= MoveIncrement_m; REFRESH return;}/*Move Down*/void MvDnButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ Move_m[Y] += MoveIncrement_m; REFRESH return;}/*Zoom In*/void ZInButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ Zoom_m += ZoomIncrement_m; REFRESH return;}/*Zoom Out*/void ZOutButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ Zoom_m -= ZoomIncrement_m; if (Zoom_m < ZoomIncrement_m) Zoom_m = ZoomIncrement_m; REFRESH return;}/*Atom Plus*/void AtPlusButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ int OldAtomDisplayWidth; OldAtomDisplayWidth = AtomDisplayRadius_m; AtomRadius_m += AtomIncrement_m; AtomDisplayRadius_m = Scale_m * AtomRadius_m + 0.5; /* Refresh atoms if radius has changed */ if ((AtomDrawType_m != Points) && (AtomDrawType_m != NumPts) && (AtomDisplayRadius_m != OldAtomDisplayWidth)) { REFRESH } /* Just refresh text info */ else { } return;}/*Atom Minus*/void AtMinusButtonFunction(Widget w, XtPointer client_data, XtPointer call_data){ int OldAtomDisplayWidth; OldAtomDisplayWidth = AtomDisplayRadius_m; AtomRadius_m -= AtomIncrement_m; if (AtomRadius_m < 0.2e-8) AtomRadius_m = 0.2e-8; AtomDisplayRadius_m = Scale_m * AtomRadius_m + 0.5; /* Refresh atoms if radius has changed */ if ((AtomDrawType_m != Points) && (AtomDrawType_m != NumPts) && (AtomDisplayRadius_m != OldAtomDisplayWidth)) { REFRESH } /* Just refresh text info */ else { } return;}/*Change Atom Draw Style*/void AtTypeButtonFunction(Widget w,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -