Exemple #1
0
BOOL CALLBACK GeneralCfg(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
        
    switch(Message) {
    case WM_INITDIALOG:
         WriteCheckBoxValue( hwnd, IDC_SHOWFPS, Config.showFPS) ;
         WriteCheckBoxValue( hwnd, IDC_SHOWVIS, Config.showVIS) ;       
         WriteCheckBoxValue( hwnd, IDC_ALERTBADROM, Config.alertBAD);
         WriteCheckBoxValue( hwnd, IDC_ALERTHACKEDROM, Config.alertHACK);  
         WriteCheckBoxValue( hwnd, IDC_ALERTSAVESERRORS, Config.savesERRORS);  
         WriteCheckBoxValue( hwnd, IDC_LIMITFPS, Config.limitFps);  
         WriteCheckBoxValue( hwnd, IDC_INI_COMPRESSED, Config.compressedIni);
         WriteCheckBoxValue( hwnd, IDC_SPEEDMODIFIER, Config.UseFPSmodifier  );
               
         switch (Config.guiDynacore)    
            {        
               case 0:
                     CheckDlgButton(hwnd, IDC_INTERP, BST_CHECKED);
                     break;
               case 1:
                     CheckDlgButton(hwnd, IDC_RECOMP, BST_CHECKED);
                     break;             
               case 2:
                     CheckDlgButton(hwnd, IDC_PURE_INTERP, BST_CHECKED);             
                     break;      
             }       
         
         if (emu_launched) {
                  EnableWindow( GetDlgItem(hwnd,IDC_INTERP), FALSE );
                  EnableWindow( GetDlgItem(hwnd,IDC_RECOMP), FALSE );
                  EnableWindow( GetDlgItem(hwnd,IDC_PURE_INTERP), FALSE );
         }
         
         CreateTrackbar(hwnd,1,200,Config.FPSmodifier,200) ; 
         
         SwitchLimitFPS(hwnd);
         FillModifierValue( hwnd, Config.FPSmodifier);        
         TranslateGeneralDialog(hwnd) ;                           
         return TRUE;
         
    case WM_COMMAND:
        switch(LOWORD(wParam))
        {
           case IDC_INTERP:
                if (!emu_launched) {
                   Config.guiDynacore = 0;
                   }
           break;
           case IDC_RECOMP:
                if (!emu_launched) {
                   Config.guiDynacore = 1;
                   }
           break;
           case IDC_PURE_INTERP:
                if (!emu_launched) {
                   Config.guiDynacore = 2;
                   }
           break;
           case IDC_LIMITFPS:
                SwitchLimitFPS(hwnd) ;
           break;
           case  IDC_SPEEDMODIFIER:
                SwitchModifier(hwnd)  ;
           break; 
                    
        }
        break;

    case WM_NOTIFY:
		       if (((NMHDR FAR *) lParam)->code == NM_RELEASEDCAPTURE)  {
                    FillModifierValue( hwnd, SendMessage( hwndTrack , TBM_GETPOS, 0, 0));        
               }     
               if (((NMHDR FAR *) lParam)->code == PSN_APPLY)  {
                              Config.showFPS = ReadCheckBoxValue( hwnd, IDC_SHOWFPS);
                              Config.showVIS = ReadCheckBoxValue( hwnd, IDC_SHOWVIS);
                              Config.alertBAD = ReadCheckBoxValue(hwnd,IDC_ALERTBADROM);
                              Config.alertHACK = ReadCheckBoxValue(hwnd,IDC_ALERTHACKEDROM);
                              Config.savesERRORS = ReadCheckBoxValue(hwnd,IDC_ALERTSAVESERRORS);
                              Config.limitFps = ReadCheckBoxValue(hwnd,IDC_LIMITFPS);
                              Config.compressedIni = ReadCheckBoxValue(hwnd,IDC_INI_COMPRESSED);
                              Config.FPSmodifier = SendMessage( hwndTrack , TBM_GETPOS, 0, 0);
                              Config.UseFPSmodifier = ReadCheckBoxValue( hwnd , IDC_SPEEDMODIFIER );
                              if (emu_launched) SetStatusMode( 2 );
                              else SetStatusMode( 0 );
                              InitTimer();
                              }
            break;                     
     default:
            return FALSE;       
     }
     return TRUE;            
}
Exemple #2
0
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
            LPSTR lpCmdLine, int nCmdShow )
{
    MSG msg;
    WNDCLASS wc = {sizeof(WNDCLASS)};
    wc.lpszClassName = TEXT( "Static Control" );
    wc.hInstance     = hInstance ;
    wc.hbrBackground = GetSysColorBrush(COLOR_MENU);
    wc.lpfnWndProc   = WndProc;
    wc.hIcon         = LoadIcon (NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor (NULL, IDC_ARROW);

    RegisterClass(&wc);
    hwnd = CreateWindow( wc.lpszClassName, TEXT("IoTivity Media Client - Windows UI"),
                   WS_OVERLAPPEDWINDOW ^ WS_THICKFRAME,
                   100, 100, 275, 170, 0, 0, hInstance, 0);

    InitCommonControls(); // loads common control's DLL

    hwndVolumeSlider =
             CreateTrackbar(hwnd,
                            10,10,
                            170,40,
                            0,100,
                            0,0);
    hwndVolumeExpectedLabel =
                CreateLabel(hwnd,
                            "Expected Volume",
                            10,50,
                            240,30);

    LabelPrintf(hwndVolumeExpectedLabel,
                "Expected Volume: %i",
                0);

    hwndButtonPlayPause =
                CreateButton(hwnd,
                             ID_BUTTONPLAYPAUSE,
                             "PlayPause",
                             180,10,
                             80,35);

    hwndButtonFind =
                CreateButton(hwnd,
                             ID_BUTTONFIND,
                             "Find",
                             10,75,
                             64,25);

    hwndButtonGet =
                CreateButton(hwnd,
                             ID_BUTTONGET,
                             "Get",
                             10,105,
                             64,25);

    hwndButtonPut =
                CreateButton(hwnd,
                             ID_BUTTONPUT,
                             "Put",
                             80,75,
                             64,25);

    hwndButtonPost =
                CreateButton(hwnd,
                             ID_BUTTONPOST,
                             "Post",
                             80,105,
                             64,25);
    hwndButtonBeginObserve =
                CreateButton(hwnd,
                             ID_BUTTONBEGINOBSERVE,
                             "Bgn Obs",
                             150,75,
                             64,25);
    hwndButtonCancelObserve =
                CreateButton(hwnd,
                             ID_BUTTONCANCELOBSERVE,
                             "Cncl Obs",
                             150,105,
                             64,25);


    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);

    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    return (int) msg.wParam;
}
Exemple #3
0
	INT_PTR CALLBACK OptionsDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
	{
		void * dummyVar = 0;

		// retrieve global state from parent window
		State * pState = (State *)GetWindowLongPtr(GetParent(hwndDlg), GWLP_USERDATA);

		switch (msg)
		{
		case WM_INITDIALOG:
			CreateBrushes();
			CreateFonts(hwndDlg);
			CreateTrackbar(hwndDlg, pState);

			SetupUI(hwndDlg, pState);
			return TRUE;

		case WM_HSCROLL:

			switch (LOWORD(wParam))
			{
			case TB_BOTTOM:
			case TB_ENDTRACK:
			case TB_LINEDOWN:
			case TB_LINEUP:
			case TB_PAGEDOWN:
			case TB_PAGEUP:
			case TB_TOP:
			case TB_THUMBPOSITION:
			case TB_THUMBTRACK:
				dummyVar;
				{
					DWORD dwPos = 0;
					dwPos = (DWORD)SendMessage(priv::hWndTrack, TBM_GETPOS, 0, 0);

					if (dwPos > (DWORD)pState->settings.maxTransparency)
						SendMessage(priv::hWndTrack, TBM_SETPOS,
						(WPARAM)TRUE,       // redraw flag 
						(LPARAM)pState->settings.maxTransparency);

					else if (dwPos < (DWORD)pState->settings.minTransparency)
						SendMessage(priv::hWndTrack, TBM_SETPOS,
						(WPARAM)TRUE,       // redraw flag 
						(LPARAM)pState->settings.minTransparency);

					pState->settings.currentTransparency = (BYTE)dwPos;
					efx::SetTransparency(pState->hWndStartScreen, pState->settings.currentTransparency);
				}

			default:
				break;
			}
			return TRUE;

		case WM_DRAWITEM:
			if (wParam == ID_TITLE)
			{
				DRAWITEMSTRUCT * pDis = (DRAWITEMSTRUCT *)lParam;

				RECT cr = { 0 };
				GetClientRect(pDis->hwndItem, &cr);

				FillRect(pDis->hDC, &cr, priv::hTitleBrush);
				FrameRect(pDis->hDC, &cr, priv::hBlackBrush);

				TCHAR * title = _T("Settings");
				int titlelen = (int)_tcsclen(title);

				HGDIOBJ oldHFont = SelectObject(pDis->hDC, priv::hTitleFont);
				DrawText(pDis->hDC, title, titlelen, &cr, DT_CENTER | DT_VCENTER | DT_SINGLELINE);

				SelectObject(pDis->hDC, oldHFont);
			}
			else if (wParam == ID_BODY)
			{
				DRAWITEMSTRUCT * pDis = (DRAWITEMSTRUCT *)lParam;

				RECT cr = { 0 };
				GetClientRect(pDis->hwndItem, &cr);

				FillRect(pDis->hDC, &cr, priv::hBodyBrush);
				FrameRect(pDis->hDC, &cr, priv::hBlackBrush);
			}
			return TRUE;

		case WM_WINDOWPOSCHANGING:
			SetupUI(hwndDlg, pState);
			return TRUE;

		case WM_COMMAND:
			if (lParam == (LPARAM)GetDlgItem(hwndDlg, ID_SHOW_SIZING_FRAME))
			{
				switch (HIWORD(wParam))
				{
				case BN_CLICKED:
					pState->showSizingFrame = (IsDlgButtonChecked(hwndDlg, ID_SHOW_SIZING_FRAME) == BST_CHECKED);
					break;
				default:
					break;
				}
			}
			else
			{
				switch (LOWORD(wParam))
				{
				case ID_SHOW_START_SCREEN:
					scr::PopStartScreen();
					return TRUE;

				case IDOK:
					DestroyWindow(hwndDlg);
					return TRUE;
				}
			}
			break;

		case WM_ERASEBKGND:
			return FALSE;

		case WM_CTLCOLORSTATIC:
			if ((HWND)lParam == GetDlgItem(hwndDlg, ID_TITLE))
			{
				SetBkMode((HDC)wParam, TRANSPARENT);
				return (LONG_PTR)priv::hTitleBrush;
			}
			else if ((HWND)lParam == GetDlgItem(hwndDlg, ID_BODY))
			{
				return (LONG_PTR)priv::hBodyBrush;
			}
			else if ((HWND)lParam == priv::hWndTrack)
			{
				return (LONG_PTR)priv::hBodyBrush;
			}
			else if ((HWND)lParam == GetDlgItem(hwndDlg, ID_START_SCREEN_TRANSPARENCY))
			{
				SetBkMode((HDC)wParam, TRANSPARENT);
				return (LONG_PTR)priv::hBodyBrush;
			}
			else if ((HWND)lParam == GetDlgItem(hwndDlg, ID_START_SCREEN_SIZING))
			{
				SetBkMode((HDC)wParam, TRANSPARENT);
				return (LONG_PTR)priv::hBodyBrush;
			}
			else if ((HWND)lParam == GetDlgItem(hwndDlg, ID_SHOW_SIZING_FRAME))
			{
				SetBkMode((HDC)wParam, TRANSPARENT);
				return (LONG_PTR)priv::hBodyBrush;
			}
			else if ((HWND)lParam == GetDlgItem(hwndDlg, ID_MIN_TRANSPARENCY))
			{
				SetBkMode((HDC)wParam, TRANSPARENT);
				return (LONG_PTR)priv::hBodyBrush;
			}
			else if ((HWND)lParam == GetDlgItem(hwndDlg, ID_MAX_TRANSPARENCY))
			{
				SetBkMode((HDC)wParam, TRANSPARENT);
				return (LONG_PTR)priv::hBodyBrush;
			}
			else
			{
				return FALSE;
			}

		case WM_DESTROY:
			priv::hWndDlg = NULL;
			return TRUE;

		case WM_CLOSE:
			DestroyWindow(hwndDlg);
			return TRUE;
		}
		return FALSE;
	}