/*static*/
	INT_PTR CALLBACK Win32PopupDialog::Callback(HWND dialog, UINT message, WPARAM wParam, LPARAM lParam)
	{
		switch (message)
		{
			case WM_INITDIALOG:
			{
				Win32PopupDialog* popupDialog = popups[GetCurrentThreadId()];
				HWND parentWindow = (popupDialog == NULL ? NULL : popupDialog->windowHandle);
				if (parentWindow == NULL)
				{
					parentWindow = GetDesktopWindow();
				}

				RECT parentRect, dialogRect;
				GetWindowRect(parentWindow, &parentRect);
				GetWindowRect(dialog, &dialogRect);
				int x = parentRect.left + (parentRect.right - parentRect.left) / 2;
				int y = parentRect.top + (parentRect.bottom - parentRect.top) / 2;
				x -= (dialogRect.right - dialogRect.left) / 2;
				y -= (dialogRect.bottom - dialogRect.top) / 2;
				
				SetWindowPos(dialog, HWND_TOP, x, y, 0, 0, SWP_NOSIZE);

				if (popupDialog->showInputText)
				{
					if (GetDlgCtrlID((HWND) wParam) != ID_INPUT_FIELD)
					{
						HWND inputText = GetDlgItem(dialog, ID_INPUT_FIELD);
						SetFocus(inputText);
						SendMessage(inputText, EM_SETSEL,
							0, popupDialog->inputText.length());
						return FALSE;
					}
				}
				
				return TRUE;
			}
			case WM_COMMAND:
				if(GET_WM_COMMAND_ID(wParam, lParam) == IDOK)
				{
					Win32PopupDialog::HandleOKClick(dialog);
					EndDialog(dialog, 0);
				}
				else if(GET_WM_COMMAND_ID(wParam, lParam) == IDCANCEL)
				{
					EndDialog(dialog, 0);
				}
				break;
		}

		return FALSE;
	}
Beispiel #2
0
	/*static*/
	INT_PTR CALLBACK Win32PopupDialog::Callback(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
	{
		switch (iMsg)
		{
			case WM_INITDIALOG:
			{
				Win32PopupDialog* popupDialog = popups[GetCurrentThreadId()];
				HWND hwndOwner = (popupDialog == NULL ? NULL : popupDialog->windowHandle);
				if (hwndOwner == NULL)
				{
					hwndOwner = GetDesktopWindow();
				}

				RECT rcOwner;
				RECT rcDlg;
				RECT rc;
				GetWindowRect(hwndOwner, &rcOwner);
				GetWindowRect(hDlg, &rcDlg);
				CopyRect(&rc, &rcOwner);

				// Offset the owner and dialog box rectangles so that right and bottom
				// values represent the width and height, and then offset the owner again
				// to discard space taken up by the dialog box.
				OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
				OffsetRect(&rc, -rc.left, -rc.top);
				OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);

				SetWindowPos(hDlg,
							HWND_TOP,
							rcOwner.left + (rc.right / 2),
							rcOwner.top + (rc.bottom / 2),
							0, 0,							// Ignores size arguments.
							SWP_NOSIZE);

				return TRUE;
			}
			case WM_COMMAND:
				if(GET_WM_COMMAND_ID(wParam, lParam) == IDOK)
				{
					Win32PopupDialog::HandleOKClick(hDlg);
					EndDialog(hDlg, 0);
				}
				else if(GET_WM_COMMAND_ID(wParam, lParam) == IDCANCEL)
				{
					EndDialog(hDlg, 0);
				}
				break;
		}

		return FALSE;
	}
