r11859: Canonicalize whitespace
[ctsim.git] / src / graph3dview.cpp
index 24444e718417d584f03c7ed0301a374ad2797d1c..9d27729bcd41f9d22d1f2ed7f069377baab2a1fc 100644 (file)
 #include <sstream_subst>
 #endif
 
-inline void 
+inline void
 Graph3dFileView::intensityToColor (double dIntensity, GLfloat* vecColor)
 {
   if (dIntensity < 0 || dIntensity > 1) {
     vecColor[0] = vecColor[1] = vecColor[2] = 1;
     return;
   }
-  
+
   float fRange = dIntensity * 5;
   int iRange = static_cast<int>(floor (fRange));
   float fFrac = fRange - iRange;
-  
+
   // Rainbow: Purple->Blue->Cyan->Green->Yellow->Red = (1,0,1)-(0,0,1)-(0,1,1)-(0,1,0)-(1,1,0)-(1,0,0)
   switch (iRange) {
   case 0:
@@ -113,7 +113,7 @@ Graph3dFileView::intensityToColor (double dIntensity, GLfloat* vecColor)
 //*************************************************************************
 
 template<class T>
-static void 
+static void
 CalculateVectorNormal (T fVert1[], T fVert2[], T fVert3[], T *fNormalX, T *fNormalY, T *fNormalZ)
 {
   T Qx = fVert2[0] - fVert1[0];
@@ -122,11 +122,11 @@ CalculateVectorNormal (T fVert1[], T fVert2[], T fVert3[], T *fNormalX, T *fNorm
   T Px = fVert3[0] - fVert1[0];
   T Py = fVert3[1] - fVert1[1];
   T Pz = fVert3[2] - fVert1[2];
-  
+
   *fNormalX = Py*Qz - Pz*Qy;
   *fNormalY = Pz*Qx - Px*Qz;
   *fNormalZ = Px*Qy - Py*Qx;
-} 
+}
 
 IMPLEMENT_DYNAMIC_CLASS(Graph3dFileView, wxView)
 
@@ -142,9 +142,9 @@ EVT_MENU(GRAPH3D_VIEW_SCALE_FULL, Graph3dFileView::OnScaleFull)
 END_EVENT_TABLE()
 
 Graph3dFileView::Graph3dFileView ()
-  : m_pFileMenu(NULL), m_pViewMenu(NULL), m_pStatusBar(NULL), m_pCanvas(NULL), 
-    m_dXRotate(-180), m_dYRotate(-210), m_dZRotate(195), 
-    m_bDoubleBuffer(true), m_bSmooth(true), m_bWireframe(false), 
+  : m_pFileMenu(NULL), m_pViewMenu(NULL), m_pStatusBar(NULL), m_pCanvas(NULL),
+    m_dXRotate(-180), m_dYRotate(-210), m_dZRotate(195),
+    m_bDoubleBuffer(true), m_bSmooth(true), m_bWireframe(false),
     m_bLighting(false), m_bColor(true), m_bUseVertexArrays(false),
     m_bColorScaleMinSet(false), m_bColorScaleMaxSet(false),
     m_pFrame(NULL)
@@ -157,7 +157,7 @@ Graph3dFileView::~Graph3dFileView()
   GetDocumentManager()->ActivateView(this, false, true);
 }
 
-bool 
+bool
 Graph3dFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) )
 {
   m_pFrame = CreateChildFrame(doc, this);
@@ -168,8 +168,8 @@ Graph3dFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) )
   m_pCanvas->SetClientSize (m_pCanvas->GetBestSize());
   m_pFrame->SetTitle("Graph3dFileView");
 
-  m_pCanvas->SetCurrent();  
-  InitGL();  
+  m_pCanvas->SetCurrent();
+  InitGL();
   m_pCanvas->SwapBuffers();
 
   m_pViewMenu->Check (GRAPH3D_VIEW_COLOR, m_bColor);
