//----------------------------------------------------------------------------------------------
//	ApplySetting
//----------------------------------------------------------------------------------------------
VOID CActuatorPage::ApplySetting()
{
	//	「コントローラの振動」
	SetCheckBoxState( IDC_ACTUATOR, CurrentSetting->Actuator );
	if( CurrentSetting->Actuator == TRUE )
	{
		EnableControls( IDC_STATIC_601, IDC_STATIC_613, TRUE );
	} else {
		EnableControls( IDC_STATIC_601, IDC_STATIC_613, FALSE );
	}

	//	「左アクチュエータ」
	SetTrackBarPos(
		 IDC_LEFT_ACTUATOR_LEVEL
		,CurrentSetting->ActuatorLevel[INDEX_LEFT_ACTUATOR] );
	//	「右アクチュエータ」
	SetTrackBarPos(
		 IDC_RIGHT_ACTUATOR_LEVEL
		,CurrentSetting->ActuatorLevel[INDEX_RIGHT_ACTUATOR] );

	//	「振動の有効範囲」
	SetTrackBarRange(
		 IDC_ACTUATOR_THRESHOLD
		,CurrentSetting->ActuatorMinThreshold
		,CurrentSetting->ActuatorMaxThreshold );
	SetTrackBarPos( IDC_ACTUATOR_THRESHOLD, CurrentSetting->ActuatorMinThreshold );
}
Esempio n. 2
0
void CCheckBox::ToggleCheckBoxState()
{
  switch (m_eCheckBoxState)
  {
    case UNCHECKED:
      SetCheckBoxState(CHECKED);
      CMessageServer::Instance().QueueMessage(new TIntMessage(CMessage::CTRL_VALUECHANGE, m_pParentWindow, this, 1));
      break;
    case CHECKED:
      SetCheckBoxState(UNCHECKED);
      CMessageServer::Instance().QueueMessage(new TIntMessage(CMessage::CTRL_VALUECHANGE, m_pParentWindow, this, 0));
      break;
    default:
      break;
  }
}
Esempio n. 3
0
bool CCheckBox::HandleMessage(CMessage* pMessage)
{
	bool bHandled = false;

	if (pMessage)
	{
		switch(pMessage->MessageType())
		{
		case CMessage::MOUSE_BUTTONUP:
		{
			CMouseMessage* pMouseMessage = dynamic_cast<CMouseMessage*>(pMessage);
			if (pMouseMessage && (m_ClientRect.HitTest(ViewToWindow(pMouseMessage->Point)) != CRect::RELPOS_INSIDE)
				&& (m_MouseButton == pMouseMessage->Button))
			{
				m_MouseButton = 0;
				bHandled = true;
			}
			break;
		}
		case CMessage::CTRL_SINGLELCLICK:
			if (pMessage->Destination() == this)
			{
				switch (m_eCheckBoxState)
				{
				case UNCHECKED:
					SetCheckBoxState(CHECKED);
					CMessageServer::Instance().QueueMessage(new TIntMessage(CMessage::CTRL_VALUECHANGE, m_pParentWindow, this, 1));
					break;
				case CHECKED:
					SetCheckBoxState(UNCHECKED);
					CMessageServer::Instance().QueueMessage(new TIntMessage(CMessage::CTRL_VALUECHANGE, m_pParentWindow, this, 0));
					break;
				default:
					break;
				}
				bHandled = true;
			}
			break;
		default :
			bHandled = CWindow::HandleMessage(pMessage);
			break;
		}
	}

	return bHandled;
}
Esempio n. 4
0
void CWordStyleFormatDialog::PreLayoutDynInitL()
	{
	//
	// Dynamically change the title of this dialog as appropriate
	TInt id = (iButton == EWordCidAddStyle)?
		R_WORD_STYLEFORMAT_TITLE_ADD : R_WORD_STYLEFORMAT_TITLE_MODIFY;
	if (id == R_WORD_STYLEFORMAT_TITLE_ADD)
		SetTitleL(id);
	else
		{
		TBuf<24> buf;
		iCoeEnv->ReadResource(buf,R_WORD_STYLEFORMAT_TITLE_MODIFY);
		TBuf<24+KMaxParagraphStyleName> title; // 56
		TParagraphStyleName name;
		name = (iNormalStyle)? iNormalName : iParagraphStyle->iName;
		title.Format(buf,&name);
		SetTitleL(title);
		}
	//
	TParaFormatMask paraMask;
	CParaFormat* paraFormat=CParaFormat::NewLC();
	ButtonGroupContainer().ButtonById(EWordCidFormatList)->
		SetButtonLayout(CEikCommandButton::ETextLeftPictureRight);
	if (iNormalStyle)
		{
		TParagraphStyleName name;
		iCoeEnv->ReadResource(name , R_WORD_NORMAL);
		SetEdwinTextL(EWordCidStyleName,&name);
		SetLineDimmedNow(EWordCidStyleName,ETrue);
		SetLineDimmedNow(EWordCidOutline,ETrue);
		iText->GlobalParaFormatLayer()->SenseL(paraFormat,paraMask);
		}
	else
		{
		SetEdwinTextL(EWordCidStyleName,&iParagraphStyle->iName);
		TUid type=iParagraphStyle->Type();
		if (type==KSystemParagraphStyleUid)
			SetLineDimmedNow(EWordCidStyleName,ETrue);
		iParagraphStyle->SenseL(paraFormat,paraMask);
		}
	//hotkey
	if (iButton==EWordCidModifyStyle)
		{
		CEikCharEditor* editor=(CEikCharEditor*)Control(EWordCidHotKey);
		editor->SetChar(iChar);
		}
	//
	CEikButtonBase::TState state;
	state=(paraFormat->iBullet)? CEikButtonBase::ESet : CEikButtonBase::EClear ;
	SetCheckBoxState(EWordCidBullet,state);

	// Set values for Outline level

	SetNumberEditorValue(EWordCidOutline,iOutline);

	CleanupStack::PopAndDestroy();
	}