Beispiel #3
0
//---------------------------------------------------------------------------
// About
//
// About dialog proc
//
// RETURNS:     Per Windows convention...
//---------------------------------------------------------------------------
BOOL  APIENTRY About (HWND hDlg, WORD message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
        {
        case WM_COMMAND:
            if ((GET_WM_COMMAND_ID (wParam, lParam) == IDOK) ||
                (GET_WM_COMMAND_ID (wParam, lParam) == IDCANCEL))
                {
                EndDialog(hDlg, TRUE);
                return (TRUE);
                }
            break;
    }
    return (FALSE);
    (lParam);
}
Beispiel #4
0
/***************************** Public  Function ****************************\
*
* BOOL  APIENTRY AboutDlg(hDlg, message, wParam, lParam)
* HWND     hDlg;
* WORD message;
* WPARAM wParam;
* LONG     lParam;
*
*
* Effects: none.
*
\***************************************************************************/
BOOL  APIENTRY 
AboutDlg(
	HWND   hDlg,
	WORD   message,
	WPARAM wParam,
	LONG   lParam
	)
{
	UNREFERENCED_PARAMETER(lParam);

	switch (message) {
	case WM_INITDIALOG:
		break;

	case WM_COMMAND:
		EndDialog(hDlg, GET_WM_COMMAND_ID(wParam, lParam));
		/* idok or idcancel */
		break;

	default:
		return FALSE;
		break;
	}
	return(TRUE);
}
Beispiel #5
0
static BOOL CALLBACK DialPassCallBackProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	static RASDIALPARAMS *Param;
	char Tmp[RAS_NAME_LEN+25];

	switch (message)
	{
		case WM_INITDIALOG :
			Param = (RASDIALPARAMS *)lParam;
			sprintf(Tmp, MSGJPN238, Param->szEntryName);
			SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)Tmp);
			SendDlgItemMessage(hDlg, RASPASS_USER, EM_LIMITTEXT, UNLEN, 0);
			SendDlgItemMessage(hDlg, RASPASS_PASS, EM_LIMITTEXT, PWLEN, 0);
			SendDlgItemMessage(hDlg, RASPASS_USER, WM_SETTEXT, 0, (LPARAM)Param->szUserName);
			SendDlgItemMessage(hDlg, RASPASS_PASS, WM_SETTEXT, 0, (LPARAM)Param->szPassword);
		    return(TRUE);

		case WM_COMMAND :
			switch(GET_WM_COMMAND_ID(wParam, lParam))
			{
				case IDOK :
					SendDlgItemMessage(hDlg, RASPASS_USER, WM_GETTEXT, UNLEN+1, (LPARAM)Param->szUserName);
					SendDlgItemMessage(hDlg, RASPASS_PASS, WM_GETTEXT, PWLEN+1, (LPARAM)Param->szPassword);
					EndDialog(hDlg, YES);
					break;

				case IDCANCEL :
					EndDialog(hDlg, NO);
					break;
			}
			return(TRUE);
	}
	return(FALSE);
}
Beispiel #6
0
BOOL CALLBACK ChessPromotionDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
   UserDidSomething();
   switch (message)
   {
   case WM_INITDIALOG:
      CheckDlgButton(hDlg, IDC_QUEEN, TRUE);
      CenterWindow(hDlg, GetParent(hDlg));
      hPromoteDlg = hDlg;
      return TRUE;
      
   case WM_COMMAND:
      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
      case IDOK:
      case IDCANCEL:
	 if (IsDlgButtonChecked(hDlg, IDC_KNIGHT))
	    EndDialog(hDlg, KNIGHT);
	 else if (IsDlgButtonChecked(hDlg, IDC_BISHOP))
	    EndDialog(hDlg, BISHOP);
	 else if (IsDlgButtonChecked(hDlg, IDC_ROOK))
	    EndDialog(hDlg, ROOK);
	 else EndDialog(hDlg, QUEEN);
	 return TRUE;
      }
      break;

   case WM_DESTROY:
      hPromoteDlg = NULL;
      break;

   }
   return FALSE;
}
Beispiel #7
0
BOOL CObjectsPrefPage::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	HWND   	hActiveWnd = GetActiveDoc();
	HWND	hDlg = GetSafeHwnd();
	int 	id = GET_WM_COMMAND_ID(wParam, lParam);
	UINT 	codeNotify = GET_WM_COMMAND_CMD(wParam, lParam);

	switch (id)
	{
		case IDC_PREF_OBJECTS:
			Control.MultipleObjects = !Control.MultipleObjects;
			::CheckDlgButton( hDlg, id, Control.MultipleObjects );
//			if (!Control.MultipleObjects)
//				Control.UseMaskAndObjects = FALSE;
//			::CheckDlgButton( hDlg, IDC_PREF_OBJECTMASKS, Control.UseMaskAndObjects );
			ControlEnable(  hDlg, IDC_PREF_OBJECTMASKS, Control.MultipleObjects );
			SetModified(TRUE);
		break;

		case IDC_PREF_OBJECTMASKS:
			if (!Control.MultipleObjects)
				break;
			Control.UseMaskAndObjects = !Control.UseMaskAndObjects;
			::CheckDlgButton( hDlg, id, Control.UseMaskAndObjects );
			SetModified(TRUE);
		break;

	   	default:
			return (CPPPropertyPage::OnCommand(wParam, lParam));   	
		break;
   	}
	return(TRUE);
}
Beispiel #8
0
long windows_systemcommand_routine ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{

	LRESULT
		lRc;

	switch ( GET_WM_COMMAND_ID ( wParam, lParam ) )
	{

		case SC_SCREENSAVE:
		{

			return ( 0 );

			break;
		}

		default:
		{

			lRc = DefWindowProc ( application_window, message, wParam, lParam );

			break;
		}
	}

	return ( lRc );
}
LRESULT DispCommand(LPCMDI lpcmdi, 
                    HWND   hwnd, 
                    WPARAM wparam, 
                    LPARAM lparam)
{
    WORD    wCommand = GET_WM_COMMAND_ID(wparam, lparam);
    int     icmd = 0;

    CMD    *rgcmd = lpcmdi->rgcmd;
    int     ccmd  = lpcmdi->ccmd;

    // Message packing of wparam and lparam have changed for Win32,
    // so use the GET_WM_COMMAND macro to unpack the commnad

    for (icmd = 0; icmd < ccmd; icmd++)
    {
        if (rgcmd[icmd].wCommand == wCommand)
        {
            return rgcmd[icmd].pfncmd(hwnd,
                                      wCommand,
                                      GET_WM_COMMAND_CMD(wparam, lparam),
                                      GET_WM_COMMAND_HWND(wparam, lparam));
        }
    }

    return DispDefault(lpcmdi->edwp, hwnd, WM_COMMAND, wparam, lparam);
}
LRESULT CALLBACK CTSFMainWnd::_WndProc( HWND hWnd, 
                                        UINT uMessage, 
                                        WPARAM wParam, 
                                        LPARAM lParam)
{
    CTSFMainWnd *pThis = (CTSFMainWnd*)GetWindowLongPtr(hWnd, THIS_POINTER_OFFSET);

    if((NULL == pThis) && (uMessage != WM_NCCREATE))
    {
        return DefWindowProc(hWnd, uMessage, wParam, lParam);
    }
    
    switch (uMessage)
    {
    case WM_NCCREATE:
        {
            LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
            pThis = (CTSFMainWnd*)(lpcs->lpCreateParams);
            SetWindowLongPtr(hWnd, THIS_POINTER_OFFSET, (LONG_PTR)pThis);

            //set the window handle
            pThis->m_hWnd = hWnd;
        }
        break;

    case WM_CREATE:
        return pThis->_OnCreate();

    case WM_SIZE:
        return pThis->_OnSize(LOWORD(lParam), HIWORD(lParam));

    case WM_DESTROY:
        return pThis->_OnDestroy();

    case WM_SETFOCUS:
        return pThis->_OnSetFocus();

    case WM_KILLFOCUS:
        return pThis->_OnKillFocus();

    case WM_ACTIVATE:
        return pThis->_OnActivate(wParam);

    case WM_INITMENUPOPUP:
        return pThis->_OnInitMenuPopup(wParam, lParam);

    case WM_COMMAND:
        return pThis->_OnCommand(   GET_WM_COMMAND_ID(wParam, lParam), 
                                    GET_WM_COMMAND_CMD(wParam, lParam), 
                                    GET_WM_COMMAND_HWND(wParam, lParam));

    case WM_NCDESTROY:
        pThis->m_hWnd = NULL;
        break;

    }

    return DefWindowProc(hWnd, uMessage, wParam, lParam);
}
Beispiel #11
0
INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	switch (Msg)
	{
		case WM_INITDIALOG:
		{
			char tmp[256];
			CenterWindow(hDlg);
			hBrush = CreateSolidBrush(RGB(235, 233, 237));
			HBITMAP hBmp = (HBITMAP)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_SPLASH), IMAGE_BITMAP, 0, 0, LR_SHARED);
			SendMessage(GetDlgItem(hDlg, IDC_ABOUT), STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBmp);
			hFont = CreateFont(-11, 0, 0, 0, 400, 0, 0, 0, 0, 3, 2, 1, 34, TEXT("Verdana"));
			hFontFX = CreateFont(-12, 0, 0, 0, 400, 0, 0, 0, 0, 3, 2, 1, 34, TEXT("Verdana"));
			SetWindowFont(GetDlgItem(hDlg, IDC_TEXT1), hFont, true);
			SetWindowFont(GetDlgItem(hDlg, IDC_TEXT2), hFont, true);
			SetWindowFont(GetDlgItem(hDlg, IDC_TEXT3), hFont, true);
			SetWindowFont(GetDlgItem(hDlg, IDC_TEXT4), hFont, true);
			SetWindowFont(GetDlgItem(hDlg, IDC_SICKFX), hFontFX, true);
			win_set_window_text_utf8(GetDlgItem(hDlg, IDC_BUILD), "Build time: " __DATE__" - " __TIME__"");
			snprintf(tmp, WINUI_ARRAY_LENGTH(tmp), "Version: %s", MAME_VERSION);
			win_set_window_text_utf8(GetDlgItem(hDlg, IDC_BUILDVER), tmp);
			return true;
		}

		case WM_CTLCOLORDLG:
			return (LRESULT) hBrush;

		case WM_CTLCOLORSTATIC:
		case WM_CTLCOLORBTN:
			hDC = (HDC)wParam;
			SetBkMode(hDC, TRANSPARENT);
			SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));

			if ((HWND)lParam == GetDlgItem(hDlg, IDC_SICKFX))
				SetTextColor(hDC, RGB(63, 72, 204));

			return (LRESULT) hBrush;

		case WM_COMMAND:
			switch (GET_WM_COMMAND_ID(wParam, lParam))
			{
				case IDOK:
				case IDCANCEL:
					DeleteObject(hFont);
					DeleteObject(hFontFX);
					DeleteObject(hBrush);
					EndDialog(hDlg, 0);
					return true;
			}

			break;
	}

	return false;
}
Beispiel #12
0
static BOOL CALLBACK DialCallBackProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	static RASDIALPARAMS *Param;
	static HRASCONN hRasConn;
	char Tmp[RAS_NAME_LEN+25];
	DWORD Sts;

	switch (message)
	{
		case WM_INITDIALOG :
			Param = (RASDIALPARAMS *)lParam;
			hWndDial = hDlg;
			hRasConn = NULL;
			sprintf(Tmp, MSGJPN223, Param->szEntryName);
			SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)Tmp);
			Sts = (*m_RasDial)(NULL, NULL, Param, 0, &RasDialFunc, &hRasConn);
			if(Sts != 0)
		        EndDialog(hDlg, NO);
		    return(TRUE);

		case WM_COMMAND :
			switch(GET_WM_COMMAND_ID(wParam, lParam))
			{
				case IDCANCEL :
					RasHangUpWait(hRasConn);
					EndDialog(hDlg, NO);
					break;
			}
			return(TRUE);

		case WM_DIAL_MSG :
			if(lParam != 0)
			{
				/* エラー発生 */
				if((*m_RasGetErrorString)((UINT)lParam, (LPTSTR)Tmp, RAS_NAME_LEN+25) != 0)
					sprintf(Tmp, MSGJPN224);
				RasHangUpWait(hRasConn);
				MessageBox(hDlg, Tmp, MSGJPN225, MB_OK | MB_ICONSTOP);
				EndDialog(hDlg, NO);
			}
			else if(wParam & RASCS_DONE)
			{
				/* 終了 */
				EndDialog(hDlg, YES);
			}
			else
			{
				/* ステータス変更 */
				MakeRasConnMsg(Param->szPhoneNumber, wParam, Tmp);
				SendDlgItemMessage(hDlg, DIAL_STATUS, WM_SETTEXT, 0, (LPARAM)Tmp);
			}
			return(TRUE);
	}
	return(FALSE);
}
Beispiel #13
0
static LRESULT CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{

    switch (uMsg)
    {
        case WM_INITDIALOG: {

			HYPCTRL hc; // can be reused for new hyperlink controls
			
			InitHypCtrl(&hc);
			hc.ulStyle	 = ulHover;
			hc.szLink	 = _T("http://smorgasbordet.com/pellesc");
			hc.szTooltip = _T("Visit Pelles C Website");
			CreateHypCtrl(hwndDlg, &hc, 10, 10, 0, 0);

			InitHypCtrl(&hc);
			hc.ulStyle	 = ulHover;
			hc.szLink	 = _T("mailto:[email protected]");
			hc.szText	 = _T("*****@*****.**");
			hc.szTooltip = _T("Send program author a mail");
			CreateHypCtrl(hwndDlg, &hc, 10, 30, 0, 0);
			
			InitHypCtrl(&hc);
			hc.ulStyle	  = ulHover;
			hc.bPlaySound = FALSE;
			hc.szText     = _T("Callback Test 1");
			hc.cbFn       = HypCtrlCallback;
			hc.cbID       = 1;
			CreateHypCtrl(hwndDlg, &hc, 10, 50, 0, 0);

			InitHypCtrl(&hc);
			hc.ulStyle    = ulHover;
			hc.bPlaySound = FALSE;
			hc.szText     = _T("Callback Test 2");
			hc.cbFn	      = HypCtrlCallback;
			hc.cbID       = 2;
			CreateHypCtrl(hwndDlg, &hc, 10, 70, 0, 0);

            return TRUE;
        }
        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam))
            {
                case IDOK:
                    EndDialog(hwndDlg, TRUE);
                    return TRUE;
            }
            break;
        case WM_CLOSE:
            EndDialog(hwndDlg, 0);
            return TRUE;
    }
    return FALSE;
}
Beispiel #14
0
/******************************************************************************
 * BOOL  APIENTRY WidthProc(hDial, message, wParam, lParam)
 *
 * purpose: dialog function for Width menu function
 *
 * params:  same as for all dialog fns.
 *
 * side effects: changes Box width variable
 *
 *****************************************************************************/