@@ -180,18 +180,18 @@ Graph3dFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) )
   m_pFrame->SetFocus();
   m_pFrame->Show(true);
   Activate(true);
-  
+
   return true;
-} 
+}
 
-Graph3dFileCanvas* 
+Graph3dFileCanvas*
 Graph3dFileView::CreateCanvas (wxFrame* parent)
 {
   Graph3dFileCanvas* pCanvas = new Graph3dFileCanvas (this, parent, wxPoint(-1,-1), wxSize(-1,-1), 0);
-  
+
   pCanvas->SetBackgroundColour(*wxWHITE);
   pCanvas->Clear();
-  
+
   return pCanvas;
 }
 
@@ -201,19 +201,19 @@ Graph3dFileView::DrawSurface()
 {
   if (! GetDocument())
     return;
-  
+
   if (m_bSmooth) {
     glShadeModel (GL_SMOOTH);
   } else {
     glShadeModel (GL_FLAT);
   }
-  
+
   if (m_bLighting) {
     glEnable (GL_LIGHTING);
   } else {
     glDisable (GL_LIGHTING);
   }
-  
+
   unsigned int nx = GetDocument()->nx();
   unsigned int ny = GetDocument()->ny();
 
@@ -222,7 +222,7 @@ Graph3dFileView::DrawSurface()
   glRotated (m_dYRotate, 1.0, 0.0, 0.0);
   glTranslated (-static_cast<double>(nx - 1) / 2, 0.0, -static_cast<double>(ny - 1) / 2);
 
-  InitMaterials();   
+  InitMaterials();
   if (m_bWireframe) {
     if (! m_bColor)
       glColor3f (1.0f, 1.0f, 1.0f);
@@ -249,7 +249,7 @@ Graph3dFileView::DrawSurface()
       glCallList (DISPLAYLIST_COLOR);
     }
   }
-  
+
 }
 
 void
