The Winamp Remote Control suite
a remote control client and plugin for Winamp 2.x, 5.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
AboutF.cpp
Go to the documentation of this file.
1 /*
2 winamp remote control suite ŠPatrick Michael Martin 2000, 2001, 2012
3 
4 Copyright (C) 2000,2001,2012 Patrick M. Martin
5 
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 
20 Patrick M. Martin may be reached by email at patrickmmartin@gmail.com.
21 */
22 
23 
24 
25 #include <vcl.h>
26 #pragma hdrstop
27 
28 #include <GL\gl.h>
29 #include <GL\glu.h>
30 #include <math.h>
31 #include "AboutF.h"
32 
33 
34 #pragma package(smart_init)
35 #pragma resource "*.dfm"
36 
38 
39 #define GLF_START_LIST 20000
40 #define TORUS 1
41 #define CUBE 2
42 #define SPHERE 3
43 
44 GLfloat textExtrusion = 0.2;
45 
46 GLYPHMETRICSFLOAT glyphMetrics[127];
47 
48 
49 void TfrmAbout::resize()
50 {
51  m_aboutDisplay->setClientArea(ClientWidth, ClientHeight);
52  m_aboutDisplay->setProjection();
53  glViewport(0, 0, TheControl->ClientWidth, TheControl->ClientHeight);
54 }
55 
56 void TfrmAbout::redraw()
57 {
58  m_aboutDisplay->redraw();
59 }
60 
61 
62 
63 __fastcall TfrmAbout::TfrmAbout(TComponent* Owner)
64  : TForm(Owner)
65 
66 {
67 }
68 
69 
70 void __fastcall TfrmAbout::WMPaletteChanged(TMessage& Msg)
71 {
72 
73  if (hPalette != NULL && (HWND) Msg.WParam != Handle) {
74  UnrealizeObject(hPalette);
75  SelectPalette(hDC, hPalette, FALSE);
76  RealizePalette(hDC);
77  redraw();
78  }
79 
80 }
81 
82 
83 void __fastcall TfrmAbout::WMQueryNewPalette(TMessage& /* Msg */)
84 {
85 
86  if (hPalette != NULL) {
87  UnrealizeObject(hPalette);
88  SelectPalette(hDC, hPalette, FALSE);
89  RealizePalette(hDC);
90  redraw();
91  }
92 
93 }
94 
95 
96 void __fastcall TfrmAbout::FormCreate(TObject *)
97 {
98  hDC = GetDC(TheControl->Handle);
99  m_aboutDisplay = NULL;
100  m_aboutDisplay = (new AboutGLDisplay(hDC, TheControl->ClientWidth, TheControl->ClientHeight));
101 
102 }
103 
104 
105 void __fastcall TfrmAbout::FormDestroy(TObject *)
106 {
107  ReleaseDC(TheControl->Handle, hDC);
108  delete m_aboutDisplay;
109 //
110 }
111 
112 
113 void __fastcall TfrmAbout::FormMouseDown(TObject *, TMouseButton , TShiftState , int X, int Y)
114 {
115  SetCapture(TheControl->Handle);
116  m_aboutDisplay->startMotion(0, 1, X, Y);
117 }
118 
119 
120 void __fastcall TfrmAbout::FormMouseMove(TObject *, TShiftState , int X, int Y)
121 {
122  m_aboutDisplay->trackMotion(0, X, Y);
123 }
124 
125 
126 void __fastcall TfrmAbout::FormMouseUp(TObject *, TMouseButton , TShiftState , int X, int Y)
127 {
128  m_aboutDisplay->stopMotion(0, 1, X, Y);
129 }
130 
131 
132 void __fastcall TfrmAbout::FormPaint(TObject *)
133 {
134  PAINTSTRUCT ps;
135  BeginPaint(TheControl->Handle, &ps);
136  redraw();
137  EndPaint(TheControl->Handle, &ps);
138 }
139 
140 
141 void __fastcall TfrmAbout::FormResize(TObject *)
142 {
143  resize();
144 }
145 
146 
147 
148 void __fastcall TfrmAbout::FormKeyPress(TObject *, char &Key)
149 {
150 
151  AboutGLDisplay::GLOptions & gloptions = m_aboutDisplay->gloptions();
152 
153  switch (Key) {
154  case VK_ESCAPE:
155  Close();
156  return;
157 // case VK_SPACE:
158 // gloptions.objectIndex = (gloptions.objectIndex + 1) % 4;
159 // return;
160  case 'a':
161  gloptions.useVertexArray = !gloptions.useVertexArray;
162  return;
163  case 'c':
164  gloptions.useFaceCull = !gloptions.useFaceCull;
165  return;
166  case 'f':
167  gloptions.useFog = !gloptions.useFog;
168  return;
169  case 'h':
170  gloptions.halfObject = !gloptions.halfObject;
171  return;
172  case 'l':
173  gloptions.useLighting = !gloptions.useLighting;
174  return;
175  case 'o':
176  gloptions.perspectiveProj = !gloptions.perspectiveProj;
177  resize();
178  return;
179  case 'p':
180  gloptions.drawOutlines = !gloptions.drawOutlines;
181  return;
182  case 'v':
183  gloptions.useVertexCull = !gloptions.useVertexCull;
184  return;
185  case 'i':
186  m_aboutDisplay->yOffset += AboutGLDisplay::Y_OFFSET_STEP;
187  return;
188  case 'j':
189  m_aboutDisplay->xOffset -= AboutGLDisplay::X_OFFSET_STEP;
190  return;
191  case 'k':
192  m_aboutDisplay->xOffset += AboutGLDisplay::X_OFFSET_STEP;
193  return;
194  case 'm':
195  m_aboutDisplay->yOffset -= AboutGLDisplay::Y_OFFSET_STEP;
196  return;
197  case 'r':
198  gloptions.textureReplace = !gloptions.textureReplace;
199  return;
200  case 't':
201  gloptions.textureEnabled = !gloptions.textureEnabled;
202  return;
203  case 'x':
204  gloptions.useVertexLocking = !gloptions.useVertexLocking;
205  return;
206  default:
207  break;
208  }
209 
210 
211 }
212 
213 
214 void __fastcall TfrmAbout::FormKeyDown(TObject *, WORD &Key, TShiftState )
215 {
216  switch (Key) {
217  /*
218  case VK_DOWN:
219  if (objectNumMajor > 1)
220  --objectNumMajor;
221  break;
222  case VK_UP:
223  ++objectNumMajor;
224  break;
225  case VK_LEFT:
226  if (objectNumMinor > 1)
227  --objectNumMinor;
228  break;
229  case VK_RIGHT:
230  ++objectNumMinor;
231  break;
232  default:
233  break;
234  */
235  }
236  redraw();
237  return;
238 }
239 
240 
241 void __fastcall TfrmAbout::IdleHandler(TObject *)
242 {
243  redraw();
244 }
245 
246 void __fastcall TfrmAbout::FormShow(TObject *)
247 {
248  tmrMain->Enabled = true;
249 
250 }
251 
252