BOOL  APIENTRY 
WidthProc(
	HWND   hDial,
	WORD   message,
	WPARAM wParam,
	LONG   lParam
	)
{
	INT i;
	BOOL fOk;

	UNREFERENCED_PARAMETER(lParam);

	switch (message) {
	default:
		return FALSE;
	case WM_INITDIALOG:
		SetDlgItemInt(hDial, BOX_WIDTH, newWidth, FALSE);
		break;

	case WM_COMMAND:
		switch (GET_WM_COMMAND_ID(wParam, lParam)) {
		case IDOK:
			fChanged = TRUE;
			i = GetDlgItemInt(hDial, BOX_WIDTH, (LPBOOL)&fOk, FALSE);
			if (fOk && i < wBoxLim)
				newWidth = i;
			else
				ErrorBox(hDial, vszWidthOutOfBounds);

		case IDCANCEL:
			EndDialog(hDial, GET_WM_COMMAND_ID(wParam, lParam) != IDCANCEL);
			break;

		default:
			break;
		}
	}
	return TRUE;
}
Beispiel #15
0
BOOL CMemoryPrefPage::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	BOOL 	Bool;
	HWND   	hActiveWnd = GetActiveDoc();
	HWND	hDlg = GetSafeHwnd();
	int 	id = GET_WM_COMMAND_ID(wParam, lParam);
	UINT 	codeNotify = GET_WM_COMMAND_CMD(wParam, lParam);

	switch (id)
	{
		case IDC_PREF_RAMDISK:
			if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) )
	    		break;
			if ( codeNotify != EN_CHANGE )
	    		break;
			::GetDlgItemText( hDlg, id, Control.RamDisk,
				sizeof(Control.RamDisk));
			FixPath( Lowercase( Control.RamDisk ) );
			SetModified(TRUE);
		break;

		case IDC_PREF_MEMMIN:
			if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) )
	    		break;
			if ( codeNotify != EN_CHANGE )
	    		break;
			Control.MainMemMin = ::GetDlgItemSpin( hDlg, id, &Bool, NO );
			SetModified(TRUE);
		break;

		case IDC_PREF_MEMFACTOR:
			if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) )
	    		break;
			if ( codeNotify != EN_CHANGE )
	    		break;
			Control.MainMemFactor = ::GetDlgItemSpin( hDlg, id, &Bool, NO );
			SetModified(TRUE);
		break;

		case IDC_PREF_LINEART:
			Control.LineArtAsGray = !Control.LineArtAsGray;
			::CheckDlgButton( hDlg, id, Control.LineArtAsGray );
			SetModified(TRUE);
		break;

	   	default:
			return (CPPPropertyPage::OnCommand(wParam, lParam));   	
		break;
    	}
	return(TRUE);
}
LRESULT CALLBACK MainWndProc( HWND hWnd,
                              UINT uMessage,
                              WPARAM wParam,
                              LPARAM lParam)
{
switch (uMessage)
   {
   case WM_CREATE:
      break;

   case WM_CLOSE:
      if(IsWindow(g_hwndPropSheet))
         DestroyWindow(g_hwndPropSheet);
      
      DestroyWindow(hWnd);
      break;
   
   case WM_DESTROY:
      PostQuitMessage(0);
      break;

   case WM_COMMAND:
      switch (GET_WM_COMMAND_ID(wParam, lParam))
         {
         case IDM_MODAL:
            DoModalPropSheet(hWnd);
            break;
            
         case IDM_MODELESS:
            g_hwndPropSheet = DoModelessPropSheet(hWnd);
            break;
            
         case IDM_WIZARD:
            DoWizardPropSheet(hWnd);
            break;
         
         case IDM_EXIT:
            PostMessage(hWnd, WM_CLOSE, 0, 0);
            break;
         
         case IDM_ABOUT:
            DialogBox(g_hInst, MAKEINTRESOURCE(IDD_ABOUT_DIALOG), hWnd, About);
            break;
         }
      return TRUE;

   default:
      break;
   }
return DefWindowProc(hWnd, uMessage, wParam, lParam);
}
Beispiel #17
0
BOOL CALLBACK rawDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
	DWORD c,d;
	switch (uMsg) {
	case WM_CLOSE:
		EndDialog(hDlg,TRUE);
		return 0;
	case WM_INITDIALOG:
		{
			char *LFpsftag;
			//char LFpsftag[500001];

			LFpsftag = malloc(strlen(infoDlgpsftag)*3+1);

			// <= includes terminating null
			for (c=0, d=0; c <= strlen(infoDlgpsftag); c++, d++) {
				LFpsftag[d]=infoDlgpsftag[c];
				if (infoDlgpsftag[c]=='\n') {
					LFpsftag[d++]='\r';
					LFpsftag[d]='\r';
					LFpsftag[d]='\n';
				}
			}
		
			SetDlgItemText(hDlg,IDC_RAWTAG,LFpsftag);
			free(LFpsftag);
			break;
		}
	case WM_COMMAND:
		switch (GET_WM_COMMAND_ID(wParam, lParam)) {
		case IDOK:
			GetDlgItemText(hDlg,IDC_RAWTAG,infoDlgpsftag,50000);

			// remove 0x0d (in PSF a newline is 0x0a)
			for (c=0,d=0; c < strlen(infoDlgpsftag); c++) {
				if (infoDlgpsftag[c] != 0x0d) {
					infoDlgpsftag[d]=infoDlgpsftag[c];
					d++;
				}
			}
			infoDlgpsftag[d]='\0';
		case IDCANCEL:
			EndDialog(hDlg,TRUE);
			break;
		}
	default:
		return 0;
	}
	return 1;
}
Beispiel #18
0
BOOL CUndoPrefPage::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	HWND   	hActiveWnd = GetActiveDoc();
	HWND	hDlg = GetSafeHwnd();
	int 	id = GET_WM_COMMAND_ID(wParam, lParam);
	UINT 	codeNotify = GET_WM_COMMAND_CMD(wParam, lParam);

	switch (id)
	{
		case IDC_PREF_UNDOTYPE:
//		case IDC_PREF_NOUNDO:
//		case IDC_PREF_MANUALAPPLY:
//		case IDC_PREF_AUTOAPPLY:
			if ( !(id = HandleCombo( hDlg, id, codeNotify )) )
				break;
			Control.NoUndo = (id == IDC_PREF_NOUNDO);
			Control.UseApply = (id == IDC_PREF_MANUALAPPLY);
			ControlEnable( hDlg, IDC_PREF_MASKUNDO, !Control.NoUndo );
			SetModified(TRUE);
		break;

		case IDC_PREF_UNDOMODE:
//		case IDC_PREF_IMAGEUNDO:
//		case IDC_PREF_OBJECTUNDO:
			if ( !(id = HandleCombo( hDlg, id, codeNotify )) )
				break;
			Control.UndoObjects = (id == IDC_PREF_OBJECTUNDO);
			SetModified(TRUE);
		break;

		case IDC_PREF_MASKUNDO:
			Control.UndoMasks = !Control.UndoMasks;
			::CheckDlgButton( hDlg, id, !Control.UndoMasks );
			SetModified(TRUE);
		break;

		case IDC_PREF_DISABLECMDLIST:
    		Control.DoCommandList = !Control.DoCommandList;
	    	::CheckDlgButton( hDlg, id, !Control.DoCommandList );
			SetModified(TRUE);
		break;

	   	default:
			return (CPPPropertyPage::OnCommand(wParam, lParam));   	
		break;
   	}
	return(TRUE);
}
Beispiel #19
0
BOOL CALLBACK ProfanityDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
   char term[MAXPROFANETERM+1];

   switch (message)
   {
   case WM_INITDIALOG:
      CenterWindow(hDlg, GetParent(hDlg));
      Edit_LimitText(GetDlgItem(hDlg, IDC_EDIT1), MAXPROFANETERM);
      CheckRadioButton(hDlg, IDC_RADIO1, IDC_RADIO2, IDC_RADIO1+!config.ignoreprofane);
      CheckDlgButton(hDlg, IDC_CHECK1, config.extraprofane);
      SetFocus(GetDlgItem(hDlg, IDC_RADIO1+!config.ignoreprofane));
      return FALSE; // return TRUE unless we set the focus

   case WM_COMMAND:
      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
      case IDC_BUTTON1:
	 GetDlgItemText(hDlg, IDC_EDIT1, term, sizeof(term));
	 AddProfaneTerm(term);
	 SetDlgItemText(hDlg, IDC_EDIT1, "");
	 SetFocus(GetDlgItem(hDlg, IDC_EDIT1));
	 return TRUE;

      case IDC_BUTTON2:
	 GetDlgItemText(hDlg, IDC_EDIT1, term, sizeof(term));
	 RemoveProfaneTerm(term);
	 SetDlgItemText(hDlg, IDC_EDIT1, "");
	 SetFocus(GetDlgItem(hDlg, IDC_EDIT1));
	 return TRUE;

      case IDCANCEL:
	 EndDialog(hDlg, IDCANCEL);
	 return TRUE;

      case IDOK:
	 config.ignoreprofane = IsDlgButtonChecked(hDlg, IDC_RADIO1);
	 config.extraprofane = IsDlgButtonChecked(hDlg, IDC_CHECK1);
	 RecompileAllProfaneExpressions();
	 EndDialog(hDlg, IDOK);
	 return TRUE;
      }
      break;
   }

   return FALSE;
}
Beispiel #20
0
Datei: mew.c Projekt: redtower/rc
BOOL CALLBACK TitleDlgProc(HWND   hDlg,
			   UINT   uiMsg,
			   WPARAM wParam,
			   LPARAM lParam)
{
    HDC hDc;
    PAINTSTRUCT ps;
    switch (uiMsg){
    case WM_INITDIALOG:
	hIcon = LoadImage(hInst, MAKEINTRESOURCE(MEW), IMAGE_ICON, 48, 48,
			  LR_DEFAULTSIZE);
	if (hIcon == NULL){
	    OutputLog("LoadImage fails.");
	    EndPaint(hDlg, &ps);
	    return FALSE;
	}
	break;
    case WM_PAINT:
	hDc = BeginPaint(hDlg, &ps);
	if (hDc == NULL){
	    OutputLog("BeginPaint fails.");
	    EndPaint(hDlg, &ps);
	    return FALSE;
	}
	if (DrawIconEx(hDc, 24, 64, hIcon, 48, 48, 0, NULL, DI_NORMAL) == 0){
	    OutputLog("DrawIconEx fails.");
	    EndPaint(hDlg, &ps);
	    return FALSE;
	}
	EndPaint(hDlg, &ps);
	break;
    case WM_COMMAND:
	switch (GET_WM_COMMAND_ID(wParam, lParam)){
	case IDOK:
	    EndDialog(hDlg, 1);
	    return TRUE;
	    break;
	case IDCANCEL:
	    EndDialog(hDlg, 0);
	    return TRUE;
	    break;
	}
    default:
	return FALSE;
    }
    return FALSE;
}
Beispiel #21
0
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) {
  LRESULT lResult = 0;

  switch(msg){
  case WM_CREATE:
    {
      SHMENUBARINFO mbi;
      ZeroMemory(&mbi, sizeof(SHMENUBARINFO));
      mbi.cbSize = sizeof(SHMENUBARINFO);
      mbi.hwndParent = hwnd;
      mbi.nToolBarId = ID_MENU;
      mbi.hInstRes = _hAppInstance;

      if (SHCreateMenuBar(&mbi) == FALSE) {
         // Couldn't create the menu bar.  Fail creation of the window.
          return -1;
      }
    }
    break;

  case WM_COMMAND:
    switch (GET_WM_COMMAND_ID(wp, lp)) {
    case IDM_EXIT:
    case IDOK:
      _quit_now = 1;
      SendMessage(hwnd, WM_CLOSE, 0, 0);
      break;
    default:
      return DefWindowProc(hwnd, msg, wp, lp);
    }
    break;
  case WM_CLOSE:
    DestroyWindow(hwnd);
    break;

  case WM_DESTROY:
    PostQuitMessage(0);
    break;

  default:
    lResult = DefWindowProc(hwnd, msg, wp, lp);
    break;
  }
  return (lResult);
}
Beispiel #22
0
static INT_PTR CALLBACK NvGpuPanelDialogProc(
    _In_ HWND hwndDlg,
    _In_ UINT uMsg,
    _In_ WPARAM wParam,
    _In_ LPARAM lParam
    )
{
    PPH_NVGPU_SYSINFO_CONTEXT context = NULL;

    if (uMsg == WM_INITDIALOG)
    {
        context = (PPH_NVGPU_SYSINFO_CONTEXT)lParam;
        SetProp(hwndDlg, L"Context", (HANDLE)context);
    }
    else
    {
        context = (PPH_NVGPU_SYSINFO_CONTEXT)GetProp(hwndDlg, L"Context");

        if (uMsg == WM_NCDESTROY)
        {
            RemoveProp(hwndDlg, L"Context");
        }
    }

    if (context == NULL)
        return FALSE;

    switch (uMsg)
    {
    case WM_COMMAND:
        {
            switch (GET_WM_COMMAND_ID(wParam, lParam))
            {
            case IDC_DETAILS:
                {
                    ShowDetailsDialog(GetParent(hwndDlg), context);
                }
                break;
            }
        }
        break;
    }

    return FALSE;
}
Beispiel #23
0
BOOL CALLBACK About(HWND hDlg, UINT message, WPARAM wPrm, LONG lPrm)
#pragma argsused hDlg message wPrm
{
  UINT which;

  switch(message) {
  case WM_INITDIALOG:
    return(TRUE);
  case WM_COMMAND:
    which = GET_WM_COMMAND_ID(wPrm, lPrm);
    if (which == IDOK || which == IDCANCEL) {
      EndDialog(hDlg, TRUE);
      return(TRUE);
    }
    break;
  }
  return(FALSE);
}
Beispiel #24
0
INT_PTR CALLBACK DlgProc(
    HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg) {
    case WM_INITDIALOG:
        SetWindowLongPtr(hdlg, DWLP_USER, lParam);
        return TRUE;
    case WM_COMMAND:
        switch (GET_WM_COMMAND_ID(wParam, lParam)) {
        case IDOK:
            EndManualModalDialog(hdlg, IDOK);
            break;
        case IDCANCEL:
            EndManualModalDialog(hdlg, IDCANCEL);
            break;
        }
    }
    return FALSE;
}
Beispiel #25
0
BOOL CScratchpadPrefPage::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	BOOL 	Bool;
	HWND   	hActiveWnd = GetActiveDoc();
	HWND	hDlg = GetSafeHwnd();
	int 	id = GET_WM_COMMAND_ID(wParam, lParam);
	UINT 	codeNotify = GET_WM_COMMAND_CMD(wParam, lParam);

	switch (id)
	{
		case IDC_PREF_SCRATCHX:
			if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) )
				break;
			if ( codeNotify != EN_CHANGE )
				break;
			Control.ScratchpadWidth = ::GetDlgItemSpin( hDlg, id, &Bool, NO );
			SetModified(TRUE);
		break;

		case IDC_PREF_SCRATCHY:
			if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) )
				break;
			if ( codeNotify != EN_CHANGE )
				break;
			Control.ScratchpadHeight = ::GetDlgItemSpin( hDlg, id, &Bool, NO );
			SetModified(TRUE);
		break;

		case IDC_PREF_SCRATCHTYPE:
