-
Notifications
You must be signed in to change notification settings - Fork 0
/
AP210ViewerView.h
170 lines (146 loc) · 5.02 KB
/
AP210ViewerView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// AP210ViewerView.h : interface of the CAP210ViewerView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_AP210VIEWERVIEW_H__9BE7D70F_0912_11D3_9B0D_0080AD428934__INCLUDED_)
#define AFX_AP210VIEWERVIEW_H__9BE7D70F_0912_11D3_9B0D_0080AD428934__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
class CAP210ViewerView : public CView
{
protected: // create from serialization only
CAP210ViewerView();
DECLARE_DYNCREATE(CAP210ViewerView)
// Attributes
public:
CAP210ViewerDoc* GetDocument();
HGLRC m_hrc; //OpenGL Rendering Context for Display
HGLRC p_hrc; // OpenGL Rendering Context for Printing
// Is a different context required for printing?
CPalette* m_pPal; //Palette
// Operations
public:
void PrepareScene() ; //OPENGL build display lists
void DrawScene() ; //OPENGL draws OpenGL scene
void OutputGlError(char* label) ; //OPENGL function to display OpenGL errors using TRACE
//
// Multiple display list support
//
enum enum_OBJECTS {thePCB=1, theTopComponents=2, theBottomComponents=3} ;
//
// Support for generating RGB color palette
//
BOOL CreateRGBPalette(HDC hDC) ;
unsigned char ComponentFromIndex(int i, UINT nbits, UINT shift) ;
static unsigned char m_oneto8[2];
static unsigned char m_twoto8[4];
static unsigned char m_threeto8[8];
static int m_defaultOverride[13];
static PALETTEENTRY m_defaultPalEntry[20];
// Operations
public:
// Overrides
// virtual void OnDestroy();
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAP210ViewerView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnInitialUpdate();
virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
// virtual int OnCreate(LPCREATESTRUCT lpCreateStruct); // setup OPENGL here
// Implementation
public:
void Perspective();
int lightStartY;
virtual ~CAP210ViewerView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
void ScaleDisplay(void);
void DrawOrigin(GLdouble x, GLdouble y);
void DrawRuler(GLdouble x, GLdouble y);
// Generated message map functions
protected:
//{{AFX_MSG(CAP210ViewerView)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnDestroy();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnComponentRestrictionArea();
afx_msg void OnPrimarySurface();
afx_msg void OnSecondarySurface();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
#ifdef DUMPMODELVIEW
void dumpModelView();
#endif
void orientSecondarySurface();
void orientPrimarySurface();
double DeltaY;
double DeltaX;
double calculateDistance(double size, double degtheta);
double calculateAngle(double size, double distance);
void set_eyeZ();
virtual void TranslateScene();
virtual void RenderScene();
virtual void RenderScenePass();
boolean focus;
// Selecting of graphics
int OnSelect(int x, int y);
void ProcessHits(GLint hits, GLuint buffer[]);
// Track Ball Variables and Functions
#ifdef TRACKBALL
int newModel;
float lastquat[4];
float curquat[4];
void recalcModelView();
#endif
int lightStartX;
// Model Orientation Variables
int starty;
int startx;
GLfloat angle2;
GLfloat angle;
// Camera Coordinates
GLdouble centerX;
GLdouble centerY;
GLdouble centerZ;
// View Orientation Variables
GLdouble eyeX;
GLdouble eyeY;
GLdouble eyeZ;
// Camera orientation variables
GLdouble upX;
GLdouble upY;
GLdouble upZ;
// Perspective variables
GLdouble glFovy;
GLdouble glNear;
GLdouble glFar;
};
#ifndef _DEBUG // debug version in AP210ViewerView.cpp
inline CAP210ViewerDoc* CAP210ViewerView::GetDocument()
{ return (CAP210ViewerDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_AP210VIEWERVIEW_H__9BE7D70F_0912_11D3_9B0D_0080AD428934__INCLUDED_)