//
// Initialize the dialog based on the information the class was initialized with
//
BOOLEAN AddEditExemptionDialog::OnInit()
{
	BOOLEAN UseDefaults = TRUE;
	LPTSTR  PathLabelText = NULL;

	// ADDEDIT_EXEMPTION_LABEL_PATH
	// ADDEDIT_EXEMPTION_EDIT_PATH
	// ADDEDIT_EXEMPTION_BUTTON_FIND
	// ADDEDIT_EXEMPTION_CHECK_RANDALLOC
	// ADDEDIT_EXEMPTION_CHECK_RANDIMAGE
	// ADDEDIT_EXEMPTION_BUTTON_OK
	// ADDEDIT_EXEMPTION_BUTTON_CANCEL

	UpdateControlText(
			ADDEDIT_EXEMPTION_CHECK_RANDALLOC,
			IDS_DISABLE_RANDALLOC);
	UpdateControlText(
			ADDEDIT_EXEMPTION_CHECK_RANDIMAGE,
			IDS_DISABLE_RANDIMAGE);
	UpdateControlText(
			ADDEDIT_EXEMPTION_CHECK_NRE_SEH,
			IDS_DISABLE_NRE_SEH);
	UpdateControlText(
			ADDEDIT_EXEMPTION_CHECK_NRE_STACK,
			IDS_DISABLE_NRE_STACK);
	UpdateControlText(
			ADDEDIT_EXEMPTION_CHECK_NRE_FORMAT,
			IDS_DISABLE_NRE_FORMAT);

	//
	// Set the path label
	//
	switch (Type)
	{
		case ApplicationExemption:
			PathLabelText = Locale::LoadStringDefault(
					IDS_APPLICATION_PATH_TO_EXEMPT,
					TEXT("Application executable path to exempt:"));
			break;
		case DirectoryExemption:
			PathLabelText = Locale::LoadStringDefault(
					IDS_DIRECTORY_PATH_TO_EXEMPT,
					TEXT("Directory path to exempt:"));
			break;
		case ImageFileExemption:
			PathLabelText = Locale::LoadStringDefault(
					IDS_IMAGE_FILE_PATH_TO_EXEMPT,
					TEXT("Image file path to exempt:"));
			break;
		default:
			break;
	}

	if (PathLabelText)
	{
		HWND PathLabelWindow = GetControl(
				ADDEDIT_EXEMPTION_LABEL_PATH);

		SendMessage(
				PathLabelWindow,
				WM_SETTEXT,
				NULL,
				(LPARAM)(LPTSTR)PathLabelText);

		Locale::FreeString(
				PathLabelText);
	}

	//
	// Set the edit path if we were supplied an NT path and get information about
	// it
	//
	if (NtFilePath)
	{
		LPTSTR EditTitleText = NULL;
		DWORD  Result;
		HWND   PathEditWindow = GetControl(
				ADDEDIT_EXEMPTION_EDIT_PATH);

		SendMessage(
				PathEditWindow,
				WM_SETTEXT,
				NULL,
				(LPARAM)(LPTSTR)NtFilePath);

		if ((Result = Config::GetExemptionInfo(
				Scope,
				Type,
				NtFilePath,
				&Flags)) == ERROR_SUCCESS)
		{
			ModifyCheck(
					ADDEDIT_EXEMPTION_CHECK_RANDALLOC,
					(Flags & EXEMPT_MEMORY_ALLOCATIONS)
						? TRUE : FALSE);
			ModifyCheck(
					ADDEDIT_EXEMPTION_CHECK_RANDIMAGE,
					(Flags & EXEMPT_IMAGE_FILES)
						? TRUE : FALSE);

			ModifyCheck(
					ADDEDIT_EXEMPTION_CHECK_NRE_SEH,
					(Flags & EXEMPT_NRE_SEH)
						? TRUE : FALSE);
			ModifyCheck(
					ADDEDIT_EXEMPTION_CHECK_NRE_STACK,
					(Flags & EXEMPT_NRE_STACK)
						? TRUE : FALSE);
			ModifyCheck(
					ADDEDIT_EXEMPTION_CHECK_NRE_FORMAT,
					(Flags & EXEMPT_NRE_FORMAT)
						? TRUE : FALSE);

			UseDefaults = FALSE;
		}
		
		EditTitleText = Locale::LoadStringDefault(
					IDS_EDIT_EXEMPTION,
					TEXT("Edit Exemption"));

		if (EditTitleText)
		{
			SendMessage(
					GetWindow(),
					WM_SETTEXT,
					0,
					(LPARAM)(LPTSTR)EditTitleText);

			Locale::FreeString(
					EditTitleText);
		}

		//
		// Don't allow the editing of the path
		//
		EnableControl(
				ADDEDIT_EXEMPTION_EDIT_PATH,
				FALSE);
		EnableControl(
				ADDEDIT_EXEMPTION_BUTTON_FIND,
				FALSE);
	}
	else
	{
		LPTSTR AddTitleText = Locale::LoadStringDefault(
					IDS_ADD_EXEMPTION,
					TEXT("Add Exemption"));

		if (AddTitleText)
		{
			SendMessage(
					GetWindow(),
					WM_SETTEXT,
					0,
					(LPARAM)(LPTSTR)AddTitleText);

			Locale::FreeString(
					AddTitleText);
		}
	}

	//
	// If we should use the default check state...
	//
	if (UseDefaults)
	{
		//
		// Initialize the check state
		//
		if ((Type == ApplicationExemption) ||
		    (Type == DirectoryExemption))
		{
			ModifyCheck(
					ADDEDIT_EXEMPTION_CHECK_RANDALLOC,
					TRUE);
			ModifyCheck(
					ADDEDIT_EXEMPTION_CHECK_RANDIMAGE,
					TRUE);
		}
		else
		{
			ModifyCheck(
					ADDEDIT_EXEMPTION_CHECK_RANDIMAGE,
					TRUE);
		}
	}

	//
	// If it's not an application exemption, disable the NRE protection
	// mechanisms.
	//
	if (Type != ApplicationExemption)
	{
		EnableControl(
				ADDEDIT_EXEMPTION_CHECK_NRE_SEH,
				FALSE);
		EnableControl(
				ADDEDIT_EXEMPTION_CHECK_NRE_STACK,
				FALSE);
		EnableControl(
				ADDEDIT_EXEMPTION_CHECK_NRE_FORMAT,
				FALSE);
	}
	//
	// Otherwise, if it is an application exemption and we should use defaults,
	// check all three of them.
	//
	else if (UseDefaults)
	{
		ModifyCheck(
				ADDEDIT_EXEMPTION_CHECK_NRE_SEH,
				FALSE);
		ModifyCheck(
				ADDEDIT_EXEMPTION_CHECK_NRE_STACK,
				FALSE);
		ModifyCheck(
				ADDEDIT_EXEMPTION_CHECK_NRE_FORMAT,
				FALSE);
	}

	//
	// If it's an image file exemption, disable the randomized allocations check
	// as it's not applicable
	//
	if (Type == ImageFileExemption)
	{
		EnableControl(
				ADDEDIT_EXEMPTION_CHECK_RANDALLOC,
				FALSE);
	}

	return TRUE;
}
Example #2
0
void EffectDistortion::UpdateUI()
{
   // set control text and names to match distortion type
   switch (mParams.mTableChoiceIndx)
      {
      case kHardClip:
         UpdateControlText(mThresholdT, mOldThresholdTxt, true);
         UpdateControlText(mNoiseFloorT, mOldmNoiseFloorTxt, false);
         UpdateControlText(mParam1T, mOldParam1Txt, true);
         UpdateControlText(mParam2T, mOldParam2Txt, true);
         UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);

         UpdateControl(ID_Threshold, true, _("Clipping level"));
         UpdateControl(ID_NoiseFloor, false, defaultLabel[1]);
         UpdateControl(ID_Param1, true, _("Drive"));
         UpdateControl(ID_Param2, true, _("Make-up Gain"));
         UpdateControl(ID_Repeats, false, defaultLabel[4]);
         UpdateControl(ID_DCBlock, false, wxEmptyString);
         break;
      case kSoftClip:
         UpdateControlText(mThresholdT, mOldThresholdTxt, true);
         UpdateControlText(mNoiseFloorT, mOldmNoiseFloorTxt, false);
         UpdateControlText(mParam1T, mOldParam1Txt, true);
         UpdateControlText(mParam2T, mOldParam2Txt, true);
         UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);

         UpdateControl(ID_Threshold, true, _("Clipping threshold"));
         UpdateControl(ID_NoiseFloor, false, defaultLabel[1]);
         UpdateControl(ID_Param1, true, _("Hardness"));
         UpdateControl(ID_Param2, true, _("Make-up Gain"));
         UpdateControl(ID_Repeats, false, defaultLabel[4]);
         UpdateControl(ID_DCBlock, false, wxEmptyString);
         break;
      case kHalfSinCurve:
         UpdateControlText(mThresholdT, mOldThresholdTxt, false);
         UpdateControlText(mNoiseFloorT, mOldmNoiseFloorTxt, false);
         UpdateControlText(mParam1T, mOldParam1Txt, true);
         UpdateControlText(mParam2T, mOldParam2Txt, true);
         UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);

         UpdateControl(ID_Threshold, false, defaultLabel[0]);
         UpdateControl(ID_NoiseFloor, false, defaultLabel[1]);
         UpdateControl(ID_Param1, true, _("Distortion amount"));
         UpdateControl(ID_Param2, true, _("Output level"));
         UpdateControl(ID_Repeats, false, defaultLabel[4]);
         UpdateControl(ID_DCBlock, false, wxEmptyString);
         break;
      case kExpCurve:
         UpdateControlText(mThresholdT, mOldThresholdTxt, false);
         UpdateControlText(mNoiseFloorT, mOldmNoiseFloorTxt, false);
         UpdateControlText(mParam1T, mOldParam1Txt, true);
         UpdateControlText(mParam2T, mOldParam2Txt, true);
         UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);

         UpdateControl(ID_Threshold, false, defaultLabel[0]);
         UpdateControl(ID_NoiseFloor, false, defaultLabel[1]);
         UpdateControl(ID_Param1, true, _("Distortion amount"));
         UpdateControl(ID_Param2, true, _("Output level"));
         UpdateControl(ID_Repeats, false, defaultLabel[4]);
         UpdateControl(ID_DCBlock, false, wxEmptyString);
         break;
      case kLogCurve:
         UpdateControlText(mThresholdT, mOldThresholdTxt, false);
         UpdateControlText(mNoiseFloorT, mOldmNoiseFloorTxt, false);
         UpdateControlText(mParam1T, mOldParam1Txt, true);
         UpdateControlText(mParam2T, mOldParam2Txt, true);
         UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);

         UpdateControl(ID_Threshold, false, defaultLabel[0]);
         UpdateControl(ID_NoiseFloor, false, defaultLabel[1]);
         UpdateControl(ID_Param1, true, _("Distortion amount"));
         UpdateControl(ID_Param2, true, _("Output level"));
         UpdateControl(ID_Repeats, false, defaultLabel[4]);
         UpdateControl(ID_DCBlock, false, wxEmptyString);
         break;
      case kCubic:
         UpdateControlText(mThresholdT, mOldThresholdTxt, false);
         UpdateControlText(mNoiseFloorT, mOldmNoiseFloorTxt, false);
         UpdateControlText(mParam1T, mOldParam1Txt, true);
         UpdateControlText(mParam2T, mOldParam2Txt, true);
         UpdateControlText(mRepeatsT, mOldRepeatsTxt, true);

         UpdateControl(ID_Threshold, false, defaultLabel[0]);
         UpdateControl(ID_NoiseFloor, false, defaultLabel[1]);
         UpdateControl(ID_Param1, true, _("Distortion amount"));
         UpdateControl(ID_Param2, true, _("Output level"));
         UpdateControl(ID_Repeats, true, _("Repeat processing"));
         UpdateControl(ID_DCBlock, false, wxEmptyString);
         break;
      case kEvenHarmonics:
         UpdateControlText(mThresholdT, mOldThresholdTxt, false);
         UpdateControlText(mNoiseFloorT, mOldmNoiseFloorTxt, false);
         UpdateControlText(mParam1T, mOldParam1Txt, true);
         UpdateControlText(mParam2T, mOldParam2Txt, true);
         UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);

         UpdateControl(ID_Threshold, false, defaultLabel[0]);
         UpdateControl(ID_NoiseFloor, false, defaultLabel[1]);
         UpdateControl(ID_Param1, true, _("Distortion amount"));
         UpdateControl(ID_Param2, true, _("Harmonic brightness"));
         UpdateControl(ID_Repeats, false, defaultLabel[4]);
         UpdateControl(ID_DCBlock, true, wxEmptyString);
         break;
      case kSinCurve:
         UpdateControlText(mThresholdT, mOldThresholdTxt, false);
         UpdateControlText(mNoiseFloorT, mOldmNoiseFloorTxt, false);
         UpdateControlText(mParam1T, mOldParam1Txt, true);
         UpdateControlText(mParam2T, mOldParam2Txt, true);
         UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);

         UpdateControl(ID_Threshold, false, defaultLabel[0]);
         UpdateControl(ID_NoiseFloor, false, defaultLabel[1]);
         UpdateControl(ID_Param1, true, _("Distortion amount"));
         UpdateControl(ID_Param2, true, _("Output level"));
         UpdateControl(ID_Repeats, false, defaultLabel[4]);
         UpdateControl(ID_DCBlock, false, wxEmptyString);
         break;
      case kLeveller:
         UpdateControlText(mThresholdT, mOldThresholdTxt, false);
         UpdateControlText(mNoiseFloorT, mOldmNoiseFloorTxt, true);
         UpdateControlText(mParam1T, mOldParam1Txt, true);
         UpdateControlText(mParam2T, mOldParam2Txt, false);
         UpdateControlText(mRepeatsT, mOldRepeatsTxt, true);

         UpdateControl(ID_Threshold, false, defaultLabel[0]);
         UpdateControl(ID_NoiseFloor, true, defaultLabel[1]);
         UpdateControl(ID_Param1, true, _("Levelling fine adjustment"));
         UpdateControl(ID_Param2, false, defaultLabel[3]);
         UpdateControl(ID_Repeats, true, _("Degree of Levelling"));
         UpdateControl(ID_DCBlock, false, wxEmptyString);
         break;
      case kRectifier:
         UpdateControlText(mThresholdT, mOldThresholdTxt, false);
         UpdateControlText(mNoiseFloorT, mOldmNoiseFloorTxt, false);
         UpdateControlText(mParam1T, mOldParam1Txt, true);
         UpdateControlText(mParam2T, mOldParam2Txt, false);
         UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);

         UpdateControl(ID_Threshold, false, defaultLabel[0]);
         UpdateControl(ID_NoiseFloor, false, defaultLabel[1]);
         UpdateControl(ID_Param1, true, _("Distortion amount"));
         UpdateControl(ID_Param2, false, defaultLabel[3]);
         UpdateControl(ID_Repeats, false, defaultLabel[4]);
         UpdateControl(ID_DCBlock, true, wxEmptyString);
         break;
      case kHardLimiter:
         UpdateControlText(mThresholdT, mOldThresholdTxt, true);
         UpdateControlText(mNoiseFloorT, mOldmNoiseFloorTxt, false);
         UpdateControlText(mParam1T, mOldParam1Txt, true);
         UpdateControlText(mParam2T, mOldParam2Txt, true);
         UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);

         UpdateControl(ID_Threshold, true, _("dB Limit"));
         UpdateControl(ID_NoiseFloor, false, defaultLabel[1]);
         UpdateControl(ID_Param1, true, _("Wet level"));
         UpdateControl(ID_Param2, true, _("Residual level"));
         UpdateControl(ID_Repeats, false, defaultLabel[4]);
         UpdateControl(ID_DCBlock, false, wxEmptyString);
         break;
      default:
         UpdateControl(ID_Threshold,   true, defaultLabel[0]);
         UpdateControl(ID_NoiseFloor,  true, defaultLabel[1]);
         UpdateControl(ID_Param1,      true, defaultLabel[2]);
         UpdateControl(ID_Param2,      true, defaultLabel[3]);
         UpdateControl(ID_Repeats,     true, defaultLabel[4]);
         UpdateControl(ID_DCBlock,     false, wxEmptyString);
   }
}