aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/DSP/dsp_sps/sps_configdlg.h
blob: b6e462a18f9f172ca8b76a79bf9556475d411ae0 (plain) (blame)
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
#ifndef SPS_CONFIGDLG_IMPL

BOOL CALLBACK SPS_configWindowProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam);

#else

#ifdef SPS_CONFIGDLG_HIDEABLE_EDITOR
static void showHideSliders(HWND hwndDlg, SPSEffectContext *ctx)
{
	int x;
	x=(SPS_CONFIGDLG_HIDEABLE_EDITOR || ctx->curpreset.slider_labels[0][0][0])?SW_SHOWNA:SW_HIDE;
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER1),x);
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER1_LABEL1),x);
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER1_LABEL2),x);
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER1_LABEL3),x);
	x=(SPS_CONFIGDLG_HIDEABLE_EDITOR || ctx->curpreset.slider_labels[1][0][0])?SW_SHOWNA:SW_HIDE;
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER2),x);
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER2_LABEL1),x);
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER2_LABEL2),x);
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER2_LABEL3),x);
	x=(SPS_CONFIGDLG_HIDEABLE_EDITOR || ctx->curpreset.slider_labels[2][0][0])?SW_SHOWNA:SW_HIDE;
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER3),x);
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER3_LABEL1),x);
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER3_LABEL2),x);
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER3_LABEL3),x);
	x=(SPS_CONFIGDLG_HIDEABLE_EDITOR || ctx->curpreset.slider_labels[3][0][0])?SW_SHOWNA:SW_HIDE;
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER4),x);
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER4_LABEL1),x);
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER4_LABEL2),x);
	ShowWindow(GetDlgItem(hwndDlg,IDC_SLIDER4_LABEL3),x);
}

static void showHideEditor(HWND hwndDlg, int isInit)
{
	int en=0;
	static int lw;
	RECT r;
	GetWindowRect(hwndDlg,&r);
	if (isInit)
	{
		lw=r.right-r.left;
	}
	if (!SPS_CONFIGDLG_HIDEABLE_EDITOR)
	{
		SetDlgItemText(hwndDlg,IDC_EDIT,WASABI_API_LNGSTRING(IDS_SHOW_EDITOR));
		RECT r2;
		GetWindowRect(GetDlgItem(hwndDlg,IDC_SAVE),&r2);
		SetWindowPos(hwndDlg,NULL,0,0,r2.left-r.left,r.bottom-r.top,SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE);
	}
	else 
	{
		if (!isInit)
		{
			SetWindowPos(hwndDlg,NULL,0,0,lw,r.bottom-r.top,SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE);
		}
		SetDlgItemText(hwndDlg,IDC_EDIT,WASABI_API_LNGSTRING(IDS_HIDE_EDITOR));
		en=1;
	}

	UINT tab[] = {
		IDC_SLIDER1_LABEL1,
		IDC_SLIDER1_LABEL2,
		IDC_SLIDER1_LABEL3,
		IDC_SLIDER2_LABEL1,
		IDC_SLIDER2_LABEL2,
		IDC_SLIDER2_LABEL3,
		IDC_SLIDER3_LABEL1,
		IDC_SLIDER3_LABEL2,
		IDC_SLIDER3_LABEL3,
		IDC_SLIDER4_LABEL1,
		IDC_SLIDER4_LABEL2,
		IDC_SLIDER4_LABEL3,
	};

	for (int x = 0; x < sizeof(tab)/sizeof(UINT); x ++)
	{
		EnableWindow(GetDlgItem(hwndDlg,tab[x]),en);
    }

	UINT tab2[]={
		IDC_SAVE,
		IDC_SHOWHELP,
		IDC_INIT,
		IDC_ONSLIDERCHANGE,
		IDC_PERSAMPLE,
	};

	for (int x = 0; x < sizeof(tab2)/sizeof(UINT); x++)
	{
	    ShowWindow(GetDlgItem(hwndDlg,tab2[x]),en?SW_SHOWNA:SW_HIDE);
	}
}

#endif