//		case IDC_PREF_SCRATCHGRAY:
//		case IDC_PREF_SCRATCHCOLOR:
			if ( !(id = HandleCombo( hDlg, id, codeNotify )) )
				break;
			Control.IsScratchpadColor = id - IDC_PREF_SCRATCHGRAY;
			SetModified(TRUE);
		break;

	   	default:
			return (CPPPropertyPage::OnCommand(wParam, lParam));   	
		break;
   	}
	return(TRUE);
}
Beispiel #26
0
BOOL CPluginPrefPage::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	HWND   	hActiveWnd = GetActiveDoc();
	HWND	hDlg = GetSafeHwnd();
	int 	id = GET_WM_COMMAND_ID(wParam, lParam);
	UINT 	codeNotify = GET_WM_COMMAND_CMD(wParam, lParam);

	switch (id)
	{
		case IDC_PREF_USEPLUGINS:
			Control.UsePlugins = !Control.UsePlugins;
			::CheckDlgButton( hDlg, id, Control.UsePlugins );
			SetModified(TRUE);
		break;

		case IDC_PREF_PLUGINPATH1:
			if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) )
	    		break;
			if ( codeNotify != EN_CHANGE )
		    	break;
			::GetDlgItemText( hDlg, id, Control.PluginPath1,
				sizeof(Control.PluginPath1));
			FixPath( Lowercase( Control.PluginPath1 ) );
			SetModified(TRUE);
		break;

		case IDC_PREF_PLUGINPATH2:
			if ( ::GetFocus() != ::GetDlgItem( hDlg, id ) )
		    	break;
			if ( codeNotify != EN_CHANGE )
		    	break;
			::GetDlgItemText( hDlg, id, Control.PluginPath2,
				sizeof(Control.PluginPath2));
			FixPath( Lowercase( Control.PluginPath2 ) );
			SetModified(TRUE);
		break;

	   	default:
			return (CPPPropertyPage::OnCommand(wParam, lParam));   	
		break;
   	}
	return(TRUE);
}
Beispiel #27
0
LRESULT CALLBACK CSEShellView::WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
{
    static bool bLBDown = false;
    CSEShellView *pThis = (CSEShellView *)(LONG_PTR)::GetWindowLong(hWnd, GWLP_USERDATA);
    LRESULT lret = 0;
    if ( orgProc )
    {
        lret = CallWindowProc( orgProc, hWnd, uMessage, wParam, lParam );
    }
    else
    {
        lret = DefWindowProc( hWnd, uMessage, wParam, lParam );
    }
    if ( WM_COMMAND == uMessage
	          && pThis )
    {
        pThis->OnCommand(GET_WM_COMMAND_ID(wParam, lParam),
            GET_WM_COMMAND_CMD(wParam, lParam),
            GET_WM_COMMAND_HWND(wParam, lParam));
    }
    else if ( WM_LBUTTONDBLCLK == uMessage
        && pThis )
    {
        NMHDR nmhdr = {0};
        nmhdr.code = NM_DBLCLK;
        pThis->OnNotify( &nmhdr );
    }  
    else if ( WM_RBUTTONDOWN == uMessage
        && pThis )
    {
        NMHDR nmhdr = {0};
        nmhdr.code = NM_RCLICK;
        pThis->OnNotify( &nmhdr );
    }
    else if ( WM_SIZE == uMessage 
        && pThis )
    {
        InvalidateRect( pThis->m_hWnd, NULL, true );
        UpdateWindow(pThis->m_hWnd);
    }
    return lret;
}
Beispiel #28
0
Datei: mew.c Projekt: redtower/rc
/******************************************************************
 *                      Selecting Emacsen                         *
 ******************************************************************/