Esempio n. 5
0
BOOL CMessengerDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  여기에 추가 초기화 작업을 추가합니다.
	SetCheckBoxState();

	return TRUE;  // return TRUE unless you set the focus to a control
	// 예외: OCX 속성 페이지는 FALSE를 반환해야 합니다.
}
//----------------------------------------------------------------------------------------------
//	ApplySetting
//----------------------------------------------------------------------------------------------
VOID CStickPage::ApplySetting()
{
	//	「スティックの機能(左)」
	SetComboBoxIndex( IDC_LEFT_STICK_USAGE, CurrentSetting->StickUsage[INDEX_LEFT_STICK] );
	//	「上下を反転する(左)」
	SetCheckBoxState(
		 IDC_LEFT_STICK_REVERSE_Y
		,CurrentSetting->StickReverseY[INDEX_LEFT_STICK] );
	//	「スティックの機能(左)」が「なし」の場合は、「上下を反転する(左)」を無効にする
	if( CurrentSetting->StickUsage[INDEX_LEFT_STICK] == USAGE_NONE )
	{
		EnableControl( IDC_LEFT_STICK_REVERSE_Y, FALSE );
	} else {
		EnableControl( IDC_LEFT_STICK_REVERSE_Y, TRUE );
	}

	//	「スティックの機能(右)」
	SetComboBoxIndex( IDC_RIGHT_STICK_USAGE, CurrentSetting->StickUsage[INDEX_RIGHT_STICK] );
	//	「上下を反転する(右)」
	SetCheckBoxState(
		 IDC_RIGHT_STICK_REVERSE_Y
		,CurrentSetting->StickReverseY[INDEX_RIGHT_STICK] );
	//	「スティックの機能(右)」が「なし」の場合は、「上下を反転する(右)」を無効にする
	if( CurrentSetting->StickUsage[INDEX_RIGHT_STICK] == USAGE_NONE )
	{
		EnableControl( IDC_RIGHT_STICK_REVERSE_Y, FALSE );
	} else {
		EnableControl( IDC_RIGHT_STICK_REVERSE_Y, TRUE );
	}

	//	「有効範囲」
	SetTrackBarRange(
		 IDC_STICK_THRESHOLD
		,CurrentSetting->StickMinThreshold[INDEX_LEFT_STICK]
		,CurrentSetting->StickMaxThreshold[INDEX_LEFT_STICK] );
	SetTrackBarPos( IDC_STICK_THRESHOLD, CurrentSetting->StickMinThreshold[INDEX_LEFT_STICK] );
	//	「スティックの入力閾値」
	SetTrackBarPos(
		 IDC_STICK_HAT_SWITCH_THRESHOLD
		,CurrentSetting->StickHatSwitchThreshold[INDEX_LEFT_STICK] );
}
Esempio n. 7
0
static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hWnd);
		//make dialog represent the current options
		bWmNotify = TRUE;
		SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_SETCOLOUR, 0, options->colBackMsg);
		SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_SETCOLOUR, 0, options->colTextMsg);
		SendDlgItemMessage(hWnd, IDC_COLBACK_URL, CPM_SETCOLOUR, 0, options->colBackUrl);
		SendDlgItemMessage(hWnd, IDC_COLTEXT_URL, CPM_SETCOLOUR, 0, options->colTextUrl);
		SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_SETCOLOUR, 0, options->colBackFile);
		SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_SETCOLOUR, 0, options->colTextFile);
		SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_SETCOLOUR, 0, options->colBackOthers);
		SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_SETCOLOUR, 0, options->colTextOthers);
		SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_MESSAGE, options->bDefaultColorMsg);
		SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_URL, options->bDefaultColorUrl);
		SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_FILE, options->bDefaultColorFile);
		SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_OTHERS, options->bDefaultColorOthers);
		SetCheckBoxState(hWnd, IDC_CHKMENUITEM, options->bMenuitem);
		SetCheckBoxState(hWnd, IDC_CHKDISABLE, options->bDisable);
		SetCheckBoxState(hWnd, IDC_CHKPREVIEW, options->bPreview);
		SetCheckBoxState(hWnd, IDC_CHKMERGEPOPUP, options->bMergePopup);
		SetCheckBoxState(hWnd, IDC_CHKNOTIFY_MESSAGE, options->maskNotify & MASK_MESSAGE);
		SetCheckBoxState(hWnd, IDC_CHKNOTIFY_URL, options->maskNotify & MASK_URL);
		SetCheckBoxState(hWnd, IDC_CHKNOTIFY_FILE, options->maskNotify & MASK_FILE);
		SetCheckBoxState(hWnd, IDC_CHKNOTIFY_OTHER, options->maskNotify & MASK_OTHER);
		SetCheckBoxState(hWnd, IDC_CHKACTL_DISMISS, options->maskActL & MASK_DISMISS);
		SetCheckBoxState(hWnd, IDC_CHKACTL_OPEN, options->maskActL & MASK_OPEN);
		SetCheckBoxState(hWnd, IDC_CHKACTL_REMOVE, options->maskActL & MASK_REMOVE);
		SetCheckBoxState(hWnd, IDC_CHKACTR_DISMISS, options->maskActR & MASK_DISMISS);
		SetCheckBoxState(hWnd, IDC_CHKACTR_OPEN, options->maskActR & MASK_OPEN);
		SetCheckBoxState(hWnd, IDC_CHKACTR_REMOVE, options->maskActR & MASK_REMOVE);
		SetCheckBoxState(hWnd, IDC_CHKACTTE_DISMISS, options->maskActTE & MASK_DISMISS);
		SetCheckBoxState(hWnd, IDC_CHKACTTE_OPEN, options->maskActTE & MASK_OPEN);
		SetCheckBoxState(hWnd, IDC_CHKACTTE_REMOVE, options->maskActTE & MASK_REMOVE);
		SetCheckBoxState(hWnd, IDC_CHKWINDOWCHECK, options->bMsgWindowCheck);
		SetCheckBoxState(hWnd, IDC_CHKREPLYWINDOW, options->bMsgReplyWindow);
		SetCheckBoxState(hWnd, IDC_CHKSHOWDATE, options->bShowDate);
		SetCheckBoxState(hWnd, IDC_CHKSHOWTIME, options->bShowTime);
		SetCheckBoxState(hWnd, IDC_CHKSHOWHEADERS, options->bShowHeaders);
		SetCheckBoxState(hWnd, IDC_RDNEW, !options->bShowON);
		SetCheckBoxState(hWnd, IDC_RDOLD, options->bShowON);
		SetCheckBoxState(hWnd, IDC_CHKHIDESEND, options->bHideSend);
		SetCheckBoxState(hWnd, IDC_SUPRESSRSS, options->bNoRSS);
		SetCheckBoxState(hWnd, IDC_READCHECK, options->bReadCheck);
		SetCheckBoxState(hWnd, IDC_CHKINFINITE_MESSAGE, options->iDelayMsg == -1);
		SetCheckBoxState(hWnd, IDC_CHKINFINITE_URL, options->iDelayUrl == -1);
		SetCheckBoxState(hWnd, IDC_CHKINFINITE_FILE, options->iDelayFile == -1);
		SetCheckBoxState(hWnd, IDC_CHKINFINITE_OTHERS, options->iDelayOthers == -1);
		SetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, options->iDelayMsg != -1 ? options->iDelayMsg : 0, TRUE);
		SetDlgItemInt(hWnd, IDC_DELAY_URL, options->iDelayUrl != -1 ? options->iDelayUrl : 0, TRUE);
		SetDlgItemInt(hWnd, IDC_DELAY_FILE, options->iDelayFile != -1 ? options->iDelayFile : 0, TRUE);
		SetDlgItemInt(hWnd, IDC_DELAY_OTHERS, options->iDelayOthers != -1 ? options->iDelayOthers : 0, TRUE);
		SetDlgItemInt(hWnd, IDC_NUMBERMSG, options->iNumberMsg, FALSE);
		//update items' states 
		UpdateOptionsDlgItemsState(hWnd);
		bWmNotify = FALSE;
		return TRUE;

	case WM_COMMAND:
		if (!bWmNotify) {
			switch (LOWORD(wParam)) {
			case IDC_PREVIEW:
				PopupPreview(options);
				break;
			default:
				//update options
				options->maskNotify = (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_MESSAGE) ? MASK_MESSAGE : 0) |
					(IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_URL) ? MASK_URL : 0) |
					(IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_FILE) ? MASK_FILE : 0) |
					(IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_OTHER) ? MASK_OTHER : 0);
				options->maskActL = (IsDlgButtonChecked(hWnd, IDC_CHKACTL_DISMISS) ? MASK_DISMISS : 0) |
					(IsDlgButtonChecked(hWnd, IDC_CHKACTL_OPEN) ? MASK_OPEN : 0) |
					(IsDlgButtonChecked(hWnd, IDC_CHKACTL_REMOVE) ? MASK_REMOVE : 0);
				options->maskActR = (IsDlgButtonChecked(hWnd, IDC_CHKACTR_DISMISS) ? MASK_DISMISS : 0) |
					(IsDlgButtonChecked(hWnd, IDC_CHKACTR_OPEN) ? MASK_OPEN : 0) |
					(IsDlgButtonChecked(hWnd, IDC_CHKACTR_REMOVE) ? MASK_REMOVE : 0);
				options->maskActTE = (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_DISMISS) ? MASK_DISMISS : 0) |
					(IsDlgButtonChecked(hWnd, IDC_CHKACTTE_OPEN) ? MASK_OPEN : 0) |
					(IsDlgButtonChecked(hWnd, IDC_CHKACTTE_REMOVE) ? MASK_REMOVE : 0);
				options->bDefaultColorMsg = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_MESSAGE);
				options->bDefaultColorUrl = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_URL);
				options->bDefaultColorFile = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_FILE);
				options->bDefaultColorOthers = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_OTHERS);
				options->bMenuitem = IsDlgButtonChecked(hWnd, IDC_CHKMENUITEM);
				options->bDisable = IsDlgButtonChecked(hWnd, IDC_CHKDISABLE);
				options->bPreview = IsDlgButtonChecked(hWnd, IDC_CHKPREVIEW);
				options->iDelayMsg = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_MESSAGE) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, NULL, FALSE);
				options->iDelayUrl = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_URL) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_URL, NULL, FALSE);
				options->iDelayFile = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_FILE) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_FILE, NULL, FALSE);
				options->iDelayOthers = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_OTHERS) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_OTHERS, NULL, FALSE);
				options->bMergePopup = IsDlgButtonChecked(hWnd, IDC_CHKMERGEPOPUP);
				options->bMsgWindowCheck = IsDlgButtonChecked(hWnd, IDC_CHKWINDOWCHECK);
				options->bMsgReplyWindow = IsDlgButtonChecked(hWnd, IDC_CHKREPLYWINDOW);
				options->bShowDate = IsDlgButtonChecked(hWnd, IDC_CHKSHOWDATE);
				options->bShowTime = IsDlgButtonChecked(hWnd, IDC_CHKSHOWTIME);
				options->bShowHeaders = IsDlgButtonChecked(hWnd, IDC_CHKSHOWHEADERS);
				options->bShowON = IsDlgButtonChecked(hWnd, IDC_RDOLD);
				options->bShowON = BST_UNCHECKED == IsDlgButtonChecked(hWnd, IDC_RDNEW);
				options->bHideSend = IsDlgButtonChecked(hWnd, IDC_CHKHIDESEND);
				options->iNumberMsg = GetDlgItemInt(hWnd, IDC_NUMBERMSG, NULL, FALSE);
				options->bNoRSS = IsDlgButtonChecked(hWnd, IDC_SUPRESSRSS);
				options->bReadCheck = IsDlgButtonChecked(hWnd, IDC_READCHECK);
				//update items' states
				UpdateOptionsDlgItemsState(hWnd);
				if (HIWORD(wParam) == CPN_COLOURCHANGED) {
					options->colBackMsg = SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_GETCOLOUR, 0, 0);
					options->colTextMsg = SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_GETCOLOUR, 0, 0);
					options->colBackUrl = SendDlgItemMessage(hWnd, IDC_COLBACK_URL, CPM_GETCOLOUR, 0, 0);
					options->colTextUrl = SendDlgItemMessage(hWnd, IDC_COLTEXT_URL, CPM_GETCOLOUR, 0, 0);
					options->colBackFile = SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_GETCOLOUR, 0, 0);
					options->colTextFile = SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_GETCOLOUR, 0, 0);
					options->colBackOthers = SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_GETCOLOUR, 0, 0);
					options->colTextOthers = SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_GETCOLOUR, 0, 0);
				}
				//send changes to mi
				MenuitemUpdate(!options->bDisable);
				//enable "Apply" button
				SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
				break;
			}
		}
		break;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case PSN_APPLY:
			OptionsWrite();
			break;

		case PSN_RESET:
			OptionsRead();

			//maybe something changed with the mi
			MenuitemUpdate(!options->bDisable);
			break;
		}
		break;
	}
	return FALSE;
}
Esempio n. 8
0
//To initialize dialog data
void COptionsDialog::PreLayoutDynInitL()
{
    if (!(iPingModel->iPackLimit))
    {
        SetCheckBoxState(EPingNumPackCheckBox, CEikButtonBase::EClear);
        MakeLineVisible(EPingNumPackNum,EFalse);
        SetLineDimmedNow(EPingNumPackNum,ETrue);
    }
    else
    {
        SetCheckBoxState(EPingNumPackCheckBox, CEikButtonBase::ESet);
    }
    SetNumberEditorValue(EPingNumPackNum, iPingModel->iTotalPackets);
    
    // This lines should be disabled if next commented code is active
    SetLineDimmedNow(EPingNoResolvCheckBox,ETrue);
    MakeLineVisible(EPingNoResolvCheckBox,EFalse);
    /*
    if (iPingModel->iNumericOutput)
        SetCheckBoxState(EPingNoResolvCheckBox, CEikButtonBase::ESet);
    else
        SetCheckBoxState(EPingNoResolvCheckBox, CEikButtonBase::EClear);
    */

    if (iPingModel->iDebug)
        SetCheckBoxState(EPingDebugCheckBox, CEikButtonBase::ESet);
    else
        SetCheckBoxState(EPingDebugCheckBox, CEikButtonBase::EClear);

    if (iPingModel->iQuiet)
        SetCheckBoxState(EPingQuietCheckBox, CEikButtonBase::ESet);
    else
        SetCheckBoxState(EPingQuietCheckBox, CEikButtonBase::EClear);

    // This lines should be disabled if next commented code is active
    SetLineDimmedNow(EPingHopLimitCheckBox,ETrue);
    MakeLineVisible(EPingHopLimitCheckBox,EFalse);
    SetLineDimmedNow(EPingHopLimitNum,ETrue);
    MakeLineVisible(EPingHopLimitNum,EFalse);
    // This option is disabled by now. Code is commented in .rss and pingmodel.cpp
/*DO NOT REMOVE!!!
    if (iPingModel->iHopLimit==0)
    {
        SetCheckBoxState(EPingHopLimitCheckBox, CEikButtonBase::EClear);
        MakeLineVisible(EPingHopLimitNum,EFalse);
        SetLineDimmedNow(EPingHopLimitNum,ETrue);
        SetNumberEditorValue(EPingHopLimitNum, 255);    //Max TTL (in hops)
    }
    else
    {
        SetCheckBoxState(EPingNumPackCheckBox, CEikButtonBase::ESet);
        SetNumberEditorValue(EPingHopLimitNum, iPingModel->iHopLimit);
    }
*/

    if (iPingModel->iVerbose)
        SetCheckBoxState(EPingVerboseCheckBox, CEikButtonBase::ESet);
    else
        SetCheckBoxState(EPingVerboseCheckBox, CEikButtonBase::EClear);


    SetNumberEditorValue(EPingSecNum, iPingModel->iSecWait);
    SetNumberEditorValue(EPingLastSecNum, iPingModel->iLastSecWait);
    SetNumberEditorValue(EPingPackSizeNum, iPingModel->iPacketDataSize);
    SetEdwinTextL(EPingPatternNum,&iPingModel->iPattern);
}
DLLExport BOOL WINAPI PoorMansTypeToolProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam)
{
	// set up some local variables, use these until OK is pressed and then
	// copy in to global data
	static short	lastV = 0;
	static short	lastH = 0;
	static int32	lastXFactor = 4;
	static BOOL		lastGaussianBlurData = FALSE;
	static bool		lastAllLayerData = FALSE;
	static BOOL		lastDiffLayerData = FALSE;
	static int16	lastLayerIndex = 0;
	RECT			imageRect;
	int				item, cmd;
	short			numberErr = 0;
	int32			x = 0;
	static int		lastItem = 0;
	static GPtr		globals = NULL;		  /* need to be static */

	switch  (wMsg)
	{

		case  WM_INITDIALOG:

			/* set up globals	*/

			globals = (GPtr) lParam;

			CenterDialog(hDlg);
			
			lastV = gPointV;
			lastH = gPointH;
			lastXFactor = gXFactor;
			lastGaussianBlurData = gGaussianBlurData;
			lastAllLayerData = gViewAllLayerData;
			lastLayerIndex = gViewLayerIndex;

			GetProxyItemRect(hDlg, &gProxyRect);
			CalcProxyScaleFactor(&gDocDesc->bounds, &gProxyRect, &gScaleFactor);
			UpdateProxyView(globals);

			StuffNumber(hDlg, kDVertical,(int32)lastV);
			StuffNumber(hDlg, kDHorizontal,(int32)lastH);

			InitializeMenu(globals, hDlg, kDSize);
			SetSizePopUpMenu(hDlg, lastXFactor);

			InitializeMenu(globals, hDlg, kDLayersPopUp);
			SendMessage(GetDlgItem(hDlg, kDLayersPopUp), CB_SETCURSEL, 0, 0);

			InitializeMenu(globals, hDlg, kDDocPopUp);
			SendMessage(GetDlgItem(hDlg, kDDocPopUp), CB_SETCURSEL, 0, 0);

			SetCheckBoxState(hDlg, kDAllLayers, lastAllLayerData);

			SetCheckBoxState(hDlg, kDGaussianBlurData, lastGaussianBlurData);

			ShowHideItem(hDlg, kDWarningText, false);

			SelectTextItem(hDlg, kDVertical);

			/* drop into PAINT missing break is intentional */
		case WM_PAINT:
			ShowOutputBuffer(globals, hDlg);	 // Draw Proxy Item
			return FALSE;
			break;

		case  WM_COMMAND:
	  		item = COMMANDID (wParam);              // WIN32 Change
			cmd = HIWORD (wParam);

			switch  (item)
			{
				case kDVertical:
					if (Validate(globals, hDlg, &lastItem))
					{
						if (cmd == EN_KILLFOCUS)
							lastItem = kDVertical; // validate will get this
						else if (cmd == EN_CHANGE)
						{
							numberErr = FetchNumber(hDlg,
													kDVertical,
													gDocDesc->bounds.top,
													gDocDesc->bounds.bottom,
													&x);
							if (numberErr == noErr && x != gPointV)
							{ // different number, update
								gPointV = (short)x;

								// Do Filtering operation
								UpdateProxyView(globals);

								// Invalidate Proxy Item
								GetWindowRect(GetDlgItem(hDlg, kDProxyItem), &imageRect);
								ScreenToClient (hDlg, (LPPOINT)&imageRect);
								ScreenToClient (hDlg, (LPPOINT)&(imageRect.right));
								InvalidateRect (hDlg, &imageRect, FALSE);
							}
						}
					}
					break;

				case kDHorizontal:
					if (Validate(globals, hDlg, &lastItem))
					{
						if (cmd == EN_KILLFOCUS)
							lastItem = kDHorizontal; // validate will get this
						else if (cmd == EN_CHANGE)
						{
							numberErr = FetchNumber(hDlg,
													kDHorizontal,
													gDocDesc->bounds.left,
													gDocDesc->bounds.right,
													&x);
							if (numberErr == noErr && x != gPointH)
							{ // different number, update
								gPointH = (short)x;

								// Do Filtering operation
								UpdateProxyView(globals);

								// Invalidate Proxy Item
								GetWindowRect(GetDlgItem(hDlg, kDProxyItem), &imageRect);
								ScreenToClient (hDlg, (LPPOINT)&imageRect);
								ScreenToClient (hDlg, (LPPOINT)&(imageRect.right));
								InvalidateRect (hDlg, &imageRect, FALSE);
							}
						}
					}
					break;

				case kDSize:
					if (Validate(globals, hDlg, &lastItem))
					{
						if (cmd == CBN_SELENDOK)
						{
							gXFactor = GetSizePopUpMenu(hDlg);
							// Do Filtering operation
							UpdateProxyView(globals);
			
							// Invalidate Proxy Item
							GetWindowRect(GetDlgItem(hDlg, kDProxyItem), &imageRect);
							ScreenToClient (hDlg, (LPPOINT)&imageRect);
							ScreenToClient (hDlg, (LPPOINT)&(imageRect.right));
							InvalidateRect (hDlg, &imageRect, FALSE);
							return FALSE;
						}
					}
					break;

				case kDGaussianBlurData:
					if (Validate(globals, hDlg, &lastItem))
					{
						if (cmd == BN_CLICKED)
						{	
							gGaussianBlurData = !gGaussianBlurData;
							SetCheckBoxState (hDlg, kDGaussianBlurData, gGaussianBlurData);
							
							// Do Filtering operation
							UpdateProxyView(globals);
			
							// Invalidate Proxy Item
							GetWindowRect(GetDlgItem(hDlg, kDProxyItem), &imageRect);
							ScreenToClient (hDlg, (LPPOINT)&imageRect);
							ScreenToClient (hDlg, (LPPOINT)&(imageRect.right));
							InvalidateRect (hDlg, &imageRect, FALSE);
							return FALSE;
						}
					}
					break;

				case kDAllLayers:
					if (Validate(globals, hDlg, &lastItem))
					{
						if (cmd == BN_CLICKED)
						{	
							gViewAllLayerData = !gViewAllLayerData;
							SetCheckBoxState (hDlg, kDAllLayers, gViewAllLayerData);
							ShowHideItem(hDlg, kDWarningText, gViewAllLayerData);
							
							// Do Filtering operation
							UpdateProxyView(globals);
			
							// Invalidate Proxy Item
							GetWindowRect(GetDlgItem(hDlg, kDProxyItem), &imageRect);
							ScreenToClient (hDlg, (LPPOINT)&imageRect);
							ScreenToClient (hDlg, (LPPOINT)&(imageRect.right));
							InvalidateRect (hDlg, &imageRect, FALSE);
							return FALSE;
						}
					}
					break;
				
				case kDLayersPopUp:
					if (Validate(globals, hDlg, &lastItem))
					{
						if (cmd == CBN_SELENDOK)
						{
							HWND hWnd = GetDlgItem(hDlg, kDLayersPopUp);
							if (hWnd == NULL) break;
							gViewLayerIndex = (int16)SendMessage(hWnd, CB_GETCURSEL, 0, 0);

							if (gViewLayerIndex == 0)
							{
								SetCheckBoxState(hDlg, kDAllLayers, gViewAllLayerData);
								PIEnableControl(hDlg, kDAllLayers);
							}
							else
							{
								gViewAllLayerData = false;
								SetCheckBoxState(hDlg, kDAllLayers, false);
								PIDisableControl(hDlg, kDAllLayers);
							}

							// Do Filtering operation
							UpdateProxyView(globals);
			
							// Invalidate Proxy Item
							GetWindowRect(GetDlgItem(hDlg, kDProxyItem), &imageRect);
							ScreenToClient (hDlg, (LPPOINT)&imageRect);
							ScreenToClient (hDlg, (LPPOINT)&(imageRect.right));
							InvalidateRect (hDlg, &imageRect, FALSE);
							return FALSE;
						}
					}
					break;

				case kDDocPopUp:
					if (Validate(globals, hDlg, &lastItem))
					{
						if (cmd == CBN_SELENDOK)
						{
							HWND hWnd = GetDlgItem(hDlg, kDDocPopUp);
							if (hWnd == NULL) break;

							int16 docIndex = (int16)SendMessage(hWnd, CB_GETCURSEL, 0, 0);
							
							// point the global doc desc at the selected doc desc
							gDocDesc = gDocInfo;
							while (docIndex-- > 0 && gDocDesc != NULL)
								gDocDesc = gDocDesc->next;

							gViewLayerIndex = 0;
							gViewAllLayerData = 0;

							SetCheckBoxState(hDlg, kDAllLayers, gViewAllLayerData);
							PIEnableControl(hDlg, kDAllLayers);

							InitializeMenu(globals, hDlg, kDLayersPopUp);
							SendMessage(GetDlgItem(hDlg, kDLayersPopUp), CB_SETCURSEL, 0, 0);

							// reset the proxy stuff to use the new doc desc
							ReleaseProxyMemory(globals);
							GetProxyItemRect(hDlg, &gProxyRect);
							CalcProxyScaleFactor(&gDocDesc->bounds, &gProxyRect, &gScaleFactor);

							UpdateProxyView(globals);
			
							// Invalidate Proxy Item
							GetWindowRect(GetDlgItem(hDlg, kDProxyItem), &imageRect);
							ScreenToClient (hDlg, (LPPOINT)&imageRect);
							ScreenToClient (hDlg, (LPPOINT)&(imageRect.right));
							InvalidateRect (hDlg, &imageRect, FALSE);
							return FALSE;
						}
					}
					break;

				case OK:
					if (cmd == BN_CLICKED)
					{
						lastItem = kDVertical; // force validate
						if (Validate(globals, hDlg, &lastItem))
						{
							lastItem = kDHorizontal;
							if (Validate(globals, hDlg, &lastItem))
							{
								EndDialog(hDlg, item); 
								return TRUE;
							}
						}
					}
					else 
					{
						(void) Validate(globals, hDlg, &lastItem);
					}
					break;
				case CANCEL:
					if (cmd == BN_CLICKED)
					{
						gPointV = lastV;
						gPointH = lastH;
						gXFactor = lastXFactor;
						gGaussianBlurData = lastGaussianBlurData;
						gViewAllLayerData = lastAllLayerData;
						gViewLayerIndex = lastLayerIndex;
						gResult = userCanceledErr;
						EndDialog(hDlg, item);          // WIN32 change
						return TRUE;
					}
					// don't ever validate during cancel
					break;
				default:
					break;
			} // switch (item)
			break; // case WM_COMMAND
		default:
			return FALSE;
			break;
		} // switch

	return  TRUE;
}