@@ -257,15 +257,15 @@ Graph3dFileView::CreateDisplayList()
 {
   if (! GetDocument())
     return;
-  
+
   unsigned int nx = GetDocument()->nx();
   unsigned int ny = GetDocument()->ny();
   const ImageFileArrayConst v = GetDocument()->getArray();
   if (nx == 0 || ny == 0 || ! v)
     return;
-  
+
   glNewList (DISPLAYLIST_COLOR, GL_COMPILE);
-  
+
   double dMin = m_dColorScaleMin;
   double dIntensityScale = m_dColorScaleMax - m_dColorScaleMin;
   double actOffset = m_dGraphMin;
@@ -280,9 +280,9 @@ Graph3dFileView::CreateDisplayList()
   for (ix = 0; ix < nx - 1; ix++, dXPos++) {
     double dYPos = -dYOffset;
     glBegin(GL_QUAD_STRIP);
-    double p1[3], p2[3], p3[3], n1[3]; 
+    double p1[3], p2[3], p3[3], n1[3];
     p1[0] = dXPos;  p1[1] = actScale * (v[ix][0] + actOffset); p1[2] = dYPos;
-    p2[0] = dXPos+1; p2[1] = actScale * (v[ix+1][0] + actOffset); p2[2] = dYPos; 
+    p2[0] = dXPos+1; p2[1] = actScale * (v[ix+1][0] + actOffset); p2[2] = dYPos;
     p3[0] = dXPos; p3[1] = actScale * (v[ix][1] + actOffset); p3[2] = dYPos + 1;
     CalculateVectorNormal<double> (p1, p2, p3, &n1[0], &n1[1], &n1[2]);
 
@@ -296,33 +296,33 @@ Graph3dFileView::CreateDisplayList()
       intensityToColor (dIntensity1, vecColor);
       glColor3fv (vecColor);
     }
-    glVertex3dv (p1); glNormal3dv (n1);                                        
+    glVertex3dv (p1); glNormal3dv (n1);
     if (m_bColor) {
       intensityToColor (dIntensity2, vecColor);
       glColor3fv (vecColor);
     }
-    glVertex3dv (p2); glNormal3dv (n1);                                        
+    glVertex3dv (p2); glNormal3dv (n1);
 
     double lastP[3];
-    lastP[0] = ix; lastP[1] = actScale * (v[ix][0] + actOffset); lastP[2] = 0; 
-    for (unsigned int iy = 1; iy < ny - 1; iy++, dYPos++) {       
+    lastP[0] = ix; lastP[1] = actScale * (v[ix][0] + actOffset); lastP[2] = 0;
+    for (unsigned int iy = 1; iy < ny - 1; iy++, dYPos++) {
       p1[0] = dXPos; p1[1] = actScale * (v[ix][iy] + actOffset); p1[2] = dYPos;
       p2[0] = dXPos+1;  p2[1] = actScale * (v[ix+1][iy] + actOffset); p2[2] = dYPos;
       CalculateVectorNormal (p1, p2, lastP, &n1[0], &n1[1], &n1[2]);
       lastP[0] = p1[0]; lastP[1] = p1[1]; lastP[2] = p1[2];
       if (m_bColor) {
-       dIntensity1 = (v[ix][iy] - dMin) / dIntensityScale;
-       dIntensity2 = (v[ix+1][iy] - dMin) / dIntensityScale;
-       intensityToColor (dIntensity1, vecColor);
-       glColor3fv (vecColor);
+        dIntensity1 = (v[ix][iy] - dMin) / dIntensityScale;
+        dIntensity2 = (v[ix+1][iy] - dMin) / dIntensityScale;
+        intensityToColor (dIntensity1, vecColor);
+        glColor3fv (vecColor);
       }
-      glVertex3dv (p1); glNormal3dv (n1);              
+      glVertex3dv (p1); glNormal3dv (n1);
       if (m_bColor) {
-       intensityToColor (dIntensity2, vecColor);
-       glColor3fv (vecColor);
+        intensityToColor (dIntensity2, vecColor);
+        glColor3fv (vecColor);
       }
       glVertex3dv (p2); glNormal3dv (n1);
-    }                  
+    }
     glEnd(); // QUAD_STRIP
   }
   glEndList();
@@ -333,26 +333,26 @@ Graph3dFileView::CreateDisplayList()
   for (ix = 0; ix < nx - 1; ix++, dXPos++) {
     double dYPos = -dYOffset;
     glBegin(GL_QUAD_STRIP);
-    double p1[3], p2[3], p3[3], n1[3]; 
+    double p1[3], p2[3], p3[3], n1[3];
     p1[0] = dXPos;  p1[1] = actScale * (v[ix][0] + actOffset); p1[2] = dYPos;
-    p2[0] = dXPos+1; p2[1] = actScale * (v[ix+1][0] + actOffset); p2[2] = dYPos; 
+    p2[0] = dXPos+1; p2[1] = actScale * (v[ix+1][0] + actOffset); p2[2] = dYPos;
     p3[0] = dXPos; p3[1] = actScale * (v[ix][1] + actOffset); p3[2] = dYPos + 1;
     CalculateVectorNormal<double> (p1, p2, p3, &n1[0], &n1[1], &n1[2]);
 
-    glVertex3dv (p1); 
-    glNormal3dv (n1);                                  
-    glVertex3dv (p2); 
-    glNormal3dv (n1);                                  
+    glVertex3dv (p1);
+    glNormal3dv (n1);
+    glVertex3dv (p2);
+    glNormal3dv (n1);
     double lastP[3];
-    lastP[0] = ix; lastP[1] = actScale * (v[ix][0] + actOffset); lastP[2] = 0; 
-    for (unsigned int iy = 1; iy < ny - 1; iy++, dYPos++) {       
+    lastP[0] = ix; lastP[1] = actScale * (v[ix][0] + actOffset); lastP[2] = 0;
+    for (unsigned int iy = 1; iy < ny - 1; iy++, dYPos++) {
       p1[0] = dXPos; p1[1] = actScale * (v[ix][iy] + actOffset); p1[2] = dYPos;
       p2[0] = dXPos+1;  p2[1] = actScale * (v[ix+1][iy] + actOffset); p2[2] = dYPos;
        CalculateVectorNormal (p1, p2, lastP, &n1[0], &n1[1], &n1[2]);
       lastP[0] = p1[0]; lastP[1] = p1[1]; lastP[2] = p1[2];
-      glVertex3dv (p1); glNormal3dv (n1);                                      
-      glVertex3dv (p2); glNormal3dv (n1);                                      
-    }                  
+      glVertex3dv (p1); glNormal3dv (n1);
+      glVertex3dv (p2); glNormal3dv (n1);
+    }
     glEnd(); // QUAD_STRIP
   }
   glEndList();
