Changeset 1336 for trunk/packages/vizservers/pymolproxy/pymolproxy.c
- Timestamp:
- Mar 17, 2009 10:02:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/pymolproxy/pymolproxy.c
r1334 r1336 107 107 108 108 typedef struct Image { 109 struct Image *next; 110 int used; 111 int allocated; 112 ssize_t nWritten; 113 size_t bytesLeft; 114 char data[1]; 109 struct Image *next; /* Next image in chain of images. The list is 110 * ordered by the most recently received image 111 * from the pymol server to the least. */ 112 ssize_t nWritten; /* Number of bytes of image data already 113 * delivered.*/ 114 size_t bytesLeft; /* Number of bytes of image data left to 115 * delivered to the client. */ 116 char data[1]; /* Start of image data. We allocate the size 117 * of the Image structure plus the size of the 118 * image data. */ 115 119 } Image; 116 120 … … 129 133 #define BUFFER_SHORT_READ -3 130 134 135 #define ATOM_SCALE_PENDING (1<<0) 136 #define BOND_THICKNESS_PENDING (1<<1) 137 #define ROTATE_PENDING (1<<2) 138 #define PAN_PENDING (1<<3) 139 #define ZOOM_PENDING (1<<4) 140 #define UPDATE_PENDING (1<<5) 141 #define FORCE_UPDATE (1<<6) 142 #define CAN_UPDATE (1<<7) 143 #define SHOW_LABELS (1<<8) 144 #define INVALIDATE_CACHE (1<<9) 145 131 146 typedef struct { 132 int serverInput;133 int serverOutput;134 int serverError;135 int clientInput;136 int clientOutput;137 147 Tcl_Interp *interp; 138 int updatePending; 139 int rotatePending; 140 int scalePending; 141 int forceUpdate; 142 int can_update; 143 int sync; 144 int showLabels; 148 unsigned int flags; /* Various flags. */ 149 Image *head; /* List of images to be delivered to the 150 * client. The most recent images are in the 151 * front of the list. */ 152 Image *current; /* The image currently being delivered to the 153 * client. We make sure we finish delivering 154 * this image before selecting the most recent 155 * image. */ 156 157 int serverInput, serverOutput, serverError; /* Server file descriptors. */ 158 int clientInput, clientOutput; /* Client file descriptors. */ 159 ReadBuffer client; /* Read buffer for client input. */ 160 ReadBuffer server; /* Read buffer for server output. */ 145 161 int frame; 146 int rock_offset; 147 int cacheid; 148 int invalidate_cache; 162 int rockOffset; 163 int cacheId; 149 164 int error; 150 165 int status; 151 ReadBuffer client;152 ReadBuffer server;153 float xAngle, yAngle, zAngle;154 float atomScale;155 Image *head, *current;166 float xAngle, yAngle, zAngle; /* Euler angles of pending rotation. */ 167 float atomScale; /* Atom scale of pending re-scale. */ 168 float bondThickness; /* Bond thickness of pending re-scale. */ 169 float zoom; 170 float xPan, yPan; 156 171 } PymolProxy; 157 172 … … 522 537 abort(); 523 538 } 524 imgPtr->bytesLeft = imgPtr->allocated =dataLength;539 imgPtr->bytesLeft = dataLength; 525 540 imgPtr->next = proxyPtr->head; 526 541 proxyPtr->head = imgPtr; 527 imgPtr-> used = imgPtr->nWritten = 0;542 imgPtr->nWritten = 0; 528 543 return imgPtr; 529 544 } … … 660 675 661 676 static void 662 DoRotate(PymolProxy *proxyPtr) 663 { 664 if (proxyPtr->rotatePending) { 677 SetZoom(PymolProxy *proxyPtr) 678 { 679 if (proxyPtr->flags & ZOOM_PENDING) { 680 Pymol(proxyPtr,"move z,%f\n", proxyPtr->zoom); 681 proxyPtr->flags &= ~ZOOM_PENDING; 682 } 683 } 684 685 static void 686 SetPan(PymolProxy *proxyPtr) 687 { 688 if (proxyPtr->flags & PAN_PENDING) { 689 Pymol(proxyPtr,"move x,%f; move y,%f\n", proxyPtr->xPan,proxyPtr->yPan); 690 proxyPtr->flags &= ~PAN_PENDING; 691 } 692 } 693 694 static void 695 SetRotation(PymolProxy *proxyPtr) 696 { 697 if (proxyPtr->flags & ROTATE_PENDING) { 665 698 /* Every pymol command line generates a new rendering. Execute all 666 699 * three turns as a single command line. */ … … 668 701 proxyPtr->xAngle, proxyPtr->yAngle, proxyPtr->zAngle); 669 702 proxyPtr->xAngle = proxyPtr->yAngle = proxyPtr->zAngle = 0.0f; 670 proxyPtr-> rotatePending = FALSE;703 proxyPtr->flags &= ~ROTATE_PENDING; 671 704 } 672 705 } 673 706 674 707 static void 675 DoAtomScale(PymolProxy *proxyPtr) 676 { 677 if (proxyPtr->scalePending) { 678 proxyPtr->scalePending = FALSE; 708 SetAtomScale(PymolProxy *proxyPtr) 709 { 710 if (proxyPtr->flags & ATOM_SCALE_PENDING) { 679 711 Pymol(proxyPtr, "set sphere_scale,%f,all\n", proxyPtr->atomScale); 680 } 681 } 682 683 static int 684 AtomscaleCmd(ClientData clientData, Tcl_Interp *interp, int argc, 712 proxyPtr->flags &= ~ATOM_SCALE_PENDING; 713 } 714 } 715 716 static void 717 SetBondThickness(PymolProxy *proxyPtr) 718 { 719 if (proxyPtr->flags & BOND_THICKNESS_PENDING) { 720 Pymol(proxyPtr, "set stick_radius,%f,all\n", proxyPtr->atomScale); 721 proxyPtr->flags &= ~BOND_THICKNESS_PENDING; 722 } 723 } 724 725 static int 726 AtomScaleCmd(ClientData clientData, Tcl_Interp *interp, int argc, 685 727 const char *argv[]) 686 728 { … … 706 748 } 707 749 } 708 proxyPtr->invalidate_cache = TRUE; /* Spheres */ 709 proxyPtr->updatePending = !defer || push; 710 proxyPtr->forceUpdate = push; 750 proxyPtr->flags |= INVALIDATE_CACHE; /* Spheres */ 751 if (!defer || push) { 752 proxyPtr->flags |= UPDATE_PENDING; 753 } 754 if (push) { 755 proxyPtr->flags |= FORCE_UPDATE; 756 } 711 757 712 758 if (strcmp(model, "all") == 0) { 713 proxyPtr-> scalePending = TRUE;759 proxyPtr->flags |= ATOM_SCALE_PENDING; 714 760 proxyPtr->atomScale = scale; 715 761 } else { … … 747 793 } 748 794 749 proxyPtr->invalidate_cache = TRUE; /* Ball 'n Stick */ 750 proxyPtr->updatePending = !defer || push; 751 proxyPtr->forceUpdate = push; 752 795 proxyPtr->flags |= INVALIDATE_CACHE; /* Ball 'n Stick */ 796 if (!defer || push) { 797 proxyPtr->flags |= UPDATE_PENDING; 798 } 799 if (push) { 800 proxyPtr->flags |= FORCE_UPDATE; 801 } 753 802 Pymol(proxyPtr, "hide everything,%s\n",model); 754 803 Pymol(proxyPtr, "set stick_color,white,%s\n",model); … … 769 818 Pymol(proxyPtr, "show spheres,%s\n", model); 770 819 771 if (proxyPtr-> showLabels) {820 if (proxyPtr->flags & SHOW_LABELS) { 772 821 Pymol(proxyPtr, "show labels,%s\n", model); 773 822 } … … 791 840 clear_error(proxyPtr); 792 841 793 if (proxyPtr->invalidate_cache) 794 proxyPtr->cacheid++; 795 796 proxyPtr->updatePending = FALSE; 797 proxyPtr->forceUpdate = FALSE; 798 proxyPtr->invalidate_cache = FALSE; 842 if (proxyPtr->flags & INVALIDATE_CACHE) 843 proxyPtr->cacheId++; 844 845 proxyPtr->flags &= ~(UPDATE_PENDING|FORCE_UPDATE|INVALIDATE_CACHE); 799 846 800 847 /* Force pymol to update the current scene. */ … … 813 860 nWritten = write(3,&samples,sizeof(samples)); 814 861 #endif 815 sprintf(buffer, "nv>image %d %d %d %d\n", nBytes, proxyPtr->cache id,816 proxyPtr->frame, proxyPtr->rock _offset);862 sprintf(buffer, "nv>image %d %d %d %d\n", nBytes, proxyPtr->cacheId, 863 proxyPtr->frame, proxyPtr->rockOffset); 817 864 818 865 length = strlen(buffer); … … 825 872 stats.nFrames++; 826 873 stats.nBytes += nBytes; 874 return proxyPtr->status; 875 } 876 877 static int 878 BondThicknessCmd(ClientData clientData, Tcl_Interp *interp, int argc, 879 const char *argv[]) 880 { 881 int defer = 0, push = 0, arg; 882 double scale; 883 const char *model = "all"; 884 PymolProxy *proxyPtr = clientData; 885 886 clear_error(proxyPtr); 887 scale = 0.25f; 888 for(arg = 1; arg < argc; arg++) { 889 if ( strcmp(argv[arg],"-defer") == 0 ) { 890 defer = 1; 891 } else if (strcmp(argv[arg],"-push") == 0) { 892 push = 1; 893 } else if (strcmp(argv[arg],"-model") == 0) { 894 if (++arg < argc) 895 model = argv[arg]; 896 } else { 897 if (Tcl_GetDouble(interp, argv[arg], &scale) != TCL_OK) { 898 return TCL_ERROR; 899 } 900 } 901 } 902 proxyPtr->flags |= INVALIDATE_CACHE; /* Spheres */ 903 if (!defer || push) { 904 proxyPtr->flags |= UPDATE_PENDING; 905 } 906 if (push) { 907 proxyPtr->flags |= FORCE_UPDATE; 908 } 909 910 if (strcmp(model, "all") == 0) { 911 proxyPtr->flags |= BOND_THICKNESS_PENDING; 912 proxyPtr->bondThickness = scale; 913 } else { 914 Pymol(proxyPtr, "set stick_radius,%f,%s\n", scale, model); 915 } 827 916 return proxyPtr->status; 828 917 } … … 849 938 } 850 939 851 proxyPtr->updatePending = !defer || push; 852 proxyPtr->forceUpdate = push; 853 proxyPtr->invalidate_cache = TRUE; /* Disable */ 940 proxyPtr->flags |= INVALIDATE_CACHE; /* Disable */ 941 if (!defer || push) { 942 proxyPtr->flags |= UPDATE_PENDING; 943 } 944 if (push) { 945 proxyPtr->flags |= FORCE_UPDATE; 946 } 854 947 855 948 Pymol( proxyPtr, "disable %s\n", model); … … 879 972 880 973 } 881 882 proxyPtr->updatePending = !defer || push; 883 proxyPtr->forceUpdate = push; 884 proxyPtr->invalidate_cache = TRUE; /* Enable */ 885 974 proxyPtr->flags |= INVALIDATE_CACHE; /* Enable */ 975 if (!defer || push) { 976 proxyPtr->flags |= UPDATE_PENDING; 977 } 978 if (push) { 979 proxyPtr->flags |= FORCE_UPDATE; 980 } 886 981 Pymol( proxyPtr, "enable %s\n", model); 887 888 982 return proxyPtr->status; 889 983 } … … 908 1002 } 909 1003 910 proxyPtr->updatePending = !defer || push; 911 proxyPtr->forceUpdate = push; 1004 if (!defer || push) { 1005 proxyPtr->flags |= UPDATE_PENDING; 1006 } 1007 if (push) { 1008 proxyPtr->flags |= FORCE_UPDATE; 1009 } 912 1010 proxyPtr->frame = frame; 913 1011 … … 940 1038 state = 0; 941 1039 else if (strcmp(argv[arg],"toggle") == 0 ) 942 state = !proxyPtr->showLabels; 943 } 944 945 proxyPtr->updatePending = !defer || push; 946 proxyPtr->forceUpdate = push; 947 proxyPtr->invalidate_cache = TRUE; /* Label */ 948 1040 state = ((proxyPtr->flags & SHOW_LABELS) == 0); 1041 } 1042 1043 proxyPtr->flags |= INVALIDATE_CACHE; /* Label */ 1044 if (!defer || push) { 1045 proxyPtr->flags |= UPDATE_PENDING; 1046 } 1047 if (push) { 1048 proxyPtr->flags |= FORCE_UPDATE; 1049 } 949 1050 if (state) { 950 1051 Pymol(proxyPtr, "set label_color,white,all\n"); … … 955 1056 Pymol(proxyPtr, "label all\n"); 956 1057 957 proxyPtr->showLabels = state; 958 1058 if (state) { 1059 proxyPtr->flags |= SHOW_LABELS; 1060 } else { 1061 proxyPtr->flags &= ~SHOW_LABELS; 1062 } 959 1063 return proxyPtr->status; 960 1064 } … … 988 1092 } 989 1093 990 proxyPtr->invalidate_cache = TRUE; /* Lines */ 991 proxyPtr->updatePending = !defer || push; 992 proxyPtr->forceUpdate = push; 993 1094 proxyPtr->flags |= INVALIDATE_CACHE; /* Lines */ 1095 if (!defer || push) { 1096 proxyPtr->flags |= UPDATE_PENDING; 1097 } 1098 if (push) { 1099 proxyPtr->flags |= FORCE_UPDATE; 1100 } 994 1101 Pymol(proxyPtr, "hide everything,%s\n",model); 995 1102 … … 997 1104 Pymol(proxyPtr, "set line_width,%g,%s\n", lineWidth, model); 998 1105 Pymol(proxyPtr, "show lines,%s\n", model); 999 if (proxyPtr-> showLabels) {1106 if (proxyPtr->flags & SHOW_LABELS) { 1000 1107 Pymol(proxyPtr, "show labels,%s\n", model); 1001 1108 } … … 1033 1140 } 1034 1141 1035 proxyPtr->updatePending = !defer || push; 1036 proxyPtr->forceUpdate = push; 1142 if (!defer || push) { 1143 proxyPtr->flags |= UPDATE_PENDING; 1144 } 1145 if (push) { 1146 proxyPtr->flags |= FORCE_UPDATE; 1147 } 1037 1148 1038 1149 /* Does not invalidate cache? */ … … 1084 1195 } 1085 1196 } 1086 proxyPtr->invalidate_cache = TRUE; 1087 proxyPtr->updatePending = !defer || push; 1088 proxyPtr->forceUpdate = push; 1197 proxyPtr->flags |= INVALIDATE_CACHE; 1198 if (!defer || push) { 1199 proxyPtr->flags |= UPDATE_PENDING; 1200 } 1201 if (push) { 1202 proxyPtr->flags |= FORCE_UPDATE; 1203 } 1089 1204 Pymol(proxyPtr, "set orthoscopic=%d\n", bool); 1090 1205 return proxyPtr->status; … … 1128 1243 return TCL_ERROR; 1129 1244 } 1130 proxyPtr->updatePending = !defer || push; 1131 proxyPtr->forceUpdate = push; 1132 proxyPtr->invalidate_cache = TRUE; /* Pan */ 1133 1245 proxyPtr->flags |= INVALIDATE_CACHE; /* Pan */ 1246 if (!defer || push) { 1247 proxyPtr->flags |= UPDATE_PENDING; 1248 } 1249 if (push) { 1250 proxyPtr->flags |= FORCE_UPDATE; 1251 } 1134 1252 if ((x != 0.0f) || (y != 0.0f)) { 1135 /* Every pymol command line generates a new rendering. Execute both1136 * moves as a single command line. */1137 Pymol(proxyPtr,"move x,%f; move y,%f\n", x * 0.05, -y * 0.05);1253 proxyPtr->xPan = x * 0.05; 1254 proxyPtr->yPan = -y * 0.05; 1255 proxyPtr->flags |= PAN_PENDING; 1138 1256 } 1139 1257 return proxyPtr->status; … … 1155 1273 clear_error(proxyPtr); 1156 1274 1157 if (proxyPtr->invalidate_cache) 1158 proxyPtr->cacheid++; 1159 1160 proxyPtr->updatePending = FALSE; 1161 proxyPtr->forceUpdate = FALSE; 1162 proxyPtr->invalidate_cache = FALSE; 1163 1164 /* Force pymol to update the current scene. */ 1275 if (proxyPtr->flags & INVALIDATE_CACHE) 1276 proxyPtr->cacheId++; 1277 1278 proxyPtr->flags &= ~(UPDATE_PENDING | FORCE_UPDATE | INVALIDATE_CACHE); 1279 1280 /* Force pymol to update the current scene. */ 1165 1281 Pymol(proxyPtr,"refresh\n"); 1166 1282 … … 1176 1292 if (nBytes == 0) { 1177 1293 } 1178 sprintf(buffer, "nv>image %d %d %d %d\n", nBytes, proxyPtr->cache id,1179 proxyPtr->frame, proxyPtr->rock _offset);1294 sprintf(buffer, "nv>image %d %d %d %d\n", nBytes, proxyPtr->cacheId, 1295 proxyPtr->frame, proxyPtr->rockOffset); 1180 1296 length = strlen(buffer); 1181 1297 imgPtr = NewImage(proxyPtr, nBytes + length); … … 1212 1328 } 1213 1329 1214 proxyPtr->updatePending = !defer || push; 1215 proxyPtr->forceUpdate = push; 1216 proxyPtr->invalidate_cache = TRUE; /* Raw */ 1217 1330 proxyPtr->flags |= INVALIDATE_CACHE; /* Raw */ 1331 if (!defer || push) { 1332 proxyPtr->flags |= UPDATE_PENDING; 1333 } 1334 if (push) { 1335 proxyPtr->flags |= FORCE_UPDATE; 1336 } 1218 1337 Pymol(proxyPtr,"%s\n", cmd); 1219 1338 return proxyPtr->status; … … 1236 1355 } 1237 1356 1238 proxyPtr->updatePending = !defer || push; 1239 proxyPtr->forceUpdate = push; 1240 proxyPtr->invalidate_cache = TRUE; /* Reset */ 1241 1357 proxyPtr->flags |= INVALIDATE_CACHE; /* Reset */ 1358 if (!defer || push) { 1359 proxyPtr->flags |= UPDATE_PENDING; 1360 } 1361 if (push) { 1362 proxyPtr->flags |= FORCE_UPDATE; 1363 } 1242 1364 Pymol(proxyPtr, "reset\n"); 1243 1365 Pymol(proxyPtr, "zoom complete=1\n"); 1244 1245 1366 return proxyPtr->status; 1246 1367 } … … 1267 1388 /* Does not invalidate cache. */ 1268 1389 1269 proxyPtr->updatePending = !defer || push; 1270 proxyPtr->forceUpdate = push; 1271 1272 Pymol(proxyPtr,"turn y, %f\n", y - proxyPtr->rock_offset); 1273 1274 proxyPtr->rock_offset = y; 1275 1390 if (!defer || push) { 1391 proxyPtr->flags |= UPDATE_PENDING; 1392 } 1393 if (push) { 1394 proxyPtr->flags |= FORCE_UPDATE; 1395 } 1396 Pymol(proxyPtr,"turn y, %f\n", y - proxyPtr->rockOffset); 1397 proxyPtr->rockOffset = y; 1276 1398 return proxyPtr->status; 1277 1399 } … … 1328 1450 } 1329 1451 } 1330 proxyPtr->updatePending = !defer || push; 1331 proxyPtr->forceUpdate = push; 1332 proxyPtr->invalidate_cache = TRUE; /* Rotate */ 1333 1452 proxyPtr->flags |= INVALIDATE_CACHE; /* Rotate */ 1453 if (!defer || push) { 1454 proxyPtr->flags |= UPDATE_PENDING; 1455 } 1456 if (push) { 1457 proxyPtr->flags |= FORCE_UPDATE; 1458 } 1334 1459 if ((xAngle != 0.0f) || (yAngle != 0.0f) || (zAngle != 0.0f)) { 1335 1460 proxyPtr->xAngle += xAngle; 1336 1461 proxyPtr->yAngle += yAngle; 1337 1462 proxyPtr->zAngle += zAngle; 1338 proxyPtr-> rotatePending = TRUE;1463 proxyPtr->flags |= ROTATE_PENDING; 1339 1464 } 1340 1465 return proxyPtr->status; … … 1372 1497 } 1373 1498 1374 proxyPtr->invalidate_cache = TRUE; /* Spheres */ 1375 proxyPtr->updatePending = !defer || push; 1376 proxyPtr->forceUpdate = push; 1377 1499 proxyPtr->flags |= INVALIDATE_CACHE; /* Spheres */ 1500 if (!defer || push) { 1501 proxyPtr->flags |= UPDATE_PENDING; 1502 } 1503 if (push) { 1504 proxyPtr->flags |= FORCE_UPDATE; 1505 } 1378 1506 Pymol(proxyPtr, "hide everything, %s\n", model); 1379 1507 #ifdef notdef … … 1390 1518 Pymol(proxyPtr, "show spheres,%s\n", model); 1391 1519 1392 if (proxyPtr-> showLabels) {1520 if (proxyPtr->flags & SHOW_LABELS) { 1393 1521 Pymol(proxyPtr, "show labels,%s\n", model); 1394 1522 } … … 1421 1549 } 1422 1550 } 1423 1424 proxyPtr->updatePending = !defer || push; 1425 proxyPtr->forceUpdate = push; 1426 proxyPtr->invalidate_cache = TRUE; /* viewport */ 1427 1551 proxyPtr->flags |= INVALIDATE_CACHE; /* viewport */ 1552 if (!defer || push) { 1553 proxyPtr->flags |= UPDATE_PENDING; 1554 } 1555 if (push) { 1556 proxyPtr->flags |= FORCE_UPDATE; 1557 } 1428 1558 Pymol(proxyPtr, "viewport %d,%d\n", width, height); 1429 1559 … … 1470 1600 } 1471 1601 1472 proxyPtr->updatePending = !defer || push; 1473 proxyPtr->forceUpdate = push; 1474 proxyPtr->invalidate_cache = TRUE; /* vmouse */ 1475 1476 Pymol(proxyPtr, "vmouse %d,%d,%d,%d,%d\n", arg1, arg2, arg3, 1477 arg4, arg5); 1478 1602 proxyPtr->flags |= INVALIDATE_CACHE; /* vmouse */ 1603 if (!defer || push) { 1604 proxyPtr->flags |= UPDATE_PENDING; 1605 } 1606 if (push) { 1607 proxyPtr->flags |= FORCE_UPDATE; 1608 } 1609 Pymol(proxyPtr, "vmouse %d,%d,%d,%d,%d\n", arg1, arg2, arg3, arg4, arg5); 1479 1610 return proxyPtr->status; 1480 1611 } … … 1516 1647 } 1517 1648 } 1518 proxyPtr->updatePending = !defer || push; 1519 proxyPtr->forceUpdate = push; 1520 proxyPtr->invalidate_cache = TRUE; /* Zoom */ 1521 1649 proxyPtr->flags |= INVALIDATE_CACHE; /* Zoom */ 1650 if (!defer || push) { 1651 proxyPtr->flags |= UPDATE_PENDING; 1652 } 1653 if (push) { 1654 proxyPtr->flags |= FORCE_UPDATE; 1655 } 1522 1656 if (factor != 0.0) { 1523 Pymol(proxyPtr,"move z,%f\n", factor); 1657 proxyPtr->zoom = factor; 1658 proxyPtr->flags |= ZOOM_PENDING; 1524 1659 } 1525 1660 return proxyPtr->status; … … 1609 1744 proxy.clientInput = c_in; 1610 1745 proxy.clientOutput = c_out; 1611 proxy. can_update = TRUE;1746 proxy.flags = CAN_UPDATE; 1612 1747 proxy.frame = 1; 1613 1748 interp = Tcl_CreateInterp(); … … 1615 1750 proxy.interp = interp; 1616 1751 1617 Tcl_CreateCommand(interp, "atomscale", AtomscaleCmd, &proxy, NULL); 1618 Tcl_CreateCommand(interp, "ballnstick", BallNStickCmd, &proxy, NULL); 1619 Tcl_CreateCommand(interp, "bmp", BmpCmd, &proxy, NULL); 1620 Tcl_CreateCommand(interp, "disable", DisableCmd, &proxy, NULL); 1621 Tcl_CreateCommand(interp, "enable", EnableCmd, &proxy, NULL); 1622 Tcl_CreateCommand(interp, "frame", FrameCmd, &proxy, NULL); 1623 Tcl_CreateCommand(interp, "label", LabelCmd, &proxy, NULL); 1624 Tcl_CreateCommand(interp, "lines", LinesCmd, &proxy, NULL); 1625 Tcl_CreateCommand(interp, "loadpdb", LoadPDBCmd, &proxy, NULL); 1626 Tcl_CreateCommand(interp, "orthoscopic", OrthoscopicCmd, &proxy, NULL); 1627 Tcl_CreateCommand(interp, "pan", PanCmd, &proxy, NULL); 1628 Tcl_CreateCommand(interp, "png", PngCmd, &proxy, NULL); 1629 Tcl_CreateCommand(interp, "raw", RawCmd, &proxy, NULL); 1630 Tcl_CreateCommand(interp, "reset", ResetCmd, &proxy, NULL); 1631 Tcl_CreateCommand(interp, "rock", RockCmd, &proxy, NULL); 1632 Tcl_CreateCommand(interp, "rotate", RotateCmd, &proxy, NULL); 1633 Tcl_CreateCommand(interp, "screen", ScreenCmd, &proxy, NULL); 1634 Tcl_CreateCommand(interp, "spheres", SpheresCmd, &proxy, NULL); 1635 Tcl_CreateCommand(interp, "viewport", ScreenCmd, &proxy, NULL); 1636 Tcl_CreateCommand(interp, "vmouse", VMouseCmd, &proxy, NULL); 1637 Tcl_CreateCommand(interp, "zoom", ZoomCmd, &proxy, NULL); 1752 Tcl_CreateCommand(interp, "atomscale", AtomScaleCmd, &proxy, NULL); 1753 Tcl_CreateCommand(interp, "ballnstick", BallNStickCmd, &proxy, NULL); 1754 Tcl_CreateCommand(interp, "bmp", BmpCmd, &proxy, NULL); 1755 Tcl_CreateCommand(interp, "bondthickness", BondThicknessCmd, &proxy, NULL); 1756 Tcl_CreateCommand(interp, "disable", DisableCmd, &proxy, NULL); 1757 Tcl_CreateCommand(interp, "enable", EnableCmd, &proxy, NULL); 1758 Tcl_CreateCommand(interp, "frame", FrameCmd, &proxy, NULL); 1759 Tcl_CreateCommand(interp, "label", LabelCmd, &proxy, NULL); 1760 Tcl_CreateCommand(interp, "lines", LinesCmd, &proxy, NULL); 1761 Tcl_CreateCommand(interp, "loadpdb", LoadPDBCmd, &proxy, NULL); 1762 Tcl_CreateCommand(interp, "orthoscopic", OrthoscopicCmd, &proxy, NULL); 1763 Tcl_CreateCommand(interp, "pan", PanCmd, &proxy, NULL); 1764 Tcl_CreateCommand(interp, "png", PngCmd, &proxy, NULL); 1765 Tcl_CreateCommand(interp, "raw", RawCmd, &proxy, NULL); 1766 Tcl_CreateCommand(interp, "reset", ResetCmd, &proxy, NULL); 1767 Tcl_CreateCommand(interp, "rock", RockCmd, &proxy, NULL); 1768 Tcl_CreateCommand(interp, "rotate", RotateCmd, &proxy, NULL); 1769 Tcl_CreateCommand(interp, "screen", ScreenCmd, &proxy, NULL); 1770 Tcl_CreateCommand(interp, "spheres", SpheresCmd, &proxy, NULL); 1771 Tcl_CreateCommand(interp, "viewport", ScreenCmd, &proxy, NULL); 1772 Tcl_CreateCommand(interp, "vmouse", VMouseCmd, &proxy, NULL); 1773 Tcl_CreateCommand(interp, "zoom", ZoomCmd, &proxy, NULL); 1638 1774 1639 1775 … … 1735 1871 1736 1872 #define PENDING_TIMEOUT 10 /* milliseconds. */ 1737 timeout = (proxyPtr-> updatePending) ? PENDING_TIMEOUT : -1;1873 timeout = (proxyPtr->flags & UPDATE_PENDING) ? PENDING_TIMEOUT : -1; 1738 1874 nChannels = poll(pollResults, nChannels, timeout); 1739 1875 if (nChannels < 0) { … … 1825 1961 */ 1826 1962 1827 if (proxyPtr->rotatePending) { 1828 DoRotate(proxyPtr); 1829 } 1830 if (proxyPtr->scalePending) { 1831 DoAtomScale(proxyPtr); 1963 /* Handle all the pending setting changes now. */ 1964 if (proxyPtr->flags & ROTATE_PENDING) { 1965 SetRotation(proxyPtr); 1966 } 1967 if (proxyPtr->flags & PAN_PENDING) { 1968 SetPan(proxyPtr); 1969 } 1970 if (proxyPtr->flags & ZOOM_PENDING) { 1971 SetZoom(proxyPtr); 1972 } 1973 if (proxyPtr->flags & ATOM_SCALE_PENDING) { 1974 SetAtomScale(proxyPtr); 1975 } 1976 if (proxyPtr->flags & BOND_THICKNESS_PENDING) { 1977 SetBondThickness(proxyPtr); 1832 1978 } 1833 1979 … … 1837 1983 * transmitting an image back to the client. The image will be 1838 1984 * refreshed after the image has been completely transmitted. */ 1839 if ((nChannels == 0) || (proxyPtr->f orceUpdate)) {1840 if (proxyPtr-> updatePending) {1985 if ((nChannels == 0) || (proxyPtr->flags & FORCE_UPDATE)) { 1986 if (proxyPtr->flags & UPDATE_PENDING) { 1841 1987 Tcl_Eval(proxyPtr->interp, "bmp"); 1842 proxyPtr-> updatePending = FALSE;1988 proxyPtr->flags &= ~UPDATE_PENDING; 1843 1989 } 1844 proxyPtr->f orceUpdate = FALSE;1990 proxyPtr->flags &= ~FORCE_UPDATE; 1845 1991 continue; 1846 1992 }
Note: See TracChangeset
for help on using the changeset viewer.