BOOL CALLBACK SelectEmacsenDlgProc( HWND   hDlg,
				    UINT   uiMsg,
				    WPARAM wParam,
				    LPARAM lParam )
{
  BOOL fRet = TRUE;
  int  nItem;
  int  i;
  HWND hwndList;

  switch ( uiMsg ){
  case WM_INITDIALOG:
    hwndList = GetDlgItem( hDlg, IDC_SELIST );
    for ( i=0; i<iEmacsenNum; i++ ){
      SendMessage( hwndList, LB_ADDSTRING, 0, (LPARAM)szEmacsenList[i] );
      SendMessage( hwndList, LB_SETITEMDATA, i, i );
    }
    SendMessage( hwndList, LB_SETCURSEL, 0, 0 );
    if ( langId == LANGID_JAPANESE )
      SetDlgItemText( hDlg, IDC_SESTATIC, "Emacs の種類を選択して下さい" );
    ShowWindow( hDlg, SW_SHOW );
    UpdateWindow( hDlg );
    break;
    
  case WM_COMMAND:
    switch ( GET_WM_COMMAND_ID( wParam, lParam ) ){
    case IDOK:
      hwndList = GetDlgItem( hDlg, IDC_SELIST );
      nItem = SendMessage( hwndList, LB_GETCURSEL, 0, 0 );
      EndDialog( hDlg, nItem );
      break;
    case IDCANCEL:
      EndDialog( hDlg, -1);
      fRet = FALSE;
      break;
    }
  default:
    fRet = FALSE;
    break;
  } /* switch ( uiMsg ){ */
  return ( fRet );
}
Beispiel #29
0
/*
 * AboutDialogProc:  Display info about client.
 */