@@ -364,8 +364,8 @@ Graph3dFileView::OnProperties (wxCommandEvent& event)
 {
   std::ostringstream os;
   *theApp->getLog() << ">>>>\n" << os.str().c_str() << "<<<<\n";
-  wxMessageDialog dialogMsg (getFrameForChild(), os.str().c_str(), 
-                            "Imagefile Properties", wxOK | wxICON_INFORMATION);
+  wxMessageDialog dialogMsg (getFrameForChild(), os.str().c_str(),
+                             "Imagefile Properties", wxOK | wxICON_INFORMATION);
   dialogMsg.ShowModal();
 }
 
@@ -403,13 +403,13 @@ Graph3dFileView::OnSmooth (wxCommandEvent& event)
 
 
 
-void 
+void
 Graph3dFileView::OnDraw (wxDC* dc)
 {
   if (m_pCanvas) {
     m_pCanvas->SetCurrent();
 #ifdef DEBUG
-       *theApp->getLog() << "Drawing 3d surface\n";
+        *theApp->getLog() << "Drawing 3d surface\n";
 #endif
     Draw();
     m_pCanvas->SwapBuffers();
@@ -417,19 +417,19 @@ Graph3dFileView::OnDraw (wxDC* dc)
 
   if (m_pStatusBar) {
     std::ostringstream os;
-    os << "Xangle=" << m_dXRotate << ", Yangle=" << m_dYRotate 
+    os << "Xangle=" << m_dXRotate << ", Yangle=" << m_dYRotate
        << ", Zangle=" << m_dZRotate;
     m_pStatusBar->SetStatusText (os.str().c_str());
   }
 }
 
 
-void 
+void
 Graph3dFileView::Draw ()
 {
   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
   glPushMatrix();
-  DrawSurface();  
+  DrawSurface();
   glPopMatrix();
   glFlush();
 }
@@ -442,7 +442,7 @@ Graph3dFileView::InitMaterials()
     return;
   int nx = GetDocument()->nx();
   int ny = GetDocument()->ny();
-  
+
 #if 1
   static float position0[] = {nx/2, ny*2, -ny*2, 0.0f,};
   static float ambient0[] = {.1f, .1f, .1f, 1.0f};
@@ -460,138 +460,138 @@ Graph3dFileView::InitMaterials()
   static float back_mat_diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};
   static float lmodel_ambient[] = {1.0f, 1.0f, 1.0f, 1.0f};
   static float lmodel_twoside[] = {GL_TRUE};
-  
+
   //glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
   glHint(GL_LINE_SMOOTH, GL_DONT_CARE);
   glEnable(GL_NORMALIZE);
-  
+
   glLightfv (GL_LIGHT0, GL_AMBIENT, ambient0);
   glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse0);
   glLightfv (GL_LIGHT0, GL_POSITION, position0);
   glEnable (GL_LIGHT0);