char* BuildFilterString(void)
{
	static char filterStr[MAX_PATH] = {0};
	if(!filterStr[0])
	{
		char* temp = filterStr;
		//"SPS presets\0*.sps\0All files\0*.*\0"
		WASABI_API_LNGSTRING_BUF(IDS_SPS_PRESETS,filterStr,128);
		temp += lstrlen(filterStr)+1;
		lstrcpyn(temp, "*.sps", MAX_PATH);
		temp = temp + lstrlen(temp) + 1;
		lstrcpyn(temp, WASABI_API_LNGSTRING(IDS_ALL_FILES), 128);
		temp = temp + lstrlen(temp) + 1;
		lstrcpyn(temp, "*.*", MAX_PATH);
		*(temp = temp + lstrlen(temp) + 1) = 0;
	}
	return filterStr;
}

static void updatePresetText(HWND hwndDlg, SPSEffectContext *ctx)
{
	char *p=strrchr(ctx->curpreset_name,'\\');
	if (!p) p=ctx->curpreset_name;
	else p++;
	char *p2=strrchr(p,'.');
	if (p2) *p2=0;
	SetDlgItemText(hwndDlg,IDC_PRESET,p);
	if (p2) *p2='.';
}

static void dosavePreset(HWND hwndDlg, SPSEffectContext *ctx)
{
	char temp[2048] = {0};
	OPENFILENAME l={sizeof(l),0};
	char buf1[2048],buf2[2048];
	GetCurrentDirectory(sizeof(buf2),buf2);
	strcpy(buf1,g_path);
	l.hwndOwner = hwndDlg;
	l.lpstrFilter = BuildFilterString();
	l.lpstrFile = temp;
	strcpy(temp,ctx->curpreset_name);
	l.nMaxFile = 2048-1;
	l.lpstrTitle = WASABI_API_LNGSTRING(IDS_SAVE_PRESET);
	l.lpstrDefExt = "SPS";
	l.lpstrInitialDir = buf1;
	l.Flags = OFN_HIDEREADONLY|OFN_EXPLORER|OFN_OVERWRITEPROMPT; 	        
	if (GetSaveFileName(&l))
	{
		strcpy(ctx->curpreset_name,temp);
		SPS_save_preset(ctx,ctx->curpreset_name,"SPS PRESET");
		updatePresetText(hwndDlg,ctx);
	} 
	SetCurrentDirectory(buf2);
}

static void presetToDialog(HWND hwndDlg, SPSEffectContext *ctx)
{
	SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,1000-ctx->curpreset.sliderpos[0]);
	SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETPOS,1,1000-ctx->curpreset.sliderpos[1]);
	SendDlgItemMessage(hwndDlg,IDC_SLIDER3,TBM_SETPOS,1,1000-ctx->curpreset.sliderpos[2]);
	SendDlgItemMessage(hwndDlg,IDC_SLIDER4,TBM_SETPOS,1,1000-ctx->curpreset.sliderpos[3]);

	SetDlgItemText(hwndDlg,IDC_SLIDER1_LABEL1,ctx->curpreset.slider_labels[0][0]);
	SetDlgItemText(hwndDlg,IDC_SLIDER1_LABEL2,ctx->curpreset.slider_labels[0][1]);
	SetDlgItemText(hwndDlg,IDC_SLIDER1_LABEL3,ctx->curpreset.slider_labels[0][2]);
	SetDlgItemText(hwndDlg,IDC_SLIDER2_LABEL1,ctx->curpreset.slider_labels[1][0]);
	SetDlgItemText(hwndDlg,IDC_SLIDER2_LABEL2,ctx->curpreset.slider_labels[1][1]);
	SetDlgItemText(hwndDlg,IDC_SLIDER2_LABEL3,ctx->curpreset.slider_labels[1][2]);
	SetDlgItemText(hwndDlg,IDC_SLIDER3_LABEL1,ctx->curpreset.slider_labels[2][0]);
	SetDlgItemText(hwndDlg,IDC_SLIDER3_LABEL2,ctx->curpreset.slider_labels[2][1]);
	SetDlgItemText(hwndDlg,IDC_SLIDER3_LABEL3,ctx->curpreset.slider_labels[2][2]);
	SetDlgItemText(hwndDlg,IDC_SLIDER4_LABEL1,ctx->curpreset.slider_labels[3][0]);
	SetDlgItemText(hwndDlg,IDC_SLIDER4_LABEL2,ctx->curpreset.slider_labels[3][1]);
	SetDlgItemText(hwndDlg,IDC_SLIDER4_LABEL3,ctx->curpreset.slider_labels[3][2]);

	SetDlgItemText(hwndDlg,IDC_INIT,ctx->curpreset.code_text[0]);
	SetDlgItemText(hwndDlg,IDC_PERSAMPLE,ctx->curpreset.code_text[1]);
	SetDlgItemText(hwndDlg,IDC_ONSLIDERCHANGE,ctx->curpreset.code_text[2]);

	updatePresetText(hwndDlg,ctx);
