@@ -8,12 +8,20 @@ ref class ShaderFunction;
88}
99}
1010
11- class WaveForm ;
11+ struct WaveForm ;
12+ struct xr_token ;
13+
14+ namespace XRay
15+ {
16+ ref class Token ;
17+ }
1218
1319namespace XRay
1420{
1521namespace ECore
1622{
23+ namespace Props
24+ {
1725using namespace System ;
1826using namespace System ::ComponentModel;
1927using namespace System ::Collections;
@@ -24,10 +32,7 @@ using namespace System::Drawing;
2432public ref class ShaderFunction : public System ::Windows::Forms::Form
2533{
2634public:
27- ShaderFunction (void )
28- {
29- InitializeComponent ();
30- }
35+ ShaderFunction (void );
3136
3237protected:
3338 ~ShaderFunction ()
@@ -38,6 +43,26 @@ public ref class ShaderFunction : public System::Windows::Forms::Form
3843 }
3944 }
4045
46+ private:
47+ bool bLoadMode;
48+
49+ WaveForm* currentFunc;
50+ WaveForm* saveFunc;
51+
52+ void GetFuncData ();
53+ void UpdateFuncData ();
54+ void DrawGraph ();
55+
56+ public:
57+ bool Run (WaveForm* func);
58+ void FillFunctionsFromToken (const xr_token* tokens);
59+ XRay::Token^ GetTokenFromValue(int val);
60+
61+ private: System::Void ShaderFunction_KeyPress (System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e);
62+ private: System::Void numArgX_KeyPress (System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e);
63+ private: System::Void buttonOk_Click (System::Object^ sender, System::EventArgs^ e);
64+ private: System::Void buttonCancel_Click (System::Object^ sender, System::EventArgs^ e);
65+
4166private: System::Windows::Forms::Label^ label1;
4267private: System::Windows::Forms::Label^ label2;
4368private: System::Windows::Forms::Label^ label3;
@@ -60,7 +85,7 @@ private: XRay::SdkControls::NumericSpinner^ numScale;
6085private: System::Windows::Forms::Panel^ panelLeft;
6186private: System::Windows::Forms::Panel^ panelRight;
6287
63- private: System::Windows::Forms::ComboBox^ comboBox1 ;
88+ private: System::Windows::Forms::ComboBox^ comboFunctions ;
6489private: System::Windows::Forms::PictureBox^ pbDraw;
6590
6691private: System::Windows::Forms::Button^ buttonOk;
@@ -83,7 +108,7 @@ private: System::Windows::Forms::Button^ buttonCancel;
83108 this ->numArg4 = (gcnew XRay::SdkControls::NumericSpinner ());
84109 this ->label6 = (gcnew System::Windows::Forms::Label ());
85110 this ->panelLeft = (gcnew System::Windows::Forms::Panel ());
86- this ->comboBox1 = (gcnew System::Windows::Forms::ComboBox ());
111+ this ->comboFunctions = (gcnew System::Windows::Forms::ComboBox ());
87112 this ->panelRight = (gcnew System::Windows::Forms::Panel ());
88113 this ->numScale = (gcnew XRay::SdkControls::NumericSpinner ());
89114 this ->pbDraw = (gcnew System::Windows::Forms::PictureBox ());
@@ -140,6 +165,7 @@ private: System::Windows::Forms::Button^ buttonCancel;
140165 this ->numArg1 ->TabIndex = 5 ;
141166 this ->numArg1 ->TextAlign = System::Windows::Forms::HorizontalAlignment::Left;
142167 this ->numArg1 ->Value = System::Decimal (gcnew cli::array< System::Int32 >(4 ) { 0 , 0 , 0 , 0 });
168+ this ->numArg1 ->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler (this , &ShaderFunction::numArgX_KeyPress);
143169 this ->numArg2 ->DecimalPlaces = 5 ;
144170 this ->numArg2 ->Hexadecimal = false ;
145171 this ->numArg2 ->Location = System::Drawing::Point (89 , 57 );
@@ -152,6 +178,7 @@ private: System::Windows::Forms::Button^ buttonCancel;
152178 this ->numArg2 ->TabIndex = 6 ;
153179 this ->numArg2 ->TextAlign = System::Windows::Forms::HorizontalAlignment::Left;
154180 this ->numArg2 ->Value = System::Decimal (gcnew cli::array< System::Int32 >(4 ) { 0 , 0 , 0 , 0 });
181+ this ->numArg2 ->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler (this , &ShaderFunction::numArgX_KeyPress);
155182 this ->numArg3 ->DecimalPlaces = 5 ;
156183 this ->numArg3 ->Hexadecimal = false ;
157184 this ->numArg3 ->Location = System::Drawing::Point (89 , 84 );
@@ -164,6 +191,7 @@ private: System::Windows::Forms::Button^ buttonCancel;
164191 this ->numArg3 ->TabIndex = 7 ;
165192 this ->numArg3 ->TextAlign = System::Windows::Forms::HorizontalAlignment::Left;
166193 this ->numArg3 ->Value = System::Decimal (gcnew cli::array< System::Int32 >(4 ) { 0 , 0 , 0 , 0 });
194+ this ->numArg3 ->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler (this , &ShaderFunction::numArgX_KeyPress);
167195 this ->numArg4 ->DecimalPlaces = 5 ;
168196 this ->numArg4 ->Hexadecimal = false ;
169197 this ->numArg4 ->Location = System::Drawing::Point (89 , 111 );
@@ -176,13 +204,14 @@ private: System::Windows::Forms::Button^ buttonCancel;
176204 this ->numArg4 ->TabIndex = 8 ;
177205 this ->numArg4 ->TextAlign = System::Windows::Forms::HorizontalAlignment::Left;
178206 this ->numArg4 ->Value = System::Decimal (gcnew cli::array< System::Int32 >(4 ) { 0 , 0 , 0 , 0 });
207+ this ->numArg4 ->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler (this , &ShaderFunction::numArgX_KeyPress);
179208 this ->label6 ->AutoSize = true ;
180209 this ->label6 ->Location = System::Drawing::Point (44 , 5 );
181210 this ->label6 ->Name = L" label6" ;
182211 this ->label6 ->Size = System::Drawing::Size (192 , 13 );
183212 this ->label6 ->TabIndex = 10 ;
184213 this ->label6 ->Text = L" y = arg1 + arg2*func((time + arg3)*arg4)" ;
185- this ->panelLeft ->Controls ->Add (this ->comboBox1 );
214+ this ->panelLeft ->Controls ->Add (this ->comboFunctions );
186215 this ->panelLeft ->Controls ->Add (this ->label1 );
187216 this ->panelLeft ->Controls ->Add (this ->label2 );
188217 this ->panelLeft ->Controls ->Add (this ->numArg4 );
@@ -196,11 +225,11 @@ private: System::Windows::Forms::Button^ buttonCancel;
196225 this ->panelLeft ->Name = L" panelLeft" ;
197226 this ->panelLeft ->Size = System::Drawing::Size (205 , 140 );
198227 this ->panelLeft ->TabIndex = 11 ;
199- this ->comboBox1 ->FormattingEnabled = true ;
200- this ->comboBox1 ->Location = System::Drawing::Point (89 , 1 );
201- this ->comboBox1 ->Name = L" comboBox1 " ;
202- this ->comboBox1 ->Size = System::Drawing::Size (115 , 21 );
203- this ->comboBox1 ->TabIndex = 9 ;
228+ this ->comboFunctions ->FormattingEnabled = true ;
229+ this ->comboFunctions ->Location = System::Drawing::Point (89 , 1 );
230+ this ->comboFunctions ->Name = L" comboFunctions " ;
231+ this ->comboFunctions ->Size = System::Drawing::Size (115 , 21 );
232+ this ->comboFunctions ->TabIndex = 9 ;
204233 this ->panelRight ->Controls ->Add (this ->numScale );
205234 this ->panelRight ->Controls ->Add (this ->pbDraw );
206235 this ->panelRight ->Controls ->Add (this ->labelEnd );
@@ -270,12 +299,14 @@ private: System::Windows::Forms::Button^ buttonCancel;
270299 this ->buttonOk ->TabIndex = 14 ;
271300 this ->buttonOk ->Text = L" Ok" ;
272301 this ->buttonOk ->UseVisualStyleBackColor = true ;
302+ this ->buttonOk ->Click += gcnew System::EventHandler (this , &ShaderFunction::buttonOk_Click);
273303 this ->buttonCancel ->Location = System::Drawing::Point (88 , 140 );
274304 this ->buttonCancel ->Name = L" buttonCancel" ;
275305 this ->buttonCancel ->Size = System::Drawing::Size (116 , 22 );
276306 this ->buttonCancel ->TabIndex = 13 ;
277307 this ->buttonCancel ->Text = L" Cancel" ;
278308 this ->buttonCancel ->UseVisualStyleBackColor = true ;
309+ this ->buttonCancel ->Click += gcnew System::EventHandler (this , &ShaderFunction::buttonCancel_Click);
279310 this ->AutoScaleDimensions = System::Drawing::SizeF (6 , 13 );
280311 this ->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
281312 this ->ClientSize = System::Drawing::Size (441 , 162 );
@@ -295,8 +326,7 @@ private: System::Windows::Forms::Button^ buttonCancel;
295326
296327 }
297328#pragma endregion
298-
299- public: bool Run (WaveForm* func);
300329};
330+ } // namespace Props
301331} // namespace ECore
302332} // namespace XRay
0 commit comments