-  
+
   glLightfv (GL_LIGHT1, GL_AMBIENT, ambient1);
   glLightfv (GL_LIGHT1, GL_DIFFUSE, diffuse1);
   glLightfv (GL_LIGHT1, GL_POSITION, position1);
   glEnable (GL_LIGHT1);
-  
+
   glLightModelfv (GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
   glLightModelfv (GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
-  
+
   glMaterialfv (GL_FRONT_AND_BACK, GL_SHININESS, front_mat_shininess);
   glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, front_mat_specular);
   glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, front_mat_diffuse);
   glMaterialfv (GL_BACK, GL_SHININESS, back_mat_shininess);
   glMaterialfv (GL_BACK, GL_SPECULAR, back_mat_specular);
   glMaterialfv (GL_BACK, GL_DIFFUSE, back_mat_diffuse);
-  
+
   glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE);
   glColorMaterial (GL_FRONT_AND_BACK, GL_SPECULAR);
   glEnable(GL_COLOR_MATERIAL);
 #else
   GLfloat impLPos[]  = {1.0f, 1.0f, 1.0f, 0.0f};
-  
+
   GLfloat defaultLightAmb   [] = {.2f, .2f, .2f, 1.0f};
   GLfloat defaultLightDiff  [] = {.2f, .2f, .2f, 1.0f};
   GLfloat defaultLightSpec  [] = { .3f, .3f, .3f, 1.0f};
-  
+
   GLfloat defaultGlobalAmb [] = {.3f, .3f, .3f, 1.0f};
   GLfloat defaultGlobalDiff[] = {.3f, .3f, .3f, 1.0f};
-  
+
   GLfloat defaultMatShine[] = {  30.0f };
   GLfloat defaultMatSpec[]  = { .4f, .4f, .4f, 1.0f};
   GLfloat defaultMatAmb[]   = { .3f, .3f, .3f, 1.0f};
   GLfloat defaultMatDiff[]  = { .5f, .5f, .5f, 1.0f};
-  
+
   GLfloat brassMatAmb[]   = { .33f, .22f, .03f, 1.0f};
   GLfloat brassMatDiff[]  = { .78f, .57f, .11f, 1.0f};
   GLfloat brassMatSpec[]  = { .99f, .91f, .81f, 1.0f};
   GLfloat brassMatShine[] = {  27.8f };
-  
+
   GLfloat emeraldMatAmb[]   = { .02f1, .1745f , .021f, 1.0f };
   GLfloat emeraldMatDiff[]  = { .075f, .6142f , .075f, 1.0f };
   GLfloat emeraldMatSpec[]  = { .633f, .7278f , .633f, 1.0f };
   GLfloat emeraldMatShine[] = {  76.8f };
-  
+
   GLfloat slateMatAmb[]   = { .02f, .02f , .02f, 1.0f };
   GLfloat slateMatDiff[]  = { .02f, .01f , .01f, 1.0f };
   GLfloat slateMatSpec[]  = { .4f,  .4f ,  .4f , 1.0f };
   GLfloat slateMatShine[] = { .768f };
-  
+
   //       double opnX = nx, opnY = ny, opnZ = z;
   //       eyeX = 1; eyeY = 1, eyeZ = 1;
-  
+
   impLPos[0] = nx/2.; impLPos[1]= ny/2.; impLPos[2] = 0.;
   //opnListNum = 1;
   //impGraphicsFlag = IMP__3D;
-  
+
   //       glutInitDisplayMode (GLUT_DOUBLE| GLUT_RGB | GLUT_DEPTH | GLUT_ACCUM);
   //       glutInitWindowSize (IMP_WIN_X, IMP_WIN_Y);
   //  glutInitWindowPosition (100, 100);
   //       glutCreateWindow ("- imp3D graphics -" );
-  
+
   glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
