for (i = 0; i < 15; i++) 
for (i = 0; i < 16; i++) 
PrefTiMidity2DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam){	int i;	static int initflag = 1; 	switch (uMess){	case WM_INITDIALOG:		SetDlgItemInt(hwnd,IDC_EDIT_VOICES,st_temp->voices,FALSE);		SetDlgItemInt(hwnd,IDC_EDIT_AMPLIFICATION,st_temp->amplification,FALSE);		DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_FREE_INST,st_temp->free_instruments_afterwards);		DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_ANTIALIAS,st_temp->antialiasing_allowed);		DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_LOADINST_PLAYING,st_temp->opt_realtime_playing);		SetDlgItemInt(hwnd,IDC_EDIT_CACHE_SIZE,st_temp->allocate_cache_size,FALSE);		SetDlgItemInt(hwnd,IDC_EDIT_REDUCE_VOICE,st_temp->reduce_voice_threshold,TRUE);		SendDlgItemMessage(hwnd,IDC_CHECKBOX_REDUCE_VOICE,BM_SETCHECK,st_temp->reduce_voice_threshold,0);		SetDlgItemInt(hwnd,IDC_EDIT_DEFAULT_TONEBANK,st_temp->default_tonebank,FALSE);		SetDlgItemInt(hwnd,IDC_EDIT_SPECIAL_TONEBANK,st_temp->special_tonebank,TRUE);		if(st_temp->special_tonebank<0){			SendDlgItemMessage(hwnd,IDC_CHECKBOX_SPECIAL_TONEBANK,BM_SETCHECK,0,0);		} else {			SendDlgItemMessage(hwnd,IDC_CHECKBOX_SPECIAL_TONEBANK,BM_SETCHECK,1,0);		}		SendMessage(hwnd,WM_COMMAND,IDC_CHECKBOX_SPECIAL_TONEBANK,0);		switch(st_temp->opt_default_mid){	 case 0x41:			CheckRadioButton(hwnd,IDC_RADIOBUTTON_GM,IDC_RADIOBUTTON_XG,IDC_RADIOBUTTON_GS);			break;	 case 0x43:			CheckRadioButton(hwnd,IDC_RADIOBUTTON_GM,IDC_RADIOBUTTON_XG,IDC_RADIOBUTTON_XG);			break;		default:	 case 0x7e:			CheckRadioButton(hwnd,IDC_RADIOBUTTON_GM,IDC_RADIOBUTTON_XG,IDC_RADIOBUTTON_GM);			break;		}		DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CTL_TRACE_PLAYING,										strchr(st_temp->opt_ctl + 1, 't'));		SetDlgItemInt(hwnd,IDC_EDIT_CTL_VEBOSITY,							char_count(st_temp->opt_ctl + 1, 'v') -							char_count(st_temp->opt_ctl + 1, 'q') + 1, TRUE);		SetDlgItemInt(hwnd,IDC_EDIT_CONTROL_RATIO,st_temp->control_ratio,FALSE);		SetDlgItemInt(hwnd,IDC_EDIT_DRUM_POWER,st_temp->opt_drum_power,FALSE);		DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_AMP_COMPENSATION,st_temp->opt_amp_compensation);		for (i = 0; i < 15; i++)			SendDlgItemMessage(hwnd, IDC_COMBO_INIT_KEYSIG,					CB_INSERTSTRING, (WPARAM) -1,					(LPARAM) cb_info_IDC_COMBO_INIT_KEYSIG[i]);		if (! st_temp->opt_pure_intonation) {			SendDlgItemMessage(hwnd, IDC_COMBO_INIT_KEYSIG, CB_SETCURSEL,					(WPARAM) 7, (LPARAM) 0);			SendDlgItemMessage(hwnd, IDC_CHECKBOX_INIT_MI, BM_SETCHECK,					0, 0);		} else {			SendDlgItemMessage(hwnd, IDC_COMBO_INIT_KEYSIG, CB_SETCURSEL,					(WPARAM) st_temp->opt_init_keysig + 7 & 0x0f,					(LPARAM) 0);			SendDlgItemMessage(hwnd, IDC_CHECKBOX_INIT_MI, BM_SETCHECK,					(st_temp->opt_init_keysig + 7 & 0x10) ? 1 : 0, 0);		}		DLG_FLAG_TO_CHECKBUTTON(hwnd, IDC_CHECKBOX_PURE_INTONATION,				st_temp->opt_pure_intonation);		SendMessage(hwnd, WM_COMMAND, IDC_CHECKBOX_PURE_INTONATION, 0);		SetDlgItemInt(hwnd, IDC_EDIT_KEY_ADJUST, st_temp->key_adjust, TRUE);		for (i = 0; i < 15; i++)			SendDlgItemMessage(hwnd, IDC_COMBO_FORCE_KEYSIG,					CB_INSERTSTRING, (WPARAM) -1,					(LPARAM) cb_info_IDC_COMBO_FORCE_KEYSIG[i]);		if (st_temp->opt_force_keysig == 8)			SendDlgItemMessage(hwnd, IDC_COMBO_FORCE_KEYSIG, CB_SETCURSEL,					(WPARAM) 7, (LPARAM) 0);		else			SendDlgItemMessage(hwnd, IDC_COMBO_FORCE_KEYSIG, CB_SETCURSEL,					(WPARAM) st_temp->opt_force_keysig + 7, (LPARAM) 0);		DLG_FLAG_TO_CHECKBUTTON(hwnd, IDC_CHECKBOX_FORCE_KEYSIG,				(st_temp->opt_force_keysig != 8));		SendMessage(hwnd, WM_COMMAND, IDC_CHECKBOX_FORCE_KEYSIG, 0);		initflag = 0;		break;	case WM_COMMAND:		switch (LOWORD(wParam)) {		case IDCLOSE:			break;		case IDC_CHECKBOX_SPECIAL_TONEBANK:			if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_SPECIAL_TONEBANK,					BM_GETCHECK, 0, 0))				EnableWindow(						GetDlgItem(hwnd, IDC_EDIT_SPECIAL_TONEBANK), TRUE);			else				EnableWindow(						GetDlgItem(hwnd, IDC_EDIT_SPECIAL_TONEBANK), FALSE);			break;		case IDC_CHECKBOX_PURE_INTONATION:			if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_PURE_INTONATION,					BM_GETCHECK, 0, 0)) {				EnableWindow(						GetDlgItem(hwnd, IDC_COMBO_INIT_KEYSIG), TRUE);				EnableWindow(						GetDlgItem(hwnd, IDC_CHECKBOX_INIT_MI), TRUE);			} else {				EnableWindow(						GetDlgItem(hwnd, IDC_COMBO_INIT_KEYSIG), FALSE);				EnableWindow(						GetDlgItem(hwnd, IDC_CHECKBOX_INIT_MI), FALSE);			}			break;		case IDC_COMBO_INIT_KEYSIG:		case IDC_CHECKBOX_INIT_MI:			st_temp->opt_init_keysig = SendDlgItemMessage(hwnd,					IDC_COMBO_INIT_KEYSIG, CB_GETCURSEL,					(WPARAM) 0, (LPARAM) 0) + ((SendDlgItemMessage(hwnd,					IDC_CHECKBOX_INIT_MI, BM_GETCHECK,					0, 0)) ? 16 : 0) - 7;			break;		case IDC_CHECKBOX_FORCE_KEYSIG:			if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_FORCE_KEYSIG,					BM_GETCHECK, 0, 0))				EnableWindow(GetDlgItem(hwnd, IDC_COMBO_FORCE_KEYSIG), TRUE);			else				EnableWindow(GetDlgItem(hwnd, IDC_COMBO_FORCE_KEYSIG), FALSE);			break;		case IDC_COMBO_FORCE_KEYSIG:			st_temp->opt_force_keysig = SendDlgItemMessage(hwnd,					IDC_COMBO_FORCE_KEYSIG, CB_GETCURSEL,					(WPARAM) 0, (LPARAM) 0) - 7;			break;		default:			break;		}		PrefWndSetOK = 1;		break;	case WM_MYSAVE:		if ( initflag ) break;	{		int i;		char *p;		st_temp->voices = GetDlgItemInt(hwnd,IDC_EDIT_VOICES,NULL,FALSE);		st_temp->amplification = GetDlgItemInt(hwnd,IDC_EDIT_AMPLIFICATION,NULL,FALSE);		DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_FREE_INST,st_temp->free_instruments_afterwards);		DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_ANTIALIAS,st_temp->antialiasing_allowed);		DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_LOADINST_PLAYING,st_temp->opt_realtime_playing);		st_temp->allocate_cache_size = GetDlgItemInt(hwnd,IDC_EDIT_CACHE_SIZE,NULL,FALSE);		if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_REDUCE_VOICE,BM_GETCHECK,0,0))		{			st_temp->reduce_voice_threshold = -1;			st_temp->auto_reduce_polyphony = 1;		}		else		{			st_temp->reduce_voice_threshold = 0;			st_temp->auto_reduce_polyphony = 0;		}		st_temp->default_tonebank = GetDlgItemInt(hwnd,IDC_EDIT_DEFAULT_TONEBANK,NULL,FALSE);		if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_SPECIAL_TONEBANK,BM_GETCHECK,0,0)){			st_temp->special_tonebank = GetDlgItemInt(hwnd,IDC_EDIT_SPECIAL_TONEBANK,NULL,TRUE);	 } else {			st_temp->special_tonebank = -1;	 }		if(SendDlgItemMessage(hwnd,IDC_RADIOBUTTON_GS,BM_GETCHECK,0,0)){		st_temp->opt_default_mid = 0x41;		} else if(SendDlgItemMessage(hwnd,IDC_RADIOBUTTON_XG,BM_GETCHECK,0,0)){		st_temp->opt_default_mid = 0x43;	 } else		st_temp->opt_default_mid = 0x7e;		SettingCtlFlag(st_temp, 't',							DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_CTL_TRACE_PLAYING,i));		/* remove 'v' and 'q' from st_temp->opt_ctl */		while(strchr(st_temp->opt_ctl + 1, 'v'))			 SettingCtlFlag(st_temp, 'v', 0);		while(strchr(st_temp->opt_ctl + 1, 'q'))			 SettingCtlFlag(st_temp, 'q', 0);		/* append 'v' or 'q' */		p = st_temp->opt_ctl + strlen(st_temp->opt_ctl);		i = GetDlgItemInt(hwnd,IDC_EDIT_CTL_VEBOSITY,NULL,TRUE);		while(i > 1) { *p++ = 'v'; i--; }		while(i < 1) { *p++ = 'q'; i++; }		st_temp->control_ratio = GetDlgItemInt(hwnd,IDC_EDIT_CONTROL_RATIO,NULL,FALSE);		st_temp->opt_drum_power = GetDlgItemInt(hwnd,IDC_EDIT_DRUM_POWER,NULL,FALSE);		DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_AMP_COMPENSATION,st_temp->opt_amp_compensation);		DLG_CHECKBUTTON_TO_FLAG(hwnd, IDC_CHECKBOX_PURE_INTONATION,				st_temp->opt_pure_intonation);		if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_PURE_INTONATION,				BM_GETCHECK, 0, 0))			st_temp->opt_init_keysig = SendDlgItemMessage(hwnd,					IDC_COMBO_INIT_KEYSIG, CB_GETCURSEL,					(WPARAM) 0, (LPARAM) 0) + ((SendDlgItemMessage(hwnd,					IDC_CHECKBOX_INIT_MI, BM_GETCHECK,					0, 0)) ? 16 : 0) - 7;		else			st_temp->opt_init_keysig = 0;		st_temp->key_adjust = GetDlgItemInt(				hwnd, IDC_EDIT_KEY_ADJUST, NULL, TRUE);		if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_FORCE_KEYSIG,				BM_GETCHECK, 0, 0))			st_temp->opt_force_keysig = SendDlgItemMessage(hwnd,					IDC_COMBO_FORCE_KEYSIG, CB_GETCURSEL,					(WPARAM) 0, (LPARAM) 0) - 7;		else			st_temp->opt_force_keysig = 8;		SetWindowLong(hwnd,DWL_MSGRESULT,FALSE);	}		break;  case WM_SIZE:		return FALSE;	case WM_CLOSE:		break;	default:	  break;	}	return FALSE;}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/6e735c2764b7b157d0d160045412a4c2cdcead39/w32g_pref.c/clean/interface/w32g_pref.c