Ignore:
Timestamp:
Aug 19, 2009, 3:47:49 PM (15 years ago)
Author:
garnier
Message:

update

Location:
trunk/source/visualization/OpenInventor
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/visualization/OpenInventor/History

    r1090 r1097  
    2020History file for visualization/OpenInventor
    2121-------------------------------------------
     22
     2318 August 2009 Laurent Garnier
     24 - G4OpenInventorXt/WinViewer : Fix a wrong initialization introduce by the
     25   new way of handling window size hints (January 2009)
    2226
    232724 July 2009, Laurent Garnier
  • trunk/source/visualization/OpenInventor/include/G4OpenInventorWinViewer.hh

    r954 r1097  
    5555                       const G4String& name = "");
    5656  virtual ~G4OpenInventorWinViewer();
     57  void Initialise();
     58
    5759private:
    5860  static LRESULT CALLBACK WindowProc(HWND,UINT,WPARAM,LPARAM);
  • trunk/source/visualization/OpenInventor/include/G4OpenInventorXtViewer.hh

    r954 r1097  
    5353  G4OpenInventorXtViewer(G4OpenInventorSceneHandler& scene,
    5454                         const G4String& name = "");
     55  void Initialise();
     56
    5557  virtual ~G4OpenInventorXtViewer();
    5658private:
  • trunk/source/visualization/OpenInventor/src/G4OpenInventorWinViewer.cc

    r954 r1097  
    6565};
    6666
    67 #define SIZE 600
    6867// File :
    6968#define ID_FILE_POSTSCRIPT 1
     
    9897  G4cout << "Window name: " << fName << G4endl;
    9998
     99}
     100
     101
     102void G4OpenInventorWinViewer::Initialise() {
     103
    100104  G4String wName = fName;
     105
     106  int width = 600;
     107  int height = 600;
    101108
    102109  HWND parent = (HWND)fInteractorManager->GetParentInteractor ();
     
    122129      done = TRUE;
    123130    }
    124 
     131   
     132    G4String sgeometry = fVP.GetXGeometryString();
     133    if(sgeometry.empty()) {
     134      G4cout << "ERROR: Geometry string \""
     135             << sgeometry         
     136             << "\" is empty.  Using \"600x600\"."
     137             << G4endl;
     138      width = 600;
     139      height = 600; 
     140      sprintf(s,"%dx%d",width,height);
     141      sgeometry = s;
     142    } else {
     143      width = fVP.GetWindowSizeHintX();
     144      height = fVP.GetWindowSizeHintX();
     145    }
     146   
    125147    HMENU menuBar = CreateMenu();
    126148
     
    157179                            WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
    158180                            CW_USEDEFAULT, CW_USEDEFAULT,
    159                             SIZE,SIZE,
     181                            width,height,
    160182                            0,menuBar,::GetModuleHandle(0),0);
    161183    // Retreive window and client sizez :
     
    167189    int cw = crect.right-crect.left;
    168190    int ch = crect.bottom-crect.top;
    169     // Compell client rect to be SIZE SIZE :
    170     MoveWindow((HWND)fShell,wrect.left,wrect.top,SIZE+ww-cw,SIZE+wh-ch,TRUE);
     191    // Compell client rect to be width height :
     192    MoveWindow((HWND)fShell,wrect.left,wrect.top,width+ww-cw,height+wh-ch,TRUE);
    171193    ::SetWindowLong((HWND)fShell,GWL_USERDATA,LONG(this));
    172194    ::SetWindowText((HWND)fShell,shellName.c_str());
     
    184206  fViewer->setGLRenderAction(fGL2PSAction);
    185207
    186   fViewer->setSize(SbVec2s(SIZE,SIZE));
     208  fViewer->setSize(SbVec2s(width,height));
    187209  fViewer->setSceneGraph(fSoSelection);
    188210  fViewer->viewAll();
  • trunk/source/visualization/OpenInventor/src/G4OpenInventorXtViewer.cc

    r954 r1097  
    7676{
    7777  G4cout << "Window name: " << fName << G4endl;
    78 
     78}
     79
     80
     81void G4OpenInventorXtViewer::Initialise() {
     82 
    7983  G4String wName = fName;
    80 
    81 #define SIZE 600
     84 
    8285  Widget parent = (Widget)fInteractorManager->GetParentInteractor ();
     86  int width = 600;
     87  int height = 600;
     88
    8389  if(!parent) { 
    8490    // Check if user has specified an X-Windows-type geometry string...
    8591    char s[32];
    86     sprintf(s,"%dx%d",SIZE,SIZE);
     92
    8793    G4String sgeometry = fVP.GetXGeometryString();
    88     if(sgeometry.empty()) sgeometry = s;
     94    if(sgeometry.empty()) {
     95      G4cout << "ERROR: Geometry string \""
     96             << sgeometry         
     97             << "\" is empty.  Using \"600x600\"."
     98             << G4endl;
     99      width = 600;
     100      height = 600; 
     101      sprintf(s,"%dx%d",width,height);
     102      sgeometry = s;
     103    } else {
     104      width = fVP.GetWindowSizeHintX();
     105      height = fVP.GetWindowSizeHintX();
     106    }
    89107
    90108    //Create a shell window :
     
    167185  }
    168186
    169   fViewer->setSize(SbVec2s(SIZE,SIZE));
     187  fViewer->setSize(SbVec2s(width,height));
    170188
    171189  // Have a GL2PS render action :
Note: See TracChangeset for help on using the changeset viewer.