-  
+
   glShadeModel (GL_SMOOTH);
   glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
   glHint(GL_LINE_SMOOTH, GL_DONT_CARE);
   glEnable(GL_NORMALIZE);
-  
-  
+
+
   glEnable(GL_DEPTH_TEST);
-  
+
   glLightfv(GL_LIGHT0, GL_AMBIENT, defaultLightAmb);
   glLightfv(GL_LIGHT0, GL_DIFFUSE, defaultLightDiff);
   glLightfv(GL_LIGHT0, GL_SPECULAR,defaultLightSpec);
-  
+
   glLightfv(GL_LIGHT1, GL_AMBIENT, defaultLightAmb);
   glLightfv(GL_LIGHT1, GL_DIFFUSE, defaultLightDiff);
   glLightfv(GL_LIGHT1, GL_SPECULAR,defaultLightSpec);
-  
+
   glLightfv(GL_LIGHT2, GL_AMBIENT , defaultLightAmb);
   glLightfv(GL_LIGHT2, GL_DIFFUSE , defaultLightDiff);
   glLightfv(GL_LIGHT2, GL_SPECULAR, defaultLightSpec);
-  
+
   glLightfv(GL_LIGHT0, GL_POSITION,impLPos);
   glLightfv(GL_LIGHT1, GL_POSITION,impLPos);
   glLightfv(GL_LIGHT2, GL_POSITION,impLPos);
-  
+
   glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT  , defaultMatAmb);
   glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE  , defaultMatDiff);
   glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR , defaultMatSpec);
   glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, defaultMatShine);
-  
+
   glLightModelfv(GL_LIGHT_MODEL_AMBIENT, defaultGlobalAmb);
-  
+
   glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
-  
+
   glEnable(GL_COLOR_MATERIAL);
-  
+
   glEnable(GL_LIGHTING);
   glEnable(GL_LIGHT1);
   glEnable(GL_LIGHT2);
   glEnable(GL_LIGHT0);
 #endif
-  
+
 }
 
 
-void 
+void
 Graph3dFileView::InitGL ()
 {
   glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
-  
+
   glDisable (GL_CULL_FACE);
   glEnable (GL_DEPTH_TEST);
-  
+
 }
 
-void 
+void
 Graph3dFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
 {
   if (! GetDocument())
     return;
-  
+
   unsigned int nx = GetDocument()->nx();
   unsigned int ny = GetDocument()->ny();
   const ImageFileArrayConst v = GetDocument()->getArray();
@@ -611,7 +611,7 @@ Graph3dFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
       if (! m_bColorScaleMinSet)
         m_dColorScaleMin = min;
       if (! m_bColorScaleMaxSet)
-        m_dColorScaleMax = max;  
+        m_dColorScaleMax = max;
   }
   double dRadius = maxValue<int> (nx, ny) * SQRT2 / 2;
 
@@ -621,7 +621,7 @@ Graph3dFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   glOrtho (-dRadius, dRadius, -dRadius, dRadius, dRadius*5, -dRadius*5);
-  
+
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
 #if 0
@@ -631,21 +631,21 @@ Graph3dFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
   up[0] = 0; up[1] = 1; up[2] = 0;
   gluLookAt (eyep[0], eyep[1], eyep[2], lookp[0], lookp[1], lookp[2], up[0], up[1], up[2]);
 #endif
-  
+
   CreateDisplayList();
 
   if (m_pCanvas) {
-       m_pCanvas->SwapBuffers();
+        m_pCanvas->SwapBuffers();
     m_pCanvas->Refresh();
   }
 }
 