#ifdef SPS_CONFIGDLG_HIDEABLE_EDITOR
	showHideSliders(hwndDlg,ctx);
#endif
}

static int m_help_lastpage=4;
static char *m_localtext;
static void _dosetsel(HWND hwndDlg)
{
	HWND tabwnd=GetDlgItem(hwndDlg,IDC_TAB1);
	int sel=TabCtrl_GetCurSel(tabwnd);
	char *text="";

	m_help_lastpage=sel;

	text=SPSHELP_gethelptext(sel);

	if (!text && sel == 4 && m_localtext) text=m_localtext;

	SetDlgItemText(hwndDlg,IDC_EDIT1,text);
}

static BOOL CALLBACK evalHelpDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam)
{
	switch (uMsg)
	{
		case WM_INITDIALOG:
		{	
			TCITEM item;
			HWND tabwnd=GetDlgItem(hwndDlg,IDC_TAB1);
			helpWnd=hwndDlg;
			item.mask=TCIF_TEXT;
			item.pszText=WASABI_API_LNGSTRING(IDS_GENERAL);
			TabCtrl_InsertItem(tabwnd,0,&item);
			item.pszText=WASABI_API_LNGSTRING(IDS_OPERATORS);
			TabCtrl_InsertItem(tabwnd,1,&item);
			item.pszText=WASABI_API_LNGSTRING(IDS_FUNCTIONS);
			TabCtrl_InsertItem(tabwnd,2,&item);
			item.pszText=WASABI_API_LNGSTRING(IDS_CONSTANTS);
			TabCtrl_InsertItem(tabwnd,3,&item);
			// fucko: context specific stuff
			m_localtext=0;
			if (lParam)
			{
				item.pszText=(char *)lParam;
				m_localtext=item.pszText + strlen(item.pszText)+1;
				TabCtrl_InsertItem(tabwnd,4,&item);
			}
			else if (m_help_lastpage > 3) m_help_lastpage=0;

			TabCtrl_SetCurSel(tabwnd,m_help_lastpage);
			_dosetsel(hwndDlg);
		}
		return 0;

		case WM_COMMAND:
			if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
			{
				EndDialog(hwndDlg,1);
				helpWnd = 0;
			}
		return 0;

		case WM_NOTIFY:
		{
			LPNMHDR p=(LPNMHDR) lParam;
			if (p->idFrom == IDC_TAB1 && p->code == TCN_SELCHANGE) _dosetsel(hwndDlg);
		}
		return 0;
	}
	return 0;
}