BOOL CALLBACK AboutDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
   int i;

   HBITMAP gBitmap;

   switch (message)
   {
     HANDLE_MSG(hDlg, WM_INITDIALOG, AboutInitDialog);
     HANDLE_MSG(hDlg, WM_TIMER, AboutTimer);
     HANDLE_MSG(hDlg, WM_LBUTTONDOWN, AboutLButtonDown);
      
   case WM_COMMAND:
      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
      case IDOK:
      case IDCANCEL:
	 EndDialog(hDlg, IDOK);
	 if (timer_id != 0)
	   KillTimer(hDlg, TIMER_ABOUT);

	 gBitmap = (HBITMAP) SelectObject(gDC, gOldBitmap);
	 DeleteObject(gBitmap);
	 DeleteDC(gDC);

	 for (i=0; i < NUM_DUDES; i++)
	   if (dudes[i].obj != NULL)
	     dudes[i].obj = ObjectDestroyAndFree(dudes[i].obj);

	 BitmapsFree(&credits_b);
	 return TRUE;
      }
      break;

   case WM_DESTROY:
      hAboutDlg = NULL;
      return TRUE;
   
   }

   return FALSE;
}
LRESULT Main_OnCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);

switch (GET_WM_COMMAND_ID(wParam, lParam))
   {
   case IDM_EXIT:
      DestroyWindow(hWnd);
      break;

   case IDM_LARGE_ICONS:
      {
      HWND  hwndListView = GetDlgItem(hWnd, IDC_LISTVIEW);
      DWORD dwStyle = GetWindowLong(hwndListView, GWL_STYLE);
      SetWindowLong(hwndListView, GWL_STYLE, (dwStyle & ~LVS_TYPEMASK) | LVS_ICON);
      }
      break;

   case IDM_SMALL_ICONS:
      {
      HWND  hwndListView = GetDlgItem(hWnd, IDC_LISTVIEW);
      DWORD dwStyle = GetWindowLong(hwndListView, GWL_STYLE);
      SetWindowLong(hwndListView, GWL_STYLE, (dwStyle & ~LVS_TYPEMASK) | LVS_SMALLICON);
      }
      break;

   case IDM_LIST:
      {
      HWND  hwndListView = GetDlgItem(hWnd, IDC_LISTVIEW);
      DWORD dwStyle = GetWindowLong(hwndListView, GWL_STYLE);
      SetWindowLong(hwndListView, GWL_STYLE, (dwStyle & ~LVS_TYPEMASK) | LVS_LIST);
      }
      break;

   
   case IDM_REFRESH:
      List_Refresh(GetDlgItem(hWnd, IDC_LISTVIEW));
      break;
   }

return 0;
}