-bool 
+bool
 Graph3dFileView::OnClose (bool deleteWindow)
 {
   if (! GetDocument() || ! GetDocument()->Close())
     return false;
-  
+
   Activate (false);
   if (m_pCanvas) {
     m_pCanvas->setView(NULL);
@@ -654,20 +654,20 @@ Graph3dFileView::OnClose (bool deleteWindow)
   wxString s(theApp->GetAppName());
   if (m_pFrame)
     m_pFrame->SetTitle(s);
-  
+
   SetFrame(NULL);
-  
+
   if (deleteWindow) {
     delete m_pFrame;
     m_pFrame = NULL;
     if (GetDocument() && GetDocument()->getBadFileOpen())
       ::wxYield();  // wxWindows bug workaround
   }
-  
+
   return true;
 }
 
-void 
+void
 Graph3dFileView::setInitialClientSize ()
 {
   if (m_pFrame && m_pCanvas) {
@@ -677,9 +677,9 @@ Graph3dFileView::setInitialClientSize ()
     m_pFrame->Show (true);
     m_pFrame->SetFocus();
   }
-}  
+}
 
-void 
+void
 Graph3dFileView::OnScaleAuto (wxCommandEvent& event)
 {
 #if 0
@@ -702,12 +702,12 @@ Graph3dFileView::OnScaleAuto (wxCommandEvent& event)
 #endif
 }
 
-void 
+void
 Graph3dFileView::OnScaleSet (wxCommandEvent& event)
 {
   if (! GetDocument())
     return;
-  
+
   unsigned int nx = GetDocument()->nx();
   unsigned int ny = GetDocument()->ny();
   const ImageFileArrayConst v = GetDocument()->getArray();
@@ -725,7 +725,7 @@ Graph3dFileView::OnScaleSet (wxCommandEvent& event)
     dMin = m_dColorScaleMin;
   if (m_bColorScaleMaxSet)
     dMax = m_dColorScaleMax;
-  
+
   DialogGetMinMax dialogMinMax (getFrameForChild(), "Set Color Scale Minimum & Maximum", dMin, dMax);
   int retVal = dialogMinMax.ShowModal();
   if (retVal == wxID_OK) {
@@ -737,7 +737,7 @@ Graph3dFileView::OnScaleSet (wxCommandEvent& event)
   }
 }
 
