** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: graph3dview.cpp,v 1.10 2001/02/04 21:28:19 kevin Exp $
+** $Id: graph3dview.cpp,v 1.29 2002/06/27 03:19:23 kevin Exp $
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
#pragma interface
#endif
-// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <sstream_subst>
#endif
-void
+inline void
Graph3dFileView::intensityToColor (double dIntensity, GLfloat* vecColor)
{
if (dIntensity < 0 || dIntensity > 1) {
// fNormalZ == Z vector for the normal vector
//*************************************************************************
-void
-CalculateVectorNormal (GLfloat fVert1[], GLfloat fVert2[],
- GLfloat fVert3[], GLfloat *fNormalX,
- GLfloat *fNormalY, GLfloat *fNormalZ)
+template<class T>
+static void
+CalculateVectorNormal (T fVert1[], T fVert2[], T fVert3[], T *fNormalX, T *fNormalY, T *fNormalZ)
{
- GLfloat Qx = fVert2[0] - fVert1[0];
- GLfloat Qy = fVert2[1] - fVert1[1];
- GLfloat Qz = fVert2[2] - fVert1[2];
- GLfloat Px = fVert3[0] - fVert1[0];
- GLfloat Py = fVert3[1] - fVert1[1];
- GLfloat Pz = fVert3[2] - fVert1[2];
+ T Qx = fVert2[0] - fVert1[0];
+ T Qy = fVert2[1] - fVert1[1];
+ T Qz = fVert2[2] - fVert1[2];
+ 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;
-
-}
-
-void
-CalculateVectorNormal (GLdouble fVert1[], GLdouble fVert2[],
- GLdouble fVert3[], GLdouble *fNormalX,
- GLdouble *fNormalY, GLdouble *fNormalZ)
-{
- GLdouble Qx = fVert2[0] - fVert1[0];
- GLdouble Qy = fVert2[1] - fVert1[1];
- GLdouble Qz = fVert2[2] - fVert1[2];
- GLdouble Px = fVert3[0] - fVert1[0];
- GLdouble Py = fVert3[1] - fVert1[1];
- GLdouble 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)
EVT_MENU(GRAPH3D_VIEW_LIGHTING, Graph3dFileView::OnLighting)
EVT_MENU(GRAPH3D_VIEW_COLOR, Graph3dFileView::OnColor)
EVT_MENU(GRAPH3D_VIEW_SMOOTH, Graph3dFileView::OnSmooth)
-EVT_MENU(GRAPH3D_VIEW_SURFACE, Graph3dFileView::OnSurface)
+EVT_MENU(GRAPH3D_VIEW_WIREFRAME, Graph3dFileView::OnWireframe)
EVT_MENU(GRAPH3D_VIEW_SCALE_MINMAX, Graph3dFileView::OnScaleSet)
EVT_MENU(GRAPH3D_VIEW_SCALE_AUTO, Graph3dFileView::OnScaleAuto)
EVT_MENU(GRAPH3D_VIEW_SCALE_FULL, Graph3dFileView::OnScaleFull)
END_EVENT_TABLE()
Graph3dFileView::Graph3dFileView ()
-: m_pFileMenu(NULL), m_pViewMenu(NULL)
-{
- m_bDoubleBuffer = true;
- m_bSmooth = true;
- m_bLighting = true;
- m_bSurface = true;
- m_bLighting = true;
- m_bColor = false;
- m_dXRotate = -45;
- m_dYRotate = 0;
- m_dZRotate = -45;
- m_bColorScaleMinSet = false;
- m_bColorScaleMaxSet = 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(true), m_bColor(true), m_bUseVertexArrays(false),
+ m_bColorScaleMinSet(false), m_bColorScaleMaxSet(false),
+ m_pFrame(NULL)
+{}
+
Graph3dFileView::~Graph3dFileView()
{
Graph3dFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) )
{
m_pFrame = CreateChildFrame(doc, this);
- (m_pFrame);
-
- int width, height;
- m_pFrame->GetClientSize (&width, &height);
- m_pFrame->SetTitle("Graph3dFileView");
m_pCanvas = CreateCanvas (m_pFrame);
-
- m_pFrame->Show (true);
+
+ m_pFrame->SetClientSize (m_pCanvas->GetBestSize());
+ SetFrame (m_pFrame);
+ m_pCanvas->SetClientSize (m_pCanvas->GetBestSize());
+ m_pFrame->SetTitle("Graph3dFileView");
+
m_pCanvas->SetCurrent();
InitGL();
- int x, y; // X requires a forced resize
- m_pFrame->GetSize(&x, &y);
- m_pFrame->SetSize(-1, -1, x, y);
m_pFrame->SetFocus();
m_pFrame->Show(true);
Activate(true);
m_pViewMenu->Check (GRAPH3D_VIEW_COLOR, m_bColor);
m_pViewMenu->Check (GRAPH3D_VIEW_LIGHTING, m_bLighting);
m_pViewMenu->Check (GRAPH3D_VIEW_SMOOTH, m_bSmooth);
- m_pViewMenu->Check (GRAPH3D_VIEW_SURFACE, m_bSurface);
+ m_pViewMenu->Check (GRAPH3D_VIEW_WIREFRAME, m_bWireframe);
return true;
}
Graph3dFileView::CreateCanvas (wxFrame* parent)
{
Graph3dFileCanvas* pCanvas;
- int width, height;
- parent->GetClientSize (&width, &height);
-#ifdef __WXMSW__
- int *gl_attrib = NULL;
-#else
- int gl_attrib[20] = { GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1, GLX_DEPTH_SIZE, 1, GLX_DOUBLEBUFFER, None };
-#endif
-
- if(! m_bDoubleBuffer) {
-#ifdef __WXGTK__
- gl_attrib[9] = None;
-#endif
- }
-
- pCanvas = new Graph3dFileCanvas (this, parent, wxPoint(0, 0), wxSize(200, 200), 0, gl_attrib);
+ pCanvas = new Graph3dFileCanvas (this, parent, wxPoint(-1,-1), wxSize(-1,-1), 0);
pCanvas->SetBackgroundColour(*wxWHITE);
pCanvas->Clear();
void
Graph3dFileView::DrawSurface()
{
+ if (! GetDocument())
+ return;
+
if (m_bSmooth) {
glShadeModel (GL_SMOOTH);
} else {
glDisable (GL_LIGHTING);
}
- if (m_bSurface)
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- else
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
- InitMaterials();
-
- if (! GetDocument())
- return;
-
unsigned int nx = GetDocument()->nx();
unsigned int ny = GetDocument()->ny();
+
glRotated (m_dZRotate, 0.0, 1.0, 0.0);
- glTranslated (-static_cast<double>(nx) / 2, 0.0, -static_cast<double>(ny) / 2);
- glRotated (m_dYRotate, 1.0, 0.0, 0.0);
glRotated (m_dXRotate, 0.0, 0.0, 1.0);
+ 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();
+ if (m_bWireframe) {
+ if (! m_bColor)
+ glColor3f (1.0f, 1.0f, 1.0f);
+ glPolygonOffset (1.0f, 1.0f);
+ glEnable (GL_POLYGON_OFFSET_FILL);
+ glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+ glCallList (DISPLAYLIST_COLOR);
+
+ glColor3f (0.0f, 0.0f, 0.0f);
+ glPolygonOffset (0.0f, 0.0f);
+ glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+ glCallList (DISPLAYLIST_NO_COLOR);
+ } else {
+ glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+ if (! m_bColor) {
+ glColor3f (1.0f, 1.0f, 1.0f);
+ glCallList (DISPLAYLIST_NO_COLOR);
+ } else
+ glCallList (DISPLAYLIST_COLOR);
+ }
- glCallList (DISPLAYLIST_SURFACE);
}
void
if (nx == 0 || ny == 0 || ! v)
return;
- glNewList (DISPLAYLIST_SURFACE, GL_COMPILE);
+ glNewList (DISPLAYLIST_COLOR, GL_COMPILE);
double dMin = m_dColorScaleMin;
double dIntensityScale = m_dColorScaleMax - m_dColorScaleMin;
double actOffset = m_dGraphMin;
double actScale = 0.4 * sqrt(nx*nx+ny*ny) / (m_dGraphMax - m_dGraphMin);
-
- if (! m_bColor)
- glColor3f (1.0f, 1.0f, 1.0f);
-
- for (unsigned ix = 0; ix < nx - 1; ix++) {
+ double dXOffset = -(static_cast<double>(nx) - 1) / 2.;
+ double dYOffset = -(static_cast<double>(ny) - 1) / 2.;
+ dXOffset = 0;
+ dYOffset = 0;
+
+ double dXPos = -dXOffset;
+ unsigned int ix;
+ for (ix = 0; ix < nx - 1; ix++, dXPos++) {
+ double dYPos = -dYOffset;
glBegin(GL_QUAD_STRIP);
- double p1[3], p2[3], p3[3];
- double n1[3];
- p1[0] = ix; p1[1] = actScale * (v[ix][0] + actOffset); p1[2] = 0;
- p2[0] = ix+1; p2[1] = actScale * (v[ix+1][0] + actOffset); p2[2] = 0;
- p3[0] = ix; p3[1] = actScale * (v[ix][1] + actOffset); p3[2] = 1;
- CalculateVectorNormal (p1, p2, p3, &n1[0], &n1[1], &n1[2]);
- double dIntensity1, dIntensity2;
+ 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;
+ 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]);
+
+ double dIntensity1 = 0., dIntensity2 = 0.;
if (m_bColor) {
dIntensity1 = (v[ix][0] - dMin) / dIntensityScale;
dIntensity2 = (v[ix+1][0] - dMin) / dIntensityScale;
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++) {
- p1[0] = ix; p1[1] = actScale * (v[ix][iy] + actOffset); p1[2] = iy;
- p2[0] = ix+1; p2[1] = actScale * (v[ix+1][iy] + actOffset); p2[2] = iy;
+ 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;
+ dIntensity1 = (v[ix][iy] - dMin) / dIntensityScale;
+ dIntensity2 = (v[ix+1][iy] - dMin) / dIntensityScale;
+ intensityToColor (dIntensity1, vecColor);
+ glColor3fv (vecColor);
}
+ glVertex3dv (p1); glNormal3dv (n1);
if (m_bColor) {
- intensityToColor (dIntensity1, vecColor);
- glColor3fv (vecColor);
+ intensityToColor (dIntensity2, vecColor);
+ glColor3fv (vecColor);
}
+ glVertex3dv (p2); glNormal3dv (n1);
+ }
+ glEnd(); // QUAD_STRIP
+ }
+ glEndList();
+
+
+ glNewList (DISPLAYLIST_NO_COLOR, GL_COMPILE);
+ dXPos = -dXOffset;
+ for (ix = 0; ix < nx - 1; ix++, dXPos++) {
+ double dYPos = -dYOffset;
+ glBegin(GL_QUAD_STRIP);
+ 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;
+ 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);
+ 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++) {
+ 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);
- if (m_bColor) {
- intensityToColor (dIntensity2, vecColor);
- glColor3fv (vecColor);
- }
glVertex3dv (p2); glNormal3dv (n1);
}
glEnd(); // QUAD_STRIP
{
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();
}
{
m_bLighting = ! m_bLighting;
m_pViewMenu->Check (GRAPH3D_VIEW_LIGHTING, m_bLighting);
-
m_pCanvas->Refresh();
}
void
-Graph3dFileView::OnSurface (wxCommandEvent& event)
+Graph3dFileView::OnWireframe (wxCommandEvent& event)
{
- m_bSurface = ! m_bSurface;
- m_pViewMenu->Check (GRAPH3D_VIEW_SURFACE, m_bSurface);
+ m_bWireframe = ! m_bWireframe;
+ m_pViewMenu->Check (GRAPH3D_VIEW_WIREFRAME, m_bWireframe);
m_pCanvas->Refresh();
}
{
m_bColor = ! m_bColor;
m_pViewMenu->Check (GRAPH3D_VIEW_COLOR, m_bColor);
- OnUpdate (this, NULL);
+ m_pCanvas->Refresh();
}
void
void
Graph3dFileView::OnDraw (wxDC* dc)
{
-#ifndef __WXMOTIF__
- if (! m_pCanvas->GetContext()) return;
-#endif
-
- m_pCanvas->SwapBuffers();
- Draw();
- std::ostringstream os;
- os << "Xangle=" << m_dXRotate << ", Yangle=" << m_dYRotate << ", Zangle=" << m_dZRotate;
- m_pStatusBar->SetStatusText (os.str().c_str());
- m_pCanvas->SwapBuffers();
+ if (m_pCanvas) {
+ m_pCanvas->SetCurrent();
+ Draw();
+ m_pCanvas->SwapBuffers();
+ }
+
+ if (m_pStatusBar) {
+ std::ostringstream os;
+ os << "Xangle=" << m_dXRotate << ", Yangle=" << m_dYRotate
+ << ", Zangle=" << m_dZRotate;
+ m_pStatusBar->SetStatusText (os.str().c_str());
+ }
}
#if 1
static float ambient[] = {0.1f, 0.1f, 0.1f, 1.0f};
static float diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};
- static float position0[] = {-nx/2, -ny/2, -ny/2, 0.0f, 0.0f};
- static float position1[] = {-nx/2, -ny/2, ny/2, 0.0f};
+ static float position0[] = {-nx/2, -ny/2, ny/2, 0.0f, 0.0f};
+ static float position1[] = {-nx/2, -ny/2, -ny/2, 0.0f};
static float ambient1[] = {0.5f, 0.5f, 0.5f, 1.0f};
static float diffuse1[] = {1.0f, 1.0f, 1.0f, 1.0f};
// static float position0[] = {0.0f, 0.0f, 20.0f, 0.0f};
if (! GetDocument())
return;
- int nx = GetDocument()->nx();
- int ny = GetDocument()->ny();
+ unsigned int nx = GetDocument()->nx();
+ unsigned int ny = GetDocument()->ny();
const ImageFileArrayConst v = GetDocument()->getArray();
if (v != NULL && nx != 0 && ny != 0) {
double min = v[0][0];
if (! m_bColorScaleMaxSet)
m_dColorScaleMax = max;
}
-
double dRadius = maxValue<int> (nx, ny) * SQRT2 / 2;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
-#if 1
+#if 0
GLfloat eyep[3], lookp[3], up[3];
eyep[0] = -nx/2; eyep[1] = 0; eyep[2] = -ny/2;
lookp[0] = 0; lookp[1] = 0, lookp[2] = 0;
unsigned int nx = GetDocument()->nx();
unsigned int ny = GetDocument()->ny();
const ImageFileArrayConst v = GetDocument()->getArray();
- double dMin, dMax;
+ double dMin = 0., dMax = 0.;
if (! m_bColorScaleMinSet && ! m_bColorScaleMaxSet) {
dMax = dMin = v[0][0];
for (unsigned ix = 0; ix < nx; ix++)
Graph3dFileView::CreateChildFrame (wxDocument *doc, wxView *view)
{
#if CTSIM_MDI
- wxDocMDIChildFrame* subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "Graph3dFile Frame", wxPoint(-1, -1), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
+ wxDocMDIChildFrame* subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "Graph3dFile Frame", wxPoint(-1,-1), wxSize(-1,-1), wxDEFAULT_FRAME_STYLE);
#else
- wxDocChildFrame* subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "Graph3dFile Frame", wxPoint(-1, -1), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
+ 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
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");
GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);
m_pViewMenu = new wxMenu;
- m_pViewMenu->Append(GRAPH3D_VIEW_SURFACE, "Su&rface\tCtrl-R", "", true);
+ m_pViewMenu->Append(GRAPH3D_VIEW_WIREFRAME, "Wi&reframe\tCtrl-R", "", true);
m_pViewMenu->Append(GRAPH3D_VIEW_SMOOTH, "S&mooth\tCtrl-M", "", true);
m_pViewMenu->Append(GRAPH3D_VIEW_COLOR, "Co&lor\tCtrl-L", "", true);
m_pViewMenu->Append(GRAPH3D_VIEW_LIGHTING, "Li&ghting\tCtrl-G", "", true);
wxMenu *help_menu = new wxMenu;
help_menu->Append(MAINMENU_HELP_CONTENTS, "&Contents\tF1");
- help_menu->Append(MAINMENU_HELP_TOPICS, "&Topics\tCtrl-H");
help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
wxMenuBar *menu_bar = new wxMenuBar;
subframe->SetMenuBar(menu_bar);
subframe->Centre(wxBOTH);
-
- wxAcceleratorEntry accelEntries[12];
- accelEntries[0].Set (wxACCEL_CTRL, static_cast<int>('O'), wxID_OPEN);
- accelEntries[1].Set (wxACCEL_CTRL, static_cast<int>('H'), MAINMENU_HELP_TOPICS);
- accelEntries[2].Set (wxACCEL_CTRL, static_cast<int>('P'), MAINMENU_FILE_CREATE_PHANTOM);
- accelEntries[3].Set (wxACCEL_CTRL, static_cast<int>('F'), MAINMENU_FILE_CREATE_FILTER);
- accelEntries[4].Set (wxACCEL_NORMAL, WXK_F1, MAINMENU_HELP_CONTENTS);
- accelEntries[5].Set (wxACCEL_CTRL, static_cast<int>('R'), GRAPH3D_VIEW_SURFACE);
- accelEntries[6].Set (wxACCEL_CTRL, static_cast<int>('L'), GRAPH3D_VIEW_COLOR);
- accelEntries[7].Set (wxACCEL_CTRL, static_cast<int>('G'), GRAPH3D_VIEW_LIGHTING);
- accelEntries[8].Set (wxACCEL_CTRL, static_cast<int>('M'), GRAPH3D_VIEW_SMOOTH);
- accelEntries[9].Set (wxACCEL_CTRL, static_cast<int>('E'), GRAPH3D_VIEW_SCALE_MINMAX);
- accelEntries[10].Set (wxACCEL_CTRL, static_cast<int>('A'), GRAPH3D_VIEW_SCALE_AUTO);
- accelEntries[11].Set (wxACCEL_CTRL, static_cast<int>('U'), GRAPH3D_VIEW_SCALE_FULL);
- wxAcceleratorTable accelTable (12, accelEntries);
+
+ wxAcceleratorEntry accelEntries[7];
+ accelEntries[0].Set (wxACCEL_CTRL, static_cast<int>('R'), GRAPH3D_VIEW_WIREFRAME);
+ accelEntries[1].Set (wxACCEL_CTRL, static_cast<int>('L'), GRAPH3D_VIEW_COLOR);
+ accelEntries[2].Set (wxACCEL_CTRL, static_cast<int>('G'), GRAPH3D_VIEW_LIGHTING);
+ accelEntries[3].Set (wxACCEL_CTRL, static_cast<int>('M'), GRAPH3D_VIEW_SMOOTH);
+ accelEntries[4].Set (wxACCEL_CTRL, static_cast<int>('E'), GRAPH3D_VIEW_SCALE_MINMAX);
+ accelEntries[5].Set (wxACCEL_CTRL, static_cast<int>('A'), GRAPH3D_VIEW_SCALE_AUTO);
+ accelEntries[6].Set (wxACCEL_CTRL, static_cast<int>('U'), GRAPH3D_VIEW_SCALE_FULL);
+ wxAcceleratorTable accelTable (7, accelEntries);
subframe->SetAcceleratorTable (accelTable);
-
+
return subframe;
}
Graph3dFileCanvas::Graph3dFileCanvas (Graph3dFileView* view, wxWindow *parent, const wxPoint& pos,
- const wxSize& size, long style, int* gl_attrib):
-wxGLCanvas (parent, -1, pos, size, style, _T("Graph3dCanvas"), gl_attrib), m_pView(view)
+ const wxSize& size, long style):
+wxGLCanvas (parent, -1, pos, size, style, _T("Graph3dCanvas")
+ ), m_pView(view)
{
parent->Show (true);
SetCurrent();
m_pView->OnDraw(& dc);
}
+
+wxSize
+Graph3dFileCanvas::GetBestSize() const
+{
+ return wxSize (400,400);
+}
+
void
Graph3dFileCanvas::OnSize (wxSizeEvent& event)
{
m_pView->m_dYRotate -= 15.0;
Refresh (false);
break;
- case 'r': case 'R':
- m_pView->OnSurface (dummyEvent);
+ case 'w': case 'W':
+ m_pView->OnWireframe (dummyEvent);
break;
case 's': case 'S':
m_pView->OnSmooth (dummyEvent);