BOOL CALLBACK SPS_configWindowProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
	SPSEffectContext *ctx;

	if ( uMsg == WM_INITDIALOG )
		SetWindowLong( hwndDlg, DWL_USER, lParam );

	ctx = (SPSEffectContext *) GetWindowLong( hwndDlg, DWL_USER );

	if ( ctx )
	{
		switch ( uMsg )
		{
			case WM_INITDIALOG:
				SetWindowText( hwndDlg, hdr.description );

				SendDlgItemMessage( hwndDlg, IDC_SLIDER1, TBM_SETTICFREQ, 100, 0 );
				SendDlgItemMessage( hwndDlg, IDC_SLIDER2, TBM_SETTICFREQ, 100, 0 );
				SendDlgItemMessage( hwndDlg, IDC_SLIDER3, TBM_SETTICFREQ, 100, 0 );
				SendDlgItemMessage( hwndDlg, IDC_SLIDER4, TBM_SETTICFREQ, 100, 0 );
				SendDlgItemMessage( hwndDlg, IDC_SLIDER1, TBM_SETRANGEMIN, 0, 0 );
				SendDlgItemMessage( hwndDlg, IDC_SLIDER1, TBM_SETRANGEMAX, 0, 1000 );
				SendDlgItemMessage( hwndDlg, IDC_SLIDER2, TBM_SETRANGEMIN, 0, 0 );
				SendDlgItemMessage( hwndDlg, IDC_SLIDER2, TBM_SETRANGEMAX, 0, 1000 );
				SendDlgItemMessage( hwndDlg, IDC_SLIDER3, TBM_SETRANGEMIN, 0, 0 );
				SendDlgItemMessage( hwndDlg, IDC_SLIDER3, TBM_SETRANGEMAX, 0, 1000 );
				SendDlgItemMessage( hwndDlg, IDC_SLIDER4, TBM_SETRANGEMIN, 0, 0 );
				SendDlgItemMessage( hwndDlg, IDC_SLIDER4, TBM_SETRANGEMAX, 0, 1000 );

#ifdef SPS_CONFIGDLG_HIDEABLE_EDITOR
				showHideEditor( hwndDlg, TRUE );
				showHideSliders( hwndDlg, ctx );
#else
				ShowWindow( GetDlgItem( hwndDlg, IDC_EDIT ), SW_HIDE );
#endif
				if ( !ctx->bypass )
					CheckDlgButton( hwndDlg, IDC_BYPASS, BST_CHECKED );

				presetToDialog( hwndDlg, ctx );
				return 0;

			case WM_USER + 0x80:
				ShowWindow( hwndDlg, SW_SHOW );
				SetForegroundWindow( hwndDlg );
				return 0;

			case WM_COMMAND:
			{
				int w = 0;
				switch ( LOWORD( wParam ) )
				{
					case IDC_SLIDER1_LABEL1: w++;
					case IDC_SLIDER1_LABEL2: w++;
					case IDC_SLIDER1_LABEL3: w++;
					case IDC_SLIDER2_LABEL1: w++;
					case IDC_SLIDER2_LABEL2: w++;
					case IDC_SLIDER2_LABEL3: w++;
					case IDC_SLIDER3_LABEL1: w++;
					case IDC_SLIDER3_LABEL2: w++;
					case IDC_SLIDER3_LABEL3: w++;
					case IDC_SLIDER4_LABEL1: w++;
					case IDC_SLIDER4_LABEL2: w++;
					case IDC_SLIDER4_LABEL3: w++;
						if ( HIWORD( wParam ) == EN_CHANGE )
						{
							w = 12 - w;
							GetDlgItemText( hwndDlg, LOWORD( wParam ), ctx->curpreset.slider_labels[ w / 3 ][ w % 3 ], MAX_LABEL_LEN );
						}
						break;
#ifdef SPS_CONFIGDLG_HIDEABLE_EDITOR
					case IDC_EDIT:
						SPS_CONFIGDLG_HIDEABLE_EDITOR = !SPS_CONFIGDLG_HIDEABLE_EDITOR;
						showHideEditor( hwndDlg, FALSE );
						showHideSliders( hwndDlg, ctx );
						break;
#endif
					case IDC_BYPASS:
						ctx->bypass = !IsDlgButtonChecked( hwndDlg, IDC_BYPASS );
						break;

					case IDC_LOAD:
					{
						SendMessage( mod.hwndParent, WM_WA_IPC, 0, IPC_PUSH_DISABLE_EXIT );
						char temp[ 2048 ] = { 0 };
						OPENFILENAME l = { sizeof( l ),0 };
						char buf1[ 2048 ], buf2[ 2048 ];
						GetCurrentDirectory( sizeof( buf2 ), buf2 );
						strcpy( buf1, g_path );
						l.lpstrInitialDir = buf1;
						l.hwndOwner = hwndDlg;
						l.lpstrFilter = BuildFilterString();
						l.lpstrFile = temp;
						l.nMaxFile = 2048 - 1;
						l.lpstrTitle = WASABI_API_LNGSTRING( IDS_LOAD_PRESET );
						l.lpstrDefExt = "SPS";
						l.Flags = OFN_HIDEREADONLY | OFN_EXPLORER;
						if ( GetOpenFileName( &l ) )
						{
							SPS_load_preset( ctx, temp, "SPS PRESET" );
							presetToDialog( hwndDlg, ctx );
						}
						SetCurrentDirectory( buf2 );
						SendMessage( mod.hwndParent, WM_WA_IPC, 0, IPC_POP_DISABLE_EXIT );
					}
					break;

					case IDC_NEW:
						char title[ 32 ];
						if ( MessageBox( hwndDlg, WASABI_API_LNGSTRING( IDS_CLEAR_CURRENT_SETTINGS ),
										 WASABI_API_LNGSTRING_BUF( IDS_CONFIRMATION, title, 32 ), MB_YESNO ) == IDYES )
						{
							EnterCriticalSection( &ctx->code_cs );
							memset( &ctx->curpreset, 0, sizeof( ctx->curpreset ) );
							ctx->code_needrecompile = 7;
							memset( &ctx->triggers, 0, sizeof( ctx->triggers ) );
							ctx->curpreset_name[ 0 ] = 0;
							LeaveCriticalSection( &ctx->code_cs );

							presetToDialog( hwndDlg, ctx );
						}
						break;

					case IDC_SAVE:
						SendMessage( mod.hwndParent, WM_WA_IPC, 0, IPC_PUSH_DISABLE_EXIT );
						dosavePreset( hwndDlg, ctx );
						SendMessage( mod.hwndParent, WM_WA_IPC, 0, IPC_POP_DISABLE_EXIT );
						break;

					case IDC_INIT:
						if ( HIWORD( wParam ) == EN_CHANGE )
						{
							KillTimer( hwndDlg, 100 );
							SetTimer( hwndDlg, 100, 250, NULL );
						}
						break;

					case IDC_PERSAMPLE:
						if ( HIWORD( wParam ) == EN_CHANGE )
						{
							KillTimer( hwndDlg, 101 );
							SetTimer( hwndDlg, 101, 250, NULL );
						}
						break;

					case IDC_ONSLIDERCHANGE:
						if ( HIWORD( wParam ) == EN_CHANGE )
						{
							KillTimer( hwndDlg, 102 );
							SetTimer( hwndDlg, 102, 250, NULL );
						}
						break;

					case IDC_SHOWHELP:
						WASABI_API_DIALOGBOX( IDD_EVAL_HELP, hwndDlg, evalHelpDlgProc );
						break;

					case IDC_TRIGGER1:
						ctx->triggers[ 0 ]++;
						break;

					case IDC_TRIGGER2:
						ctx->triggers[ 1 ]++;
						break;

					case IDC_TRIGGER3:
						ctx->triggers[ 2 ]++;
						break;

					case IDC_TRIGGER4:
						ctx->triggers[ 3 ]++;
						break;
				}

				return 0;
			}

			case WM_TIMER:
				if ( wParam == 100 || wParam == 101 || wParam == 102 )
				{
					KillTimer( hwndDlg, wParam );
					EnterCriticalSection( &ctx->code_cs );
					GetDlgItemText( hwndDlg, wParam == 100 ? IDC_INIT : ( wParam == 101 ? IDC_PERSAMPLE : IDC_ONSLIDERCHANGE ), ctx->curpreset.code_text[ wParam - 100 ], MAX_CODE_LEN );
					ctx->code_needrecompile |= 1 << ( wParam - 100 );
					LeaveCriticalSection( &ctx->code_cs );
				}
				return 0;

			case WM_CLOSE:
#ifdef SPS_CONFIGDLG_ON_WM_CLOSE
				SPS_CONFIGDLG_ON_WM_CLOSE
#endif
					return 0;

			case WM_VSCROLL:
			{
				HWND swnd = (HWND) lParam;
				int t = (int) SendMessage( swnd, TBM_GETPOS, 0, 0 );
				if ( swnd == GetDlgItem( hwndDlg, IDC_SLIDER1 ) )
				{
					ctx->curpreset.sliderpos[ 0 ] = 1000 - t;
					ctx->sliderchange = 1;
				}

				if ( swnd == GetDlgItem( hwndDlg, IDC_SLIDER2 ) )
				{
					ctx->curpreset.sliderpos[ 1 ] = 1000 - t;
					ctx->sliderchange = 1;
				}

				if ( swnd == GetDlgItem( hwndDlg, IDC_SLIDER3 ) )
				{
					ctx->curpreset.sliderpos[ 2 ] = 1000 - t;
					ctx->sliderchange = 1;
				}

				if ( swnd == GetDlgItem( hwndDlg, IDC_SLIDER4 ) )
				{
					ctx->curpreset.sliderpos[ 3 ] = 1000 - t;
					ctx->sliderchange = 1;
				}
			}
			break;
		}
		return 0;
	}
}

#endif