-void 
+void
 Graph3dFileView::OnScaleFull (wxCommandEvent& event)
 {
   if (m_bColorScaleMinSet || m_bColorScaleMaxSet) {
@@ -760,24 +760,24 @@ Graph3dFileView::CreateChildFrame (wxDocument *doc, wxView *view)
   wxDocChildFrame* subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "Graph3dFile Frame", wxPoint(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
 #endif
   theApp->setIconForFrame (subframe);
-  
+
 // status bar text not showing tested with enlightenment. disabling for now...
-#if 0 
+#if 0
   m_pStatusBar = new wxStatusBar (subframe, -1);
   subframe->SetStatusBar (m_pStatusBar);
   m_pStatusBar->Show(true);
 #endif
 
   m_pFileMenu = new wxMenu;
-  
+
   m_pFileMenu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom...\tCtrl-P");
   m_pFileMenu->Append(MAINMENU_FILE_CREATE_FILTER, "Create &Filter...\tCtrl-F");
   m_pFileMenu->Append(wxID_OPEN, "&Open...\tCtrl-O");
   m_pFileMenu->Append(wxID_CLOSE, "&Close\tCtrl-W");
-  
+
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append(IFMENU_FILE_PROPERTIES, "P&roperties");
-  
+
   m_pFileMenu->AppendSeparator();
   m_pFileMenu->Append(wxID_PRINT, "&Print...");
   m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
@@ -788,7 +788,7 @@ Graph3dFileView::CreateChildFrame (wxDocument *doc, wxView *view)
 
   GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
   GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);
-  
+
   m_pViewMenu = new wxMenu;
   m_pViewMenu->Append(GRAPH3D_VIEW_WIREFRAME, "Wi&reframe\tCtrl-R", "", true);
   m_pViewMenu->Append(GRAPH3D_VIEW_SMOOTH, "S&mooth\tCtrl-M", "", true);
@@ -798,20 +798,20 @@ Graph3dFileView::CreateChildFrame (wxDocument *doc, wxView *view)
   m_pViewMenu->Append(GRAPH3D_VIEW_SCALE_MINMAX, "Color Scale S&et Min/Max...\tCtrl-E");
   m_pViewMenu->Append(GRAPH3D_VIEW_SCALE_AUTO, "Color Scale &Auto...\tCtrl-A");
   m_pViewMenu->Append(GRAPH3D_VIEW_SCALE_FULL, "Color F&ull Scale\tCtrl-U");
-  
-  
+
+
   wxMenu *help_menu = new wxMenu;
   help_menu->Append(MAINMENU_HELP_CONTENTS, "&Contents\tF1");
   help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
-  
+
   wxMenuBar *menu_bar = new wxMenuBar;
-  
+
   menu_bar->Append(m_pFileMenu, "&File");
   menu_bar->Append(m_pViewMenu, "&View");
   menu_bar->Append(help_menu, "&Help");
-  
+
   subframe->SetMenuBar(menu_bar);
-  
+
   subframe->Centre(wxBOTH);
 
   wxAcceleratorEntry accelEntries[7];
@@ -841,13 +841,13 @@ END_EVENT_TABLE()
 
 
 
-Graph3dFileCanvas::Graph3dFileCanvas (Graph3dFileView* view, wxWindow *parent, const wxPoint& pos, 
+Graph3dFileCanvas::Graph3dFileCanvas (Graph3dFileView* view, wxWindow *parent, const wxPoint& pos,
                                       const wxSize& size, long style)
   : wxGLCanvas (parent, -1, pos, size, style), m_pView(view)
 {
 //  parent->Show (true);
 #if 0
-  // Make sure server supports the vertex array extension 
+  // Make sure server supports the vertex array extension
   char* extensions = (char *) glGetString( GL_EXTENSIONS );
   if (!extensions || !strstr( extensions, "GL_EXT_vertex_array" )) {
     m_pView->m_bUseVertexArrays = GL_FALSE;
@@ -860,7 +860,7 @@ Graph3dFileCanvas::~Graph3dFileCanvas()
 {
 }
 
-void 
+void
 Graph3dFileCanvas::OnPaint (wxPaintEvent& event)
 {
   wxPaintDC dc(this);
@@ -875,28 +875,28 @@ Graph3dFileCanvas::GetBestSize() const
   return wxSize (400,400);
 }
 
-void 
+void
 Graph3dFileCanvas::OnSize (wxSizeEvent& event)
 {
 #ifndef __WXMOTIF__
   // if (!GetContext()) return;
 #endif
-  
+
   int width, height;
   GetClientSize (&width, &height);
   Reshape (width, height);
 }
 
-void 
+void
 Graph3dFileCanvas::OnChar(wxKeyEvent& event)
 {
   if (! m_pView)
     return;
-  
+
   wxCommandEvent dummyEvent;
   switch (event.KeyCode()) {
   case WXK_LEFT:
-       m_pView->m_dZRotate += 15.0;
+        m_pView->m_dZRotate += 15.0;
     Refresh (false);
     break;
   case WXK_RIGHT:
@@ -946,15 +946,15 @@ Graph3dFileCanvas::Reshape (int width, int height)
 }
 
 
-void 
+void
 Graph3dFileCanvas::OnMouseEvent(wxMouseEvent& event)
 {
   static int dragging = 0;
   static float last_x, last_y;
-  
+
   if (! m_pView)
     return;
-  
+
   if(event.LeftIsDown()) {
     if(! dragging) {
       dragging = 1;
@@ -969,7 +969,7 @@ Graph3dFileCanvas::OnMouseEvent(wxMouseEvent& event)
     dragging = 0;
 }
 
-void 
+void
 Graph3dFileCanvas::OnEraseBackground(wxEraseEvent& event)
 {
   // Do nothing: avoid flashing.