Exemple #1
0
		ibool Main::OnSysCommand(Param& param)
		{
			switch (param.wParam & 0xFFF0)
			{
				case SC_MOVE:
				case SC_SIZE:

					return Fullscreen();

				case SC_MONITORPOWER:
				case SC_SCREENSAVE:

					return Fullscreen() || emulator.IsOn();

				case SC_MAXIMIZE:

					if (Fullscreen())
						return true;

				case SC_MINIMIZE:
				case SC_RESTORE:

					if (Windowed())
						emulator.Stop();

					break;
			}

			return false;
		}
Exemple #2
0
		void Main::Save(Configuration& cfg) const
		{
			{
				Configuration::Section show( cfg["view"]["show"] );

				show[ "on-top"      ].YesNo() = menu[IDM_VIEW_ON_TOP].Checked();
				show[ "window-menu" ].YesNo() = (Windowed() ? menu.Visible() : window.menu);
			}

			Rect rect( video.Fullscreen() ? window.rect : window.GetPlacement() );
			rect.Position() += Point(rect.left < 0 ? -rect.left : 0, rect.top < 0 ? -rect.top : 0 );

			if (preferences[Managers::Preferences::SAVE_WINDOWPOS])
			{
				Configuration::Section pos( cfg["view"]["window-position"] );

				pos[ "left"   ].Int() = rect.left;
				pos[ "top"    ].Int() = rect.top;
				pos[ "right"  ].Int() = rect.right;
				pos[ "bottom" ].Int() = rect.bottom;
			}

			video.Save( cfg, rect );
			sound.Save( cfg );
			input.Save( cfg );
			frameClock.Save( cfg );
		}
Exemple #3
0
		void Main::OnCmdViewSwitchScreen(uint)
		{
			Application::Instance::Waiter wait;

			emulator.Stop();

			if (Windowed())
			{
				window.menu = menu.Visible();
				window.maximized = window.Maximized();
				window.rect = window.GetPlacement();

				menu.Hide();

				menu[ IDM_VIEW_ON_TOP ].Disable();
				menu[ IDM_VIEW_SWITCH_SCREEN ].Text() << Resource::String(IDS_MENU_DESKTOP);

				window.MakeTopMost( false );
				window.MakeFullscreen();

				Application::Instance::Events::Signal( Application::Instance::EVENT_FULLSCREEN );

				video.SwitchScreen();

				if (!emulator.IsOn())
					menu.Show();
			}
			else
			{
				Application::Instance::Events::Signal( Application::Instance::EVENT_DESKTOP );

				menu.Hide();

				video.SwitchScreen();

				window.Show( false );
				window.MakeTopMost( menu[IDM_VIEW_ON_TOP].Checked() );
				window.MakeWindowed( MainWindow::WIN_STYLE, MainWindow::WIN_EXSTYLE );

				menu[ IDM_VIEW_ON_TOP ].Enable();
				menu[ IDM_VIEW_SWITCH_SCREEN ].Text() << Resource::String(IDS_MENU_FULLSCREEN);

				if (window.menu)
					menu.Show();

				if (window.maximized)
					window.Maximize();

				window.SetPlacement( window.rect );
				window.Show( true );

				Application::Instance::ShowChildWindows();
			}

			::Sleep( 500 );
		}
Exemple #4
0
		void Main::OnCmdViewShowOnTop(uint)
		{
			NST_ASSERT( Windowed() );

			window.MakeTopMost( menu[IDM_VIEW_ON_TOP].ToggleCheck() );
		}
Exemple #5
0
		bool Main::OnStartEmulation()
		{
			if (window.Enabled() && (CanRunInBackground() || (window.Active() && !window.Minimized() && (Windowed() || !menu.Visible()))))
			{
				int priority;

				switch (preferences.GetPriority())
				{
					case Managers::Preferences::PRIORITY_HIGH:

						if (emulator.IsGame() && !CanRunInBackground())
						{
							priority = THREAD_PRIORITY_HIGHEST;
							break;
						}

					case Managers::Preferences::PRIORITY_ABOVE_NORMAL:

						priority = THREAD_PRIORITY_ABOVE_NORMAL;
						break;

					default:

						priority = THREAD_PRIORITY_NORMAL;
						break;
				}

				::SetThreadPriority( ::GetCurrentThread(), priority );

				frameClock.StartEmulation();
				video.StartEmulation();
				input.StartEmulation();
				sound.StartEmulation();

				return true;
			}

			return false;
		}
			bool Fullscreen() const
			{
				return !Windowed();
			}