- Timestamp:
- Nov 25, 2008, 5:28:38 PM (16 years ago)
- Location:
- trunk/source/visualization
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/History
r846 r891 1 $Id: History,v 1.42 3 2008/04/30 10:09:46 allisonExp $1 $Id: History,v 1.424 2008/11/21 22:03:51 perl Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 24 24 History file for visualization category 25 25 --------------------------------------- 26 27 21st November 2008 Joseph Perl (vis-V09-01-06) 28 - visman-V09-01-05: Trap recursive use of /vis/reviewKeptEvents. 29 - modeling-V09-01-01: Improve message. 30 - opengl-V09-01-03: Many changes to add Qt support. 26 31 27 32 30th April 2008 John Allison (vis-V09-01-05) -
trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r877 r891 1032 1032 void G4OpenGLQtViewer::toggleDrawingAction(int aAction) { 1033 1033 1034 G4ViewParameters::DrawingStyle d_style ;1034 G4ViewParameters::DrawingStyle d_style = G4ViewParameters::wireframe; 1035 1035 1036 1036 -
trunk/source/visualization/OpenGL/src/G4OpenGLXViewer.cc
r850 r891 218 218 y_origin = 0; 219 219 size_hints = XAllocSizeHints(); 220 const G4String& XGeometryString = fVP.GetXGeometryString(); 221 int screen_num = DefaultScreen(dpy); 222 if (!XGeometryString.empty()) { 223 G4int geometryResultMask = XParseGeometry 224 ((char*)XGeometryString.c_str(), 225 &x_origin, &y_origin, &width, &height); 226 if (geometryResultMask & (WidthValue | HeightValue)) { 227 if (geometryResultMask & XValue) { 228 if (geometryResultMask & XNegative) { 229 x_origin = DisplayWidth(dpy, screen_num) + x_origin - width; 230 } 231 size_hints->flags |= PPosition; 232 size_hints->x = x_origin; 233 } 234 if (geometryResultMask & YValue) { 235 if (geometryResultMask & YNegative) { 236 y_origin = DisplayHeight(dpy, screen_num) + y_origin - height; 237 } 238 size_hints->flags |= PPosition; 239 size_hints->y = y_origin; 240 } 241 } else { 242 G4cout << "ERROR: Geometry string \"" 243 << XGeometryString 244 << "\" invalid. Using \"600x600\"." 245 << G4endl; 246 width = 600; 247 height = 600; 248 } 249 } 250 size_hints->width = width; 251 size_hints->height = height; 220 221 // already done in G4VViewer at creation 222 223 // const G4String& XGeometryString = fVP.GetXGeometryString(); 224 // int screen_num = DefaultScreen(dpy); 225 // if (!XGeometryString.empty()) { 226 // G4int geometryResultMask = XParseGeometry 227 // ((char*)XGeometryString.c_str(), 228 // &x_origin, &y_origin, &width, &height); 229 // if (geometryResultMask & (WidthValue | HeightValue)) { 230 // if (geometryResultMask & XValue) { 231 // if (geometryResultMask & XNegative) { 232 // x_origin = DisplayWidth(dpy, screen_num) + x_origin - width; 233 // } 234 // size_hints->flags |= PPosition; 235 // size_hints->x = x_origin; 236 // } 237 // if (geometryResultMask & YValue) { 238 // if (geometryResultMask & YNegative) { 239 // y_origin = DisplayHeight(dpy, screen_num) + y_origin - height; 240 // } 241 // size_hints->flags |= PPosition; 242 // size_hints->y = y_origin; 243 // } 244 // } else { 245 // G4cout << "ERROR: Geometry string \"" 246 // << XGeometryString 247 // << "\" invalid. Using \"600x600\"." 248 // << G4endl; 249 // width = 600; 250 // height = 600; 251 // } 252 // } 253 // size_hints->width = width; 254 // size_hints->height = height; 255 256 #ifdef G4DEBUG 257 printf("CreateWindow Size:%d=%d - %d=%d \n",width,fVP.GetWindowSizeHintX(),height, fVP.GetWindowSizeHintY()); 258 #endif 259 260 size_hints->width = fVP.GetWindowSizeHintX(); 261 size_hints->height = fVP.GetWindowSizeHintY(); 252 262 size_hints->flags |= PSize; 253 263 -
trunk/source/visualization/OpenGL/src/G4OpenGLXmViewer.cc
r850 r891 596 596 Dimension width, height; 597 597 XtVaGetValues (glxarea,XmNwidth,&width,XmNheight,&height,NULL); 598 #ifdef G4DEBUG 599 printf("CreateWindow Size:%d - %d \n",width,height); 600 #endif 598 601 WinSize_x = (G4int) width; 599 602 WinSize_y = (G4int) height; -
trunk/source/visualization/management/include/G4VisCommandsViewer.hh
r850 r891 138 138 G4VisCommandViewerCreate (const G4VisCommandViewerCreate&); 139 139 G4VisCommandViewerCreate& operator = (const G4VisCommandViewerCreate&); 140 int ParseGeometry ( const char *string, int *x, int *y, unsigned int *width, unsigned int *height); 141 int ReadInteger(char *string, char **NextString); 140 142 G4String NextName (); 141 143 G4UIcommand* fpCommand; 142 144 G4int fId; 145 int NoValue; 146 int XValue; 147 int YValue; 148 int WidthValue; 149 int HeightValue; 150 int AllValues; 151 int XNegative; 152 int YNegative; 143 153 }; 144 154 -
trunk/source/visualization/management/src/G4VisCommandsViewer.cc
r850 r891 488 488 ////////////// /vis/viewer/create /////////////////////////////////////// 489 489 490 G4VisCommandViewerCreate::G4VisCommandViewerCreate (): fId (0) { 490 G4VisCommandViewerCreate::G4VisCommandViewerCreate (): 491 fId (0), 492 NoValue(0x0000), 493 XValue(0x0001), 494 YValue(0x0002), 495 WidthValue(0x0004), 496 HeightValue(0x0008), 497 AllValues(0x000F), 498 XNegative(0x0010), 499 YNegative(0x0020) { 491 500 G4bool omitable; 492 501 fpCommand = new G4UIcommand ("/vis/viewer/create", this); … … 636 645 } 637 646 647 638 648 // Parse windowSizeHintString to extract first field for backwards 639 649 // compatibility... … … 641 651 G4int windowSizeHint; 642 652 size_t i; 653 #ifdef G4DEBUG 654 printf("G4VisCommandViewerCreate::SetNewValue string\n"); 655 #endif 643 656 for (i = 0; i < windowSizeHintString.size(); ++i) { 644 657 char c = windowSizeHintString[i]; 658 #ifdef G4DEBUG 659 printf("%c",c); 660 #endif 645 661 if (c == 'x' || c == 'X' || c == '+' || c == '-') break; 646 662 } 663 #ifdef G4DEBUG 664 printf("\n"); 665 #endif 647 666 if (i != windowSizeHintString.size()) { 648 667 // x or X or + or - found - must be a X-Window-type geometry string... … … 671 690 // manager in the G4VViewer constructor. They have to be held by 672 691 // the vis manager until the viewer is contructed - next line... 692 693 //////// 694 695 int x,y = 0; 696 unsigned int w,h = 9999999; 697 698 int m = ParseGeometry( windowSizeHintString, &x, &y, &w, &h ); 699 // QSize minSize = main_widget->minimumSize(); 700 // QSize maxSize = main_widget->maximumSize(); 701 if ( (m & XValue) == 0 ) 702 x = -1; 703 if ( (m & YValue) == 0 ) 704 y = -2; 705 if ( (m & WidthValue) == 0 ) 706 w = -3; 707 if ( (m & HeightValue) == 0 ) 708 h = -4; 709 // w = QMIN(w,maxSize.width()); 710 // h = QMIN(h,maxSize.height()); 711 // w = QMAX(w,minSize.width()); 712 // h = QMAX(h,minSize.height()); 713 // if ( (m & XNegative) ) { 714 // x = desktop()->width() + x - w; 715 // qt_widget_tlw_gravity = 3; 716 // } 717 // if ( (m & YNegative) ) { 718 // y = desktop()->height() + y - h; 719 // qt_widget_tlw_gravity = (m & XNegative) ? 9 : 7; 720 // } 721 // main_widget->setGeometry( x, y, w, h ); 722 723 #ifdef G4DEBUG 724 printf ("Lecture X:%d Y:%d W:%d H:%d\n",x,y,w,h); 725 //////// 726 #endif 673 727 674 728 // Create viewer. … … 1518 1572 SetViewParameters(currentViewer, vp); 1519 1573 } 1574 1575 /* Keep from : 1576 * ftp://ftp.trolltech.com/qt/source/qt-embedded-free-3.0.6.tar.gz/qt-embedded-free-3.0.6/src/kernel/qapplication_qws.cpp 1577 * 1578 * ParseGeometry parses strings of the form 1579 * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where 1580 * width, height, xoffset, and yoffset are unsigned integers. 1581 * Example: "=80x24+300-49" 1582 * The equal sign is optional. 1583 * It returns a bitmask that indicates which of the four values 1584 * were actually found in the string. For each value found, 1585 * the corresponding argument is updated; for each value 1586 * not found, the corresponding argument is left unchanged. 1587 */ 1588 1589 1590 int G4VisCommandViewerCreate::ParseGeometry ( 1591 const char *string, 1592 int *x, 1593 int *y, 1594 unsigned int *width, 1595 unsigned int *height) 1596 { 1597 1598 int mask = NoValue; 1599 register char *strind; 1600 unsigned int tempWidth, tempHeight; 1601 int tempX, tempY; 1602 char *nextCharacter; 1603 if ( (string == NULL) || (*string == '\0')) { 1604 return(mask); 1605 } 1606 if (*string == '=') 1607 string++; /* ignore possible '=' at beg of geometry spec */ 1608 strind = (char *)string; 1609 if (*strind != '+' && *strind != '-' && *strind != 'x') { 1610 tempWidth = ReadInteger(strind, &nextCharacter); 1611 if (strind == nextCharacter) 1612 return (0); 1613 strind = nextCharacter; 1614 mask |= WidthValue; 1615 } 1616 if (*strind == 'x' || *strind == 'X') { 1617 strind++; 1618 tempHeight = ReadInteger(strind, &nextCharacter); 1619 if (strind == nextCharacter) 1620 return (0); 1621 strind = nextCharacter; 1622 mask |= HeightValue; 1623 } 1624 1625 if ((*strind == '+') || (*strind == '-')) { 1626 if (*strind == '-') { 1627 strind++; 1628 tempX = -ReadInteger(strind, &nextCharacter); 1629 if (strind == nextCharacter) 1630 return (0); 1631 strind = nextCharacter; 1632 mask |= XNegative; 1633 1634 } 1635 else 1636 { strind++; 1637 tempX = ReadInteger(strind, &nextCharacter); 1638 if (strind == nextCharacter) 1639 return(0); 1640 strind = nextCharacter; 1641 } 1642 mask |= XValue; 1643 if ((*strind == '+') || (*strind == '-')) { 1644 if (*strind == '-') { 1645 strind++; 1646 tempY = -ReadInteger(strind, &nextCharacter); 1647 if (strind == nextCharacter) 1648 return(0); 1649 strind = nextCharacter; 1650 mask |= YNegative; 1651 } 1652 else 1653 { 1654 strind++; 1655 tempY = ReadInteger(strind, &nextCharacter); 1656 if (strind == nextCharacter) 1657 return(0); 1658 strind = nextCharacter; 1659 } 1660 mask |= YValue; 1661 } 1662 } 1663 /* If strind isn't at the end of the string the it's an invalid 1664 geometry specification. */ 1665 if (*strind != '\0') return (0); 1666 if (mask & XValue) 1667 *x = tempX; 1668 if (mask & YValue) 1669 *y = tempY; 1670 if (mask & WidthValue) 1671 *width = tempWidth; 1672 if (mask & HeightValue) 1673 *height = tempHeight; 1674 return (mask); 1675 } 1676 1677 /* Keep from : 1678 * ftp://ftp.trolltech.com/qt/source/qt-embedded-free-3.0.6.tar.gz/qt-embedded-free-3.0.6/src/kernel/qapplication_qws.cpp 1679 * 1680 */ 1681 int G4VisCommandViewerCreate::ReadInteger(char *string, char **NextString) 1682 { 1683 register int Result = 0; 1684 int Sign = 1; 1685 1686 if (*string == '+') 1687 string++; 1688 else if (*string == '-') 1689 { 1690 string++; 1691 Sign = -1; 1692 } 1693 for (; (*string >= '0') && (*string <= '9'); string++) 1694 { 1695 Result = (Result * 10) + (*string - '0'); 1696 } 1697 *NextString = string; 1698 if (Sign >= 0) 1699 return (Result); 1700 else 1701 return (-Result); 1702 }
Note: See TracChangeset
for help on using the changeset viewer.