GUI: Fixed the render-to-main fullscreen mode and screen resizing

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4056 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-08-25 06:34:58 +00:00
parent 6b8b576bab
commit 53a8ca52b6
11 changed files with 119 additions and 103 deletions

View File

@ -335,7 +335,7 @@
</Configuration>
<Configuration
Name="DebugFast|Win32"
OutputDirectory="wxBase28_$(PlatformName)\$(ConfigurationName)"
OutputDirectory="wxBase28_$(PlatformName)\..\..\..\lib\vc_lib\Win32"
IntermediateDirectory="wxBase28_$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
@ -5736,6 +5736,10 @@
<Filter
Name="Setup Headers"
>
<File
RelativePath="..\..\include\wx\univ\setup.h"
>
</File>
<File
RelativePath="..\..\include\wx\msw\setup.h"
>
@ -5800,10 +5804,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\include\wx\univ\setup.h"
>
</File>
</Filter>
<Filter
Name="MSW Headers"

View File

@ -191,7 +191,6 @@ std::string Timer::GetTimeFormatted()
strftime(tmp, 6, "%M:%S", gmTime);
// Now tack on the milliseconds
struct timeb tp;
(void)::ftime(&tp);
@ -200,4 +199,29 @@ std::string Timer::GetTimeFormatted()
return std::string(formattedTime);
}
// Returns a timestamp with decimals for precise time comparisons
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
double Timer::GetDoubleTime()
{
struct timeb tp;
(void)::ftime(&tp);
u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970(); // Get continous timestamp
/* Remove a few years. We only really want enough seconds to make sure that we are
detecting actual actions, perhaps 60 seconds is enough really, but I leave a
year of seconds anyway, in case the user's clock is incorrect or something like that */
TmpSeconds = TmpSeconds - (38 * 365 * 24 * 60 * 60);
//if (TmpSeconds < 0) return 0; // Check the the user's clock is working somewhat
u32 Seconds = (u32)TmpSeconds; // Make a smaller integer that fits in the double
double ms = tp.millitm / 1000.0;
double TmpTime = Seconds + ms;
return TmpTime;
}
} // Namespace Common

View File

@ -44,6 +44,7 @@ public:
static void RestoreResolution();
static u64 GetTimeSinceJan1970();
static u64 GetLocalTimeSinceJan1970();
static double GetDoubleTime();
static std::string GetTimeFormatted();
std::string GetTimeElapsedFormatted() const;

View File

@ -82,7 +82,7 @@ extern "C" {
};
//////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Windows functions. Setting the cursor with wxSetCursor() did not work in this instance.
Probably because it's somehow reset from the WndProc() in the child window */
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@ -113,12 +113,11 @@ HWND MSWGetParent_(HWND Parent)
return GetParent(Parent);
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/* The CPanel class to receive MSWWindowProc messages from the video plugin. */
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
extern CFrame* main_frame;
@ -214,10 +213,10 @@ int abc = 0;
return wxPanel::MSWWindowProc(nMsg, wParam, lParam);
}
#endif
//////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// event tables
// ----------------------------
@ -297,10 +296,10 @@ EVT_MENU(wxID_ANY, CFrame::PostEvent)
//EVT_UPDATE_UI(wxID_ANY, CFrame::PostUpdateUIEvent)
END_EVENT_TABLE()
//////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Creation and close, quit functions
// ----------------------------------------
CFrame::CFrame(bool showLogWindow,
@ -322,6 +321,8 @@ CFrame::CFrame(bool showLogWindow,
#endif
{
// Start debugging mazimized
if (UseDebugger) this->Maximize(true);
// Debugger class
if (UseDebugger)
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this);
@ -371,15 +372,15 @@ CFrame::CFrame(bool showLogWindow,
if (UseDebugger)
{
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().
Name(wxT("test8")).Caption(wxT("Tree Pane")).
Name(wxT("Pane1")).Caption(wxT("Pane1")).
CenterPane().PaneBorder(true));
/**/
m_Mgr->AddPane(m_Panel2, wxAuiPaneInfo().
Name(wxT("test9")).Caption(wxT("Tree Pane")).
Name(wxT("Pane2")).Caption(wxT("Pane2")).
CenterPane());
m_Mgr->AddPane(g_pCodeWindow, wxAuiPaneInfo().
Name(wxT("test10")).Caption(wxT("Tree Pane")).
Name(wxT("Pane3")).Caption(wxT("Pane3")).
CenterPane().Right());
}
else
@ -390,22 +391,20 @@ CFrame::CFrame(bool showLogWindow,
this->SetSizer(sizerFrame);
*/
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().
Name(wxT("test8")).Caption(wxT("Tree Pane")).
Name(wxT("Pane1")).Caption(wxT("Pane1")).
CenterPane().PaneBorder(false));
}
// Open log window
m_LogWindow = new CLogWindow(this);
if (m_bLogWindow) m_LogWindow->Show();
// Create the toolbar
// Create toolbar
RecreateToolbar();
if (!SConfig::GetInstance().m_InterfaceToolbar) TheToolBar->Hide();
FitInside();
Show(); // Show the window
// Show window
Show();
// Create list of available plugins for the configuration window
CPluginManager::GetInstance().ScanForPlugins();
@ -443,6 +442,7 @@ CFrame::CFrame(bool showLogWindow,
#endif
// ----------
// Update controls
UpdateGUI();
if (UseDebugger) g_pCodeWindow->UpdateButtonStates();
@ -482,10 +482,25 @@ void CFrame::OnClose(wxCloseEvent& event)
UpdateGUI();
}
}
//////////////////////////////////////////////////////////////////////////////////////////
void CFrame::DoFullscreen(bool _F)
{
ShowFullScreen(_F);
if (_F)
{
m_Mgr->GetPane(wxT("TBMain")).Hide();
m_Mgr->Update();
}
else
{
m_Mgr->GetPane(wxT("TBMain")).Show();
m_Mgr->Update();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Host messages
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
#ifdef _WIN32
@ -538,10 +553,10 @@ void CFrame::PostUpdateUIEvent(wxUpdateUIEvent& event)
{
if (g_pCodeWindow) wxPostEvent(g_pCodeWindow, event);
}
//////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Input
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
@ -582,29 +597,32 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
// Escape key turn off fullscreen then Stop emulation in windowed mode
if (event.GetKeyCode() == WXK_ESCAPE)
{
// Temporary solution to double esc keydown. When the OpenGL plugin is running all esc keydowns are duplicated
// I'm guessing it's coming from the OpenGL plugin but I couldn't find the source of it so I added this until
// the source of the problem surfaces.
static double Time = 0;
if (Common::Timer::GetDoubleTime()-1 < Time) return;
Time = Common::Timer::GetDoubleTime();
DoFullscreen(!IsFullScreen());
if (IsFullScreen())
{
ShowFullScreen(false);
#ifdef _WIN32
#ifdef _WIN32
MSWSetCursor(true);
#endif
}
else
DoStop();
UpdateGUI();
#endif
}
//UpdateGUI();
}
if (event.GetKeyCode() == WXK_RETURN && event.GetModifiers() == wxMOD_ALT)
{
// For some reasons, wxWidget doesn't proccess the Alt+Enter event there on windows.
// But still, pressing Alt+Enter make it Fullscreen, So this is for other OS... :P
ShowFullScreen(!IsFullScreen());
DoFullscreen(!IsFullScreen());
}
#ifdef _WIN32
if(event.GetKeyCode() == 'M', '3', '4', '5', '6') // Send this to the video plugin WndProc
{
PostMessage((HWND)Core::GetWindowHandle(), WM_KEYDOWN, event.GetKeyCode(), 0);
event.Skip(); // Don't block the E key
}
#endif
@ -630,31 +648,12 @@ void CFrame::OnKeyUp(wxKeyEvent& event)
CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 0); // 0 = Up
event.Skip();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Returns a timestamp with decimals for precise time comparisons
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯?
double GetDoubleTime()
{
wxDateTime datetime = wxDateTime::UNow(); // Get timestamp
u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970(); // Get continous timestamp
/* Remove a few years. We only really want enough seconds to make sure that we are
detecting actual actions, perhaps 60 seconds is enough really, but I leave a
year of seconds anyway, in case the user's clock is incorrect or something like that */
TmpSeconds = TmpSeconds - (38 * 365 * 24 * 60 * 60);
//if (TmpSeconds < 0) return 0; // Check the the user's clock is working somewhat
u32 Seconds = (u32)TmpSeconds; // Make a smaller integer that fits in the double
double ms = datetime.GetMillisecond() / 1000.0;
double TmpTime = Seconds + ms;
return TmpTime;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Detect double click. Kind of, for some reason we have to manually create the double click for now.
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯?
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void CFrame::OnDoubleClick(wxMouseEvent& event)
{
// Don't block the mouse click
@ -667,13 +666,13 @@ void CFrame::OnDoubleClick(wxMouseEvent& event)
if(Core::GetState() == Core::CORE_UNINITIALIZED || event.GetId() != IDM_MPANEL) return;
// For first click just save the time
if(m_fLastClickTime == 0) { m_fLastClickTime = GetDoubleTime(); return; }
if(m_fLastClickTime == 0) { m_fLastClickTime = Common::Timer::GetDoubleTime(); return; }
// -------------------------------------------
/* Manually detect double clicks since both wxEVT_LEFT_DCLICK and WM_LBUTTONDBLCLK stops
working after the child window is created by the plugin */
// ----------------------
double TmpTime = GetDoubleTime();
double TmpTime = Common::Timer::GetDoubleTime();
int Elapsed = (TmpTime - m_fLastClickTime) * 1000;
// Get the double click time, if avaliable
@ -688,7 +687,7 @@ void CFrame::OnDoubleClick(wxMouseEvent& event)
if (Elapsed < DoubleClickTime)
{
ShowFullScreen(!IsFullScreen());
DoFullscreen(!IsFullScreen());
#ifdef _WIN32
MSWSetCursor(true); // Show the cursor again, in case it was hidden
#endif
@ -700,7 +699,7 @@ void CFrame::OnDoubleClick(wxMouseEvent& event)
// Check for mouse motion. Here we process the bHideCursor setting.
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯?
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void CFrame::OnMotion(wxMouseEvent& event)
{
event.Skip();
@ -723,7 +722,7 @@ void CFrame::OnMotion(wxMouseEvent& event)
// Update motion for the auto hide option and return
if(IsFullScreen() && SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor)
{
m_iLastMotionTime = GetDoubleTime();
m_iLastMotionTime = Common::Timer::GetDoubleTime();
#ifdef _WIN32
MSWSetCursor(true);
#endif
@ -755,7 +754,7 @@ void CFrame::OnMotion(wxMouseEvent& event)
}
// Check for mouse status a couple of times per second for the auto hide option
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯?
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
#if wxUSE_TIMER
void CFrame::Update()
{
@ -766,7 +765,7 @@ void CFrame::Update()
if(IsFullScreen())
{
int HideDelay = 1; // Wait 1 second to hide the cursor, just like Windows Media Player
double TmpSeconds = GetDoubleTime(); // Get timestamp
double TmpSeconds = Common::Timer::GetDoubleTime(); // Get timestamp
double CompareTime = TmpSeconds - HideDelay; // Compare it
if(m_iLastMotionTime < CompareTime) // Update cursor
@ -778,3 +777,4 @@ void CFrame::Update()
}
}
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -217,6 +217,7 @@ class CFrame : public wxFrame
void GameListChanged(wxCommandEvent& event);
void OnGameListCtrl_ItemActivated(wxListEvent& event);
void CFrame::DoFullscreen(bool _F);
// MenuBar
// File - Drive

View File

@ -280,6 +280,11 @@ void CFrame::PopulateToolbar(wxAuiToolBar* toolBar)
// Delete and recreate the toolbar
void CFrame::RecreateToolbar()
{
// Delete toolbar
wxToolBarBase* toolBar = GetToolBar();
delete toolBar;
SetToolBar(NULL);
wxAuiToolBar* TheToolBar = new wxAuiToolBar(this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_TEXT);
@ -288,7 +293,7 @@ void CFrame::RecreateToolbar()
UpdateGUI();
m_Mgr->AddPane(TheToolBar, wxAuiPaneInfo().
Name(wxT("TheToolBar")).Caption(wxT("Big Toolbar")).
Name(wxT("TBMain")).Caption(wxT("TBMain")).
ToolbarPane().Top().
LeftDockable(false).RightDockable(false));
@ -300,7 +305,7 @@ void CFrame::RecreateToolbar()
g_pCodeWindow->PopulateToolbar(TheToolBar2);
m_Mgr->AddPane(TheToolBar2, wxAuiPaneInfo().
Name(wxT("TheToolBar2")).Caption(wxT("Big Toolbar")).
Name(wxT("TBDebug")).Caption(wxT("TBDebug")).
ToolbarPane().Top().
LeftDockable(false).RightDockable(false));
}
@ -308,7 +313,6 @@ void CFrame::RecreateToolbar()
/*
wxToolBarBase* toolBar = GetToolBar();
long style = toolBar ? toolBar->GetWindowStyle() : TOOLBAR_STYLE;
delete toolBar;
SetToolBar(NULL);
@ -729,7 +733,7 @@ void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED (event))
// the entire screen (when we render to the main window).
void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED (event))
{
ShowFullScreen(true);
DoFullscreen(true);
UpdateGUI();
}
@ -820,7 +824,9 @@ void CFrame::OnFrameSkip(wxCommandEvent& event)
void CFrame::OnResize(wxSizeEvent& event)
{
FitInside();
// fit frame content, not needed right now
//FitInside();
DoMoveIcons(); // In FrameWiimote.cpp
event.Skip();
}
@ -956,9 +962,8 @@ void CFrame::UpdateGUI()
GetMenuBar()->FindItem(IDM_PLAY)->SetText(_("&Play\tF10"));
}
if (GetToolBar() != NULL)
GetToolBar()->Realize();
// Commit changes to toolbar
if (GetToolBar() != NULL) GetToolBar()->Realize();
if (!initialized)
{
@ -977,9 +982,6 @@ void CFrame::UpdateGUI()
m_GameListCtrl->Hide();
}
}
//TheToolBar->Realize();
FitInside();
}
void CFrame::GameListChanged(wxCommandEvent& event)

View File

@ -46,9 +46,16 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dolphin", "Core\DolphinWX\DolphinWX.vcproj", "{A72606EF-C5C1-4954-90AD-F0F93A8D97D9}"
ProjectSection(ProjectDependencies) = postProject
{C7E5D50A-2916-464B-86A7-E10B3CC88ADA} = {C7E5D50A-2916-464B-86A7-E10B3CC88ADA}
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160} = {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8} = {D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}
{8D612734-FAA5-4B8A-804F-4DEA2367D495} = {8D612734-FAA5-4B8A-804F-4DEA2367D495}
{9A183B48-ECC2-4121-876A-9B3793686073} = {9A183B48-ECC2-4121-876A-9B3793686073}
{636FAD5F-02D1-4E9A-BE67-FB8EA99B9A18} = {636FAD5F-02D1-4E9A-BE67-FB8EA99B9A18}
{33546D62-7F34-4EA6-A88E-D538B36E16BF} = {33546D62-7F34-4EA6-A88E-D538B36E16BF}
{3E03C179-8251-46E4-81F4-466F114BAC63} = {3E03C179-8251-46E4-81F4-466F114BAC63}
{823DDC98-42D5-4A38-88CF-9DC06C788AE4} = {823DDC98-42D5-4A38-88CF-9DC06C788AE4}
{3D8156A9-64D1-4C8E-ADBE-1B319030E4A4} = {3D8156A9-64D1-4C8E-ADBE-1B319030E4A4}
{521498BE-6089-4780-8223-E67C22F4E068} = {521498BE-6089-4780-8223-E67C22F4E068}
{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA} = {E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}
{29C2ABC1-ADA5-42CD-A5FC-96022D52A510} = {29C2ABC1-ADA5-42CD-A5FC-96022D52A510}
{4D3CD4C5-412B-4B49-9B1B-A68A2A129C77} = {4D3CD4C5-412B-4B49-9B1B-A68A2A129C77}

View File

@ -492,7 +492,7 @@ void WiimoteRecordingConfigDialog::DoRecordMovement(int _x, int _y, int _z, cons
Tmp.x = _x;
Tmp.y = _y;
Tmp.z = _z;
Tmp.Time = GetDoubleTime();
Tmp.Time = Common::Timer::GetDoubleTime();
memcpy(Tmp.IR, _IR, _IRBytes);
m_vRecording.push_back(Tmp);

View File

@ -21,6 +21,7 @@
#include <string>
#include "Common.h" // Common
#include "Timer.h"
#include "pluginspecs_wiimote.h"
#include "StringUtil.h" // For ArrayToString
@ -147,11 +148,11 @@ bool RecordingPlayAccIR(u8 &_x, u8 &_y, u8 &_z, IRReportType &_IR, int Wm)
if(g_RecordingCounter[Wm] == 0)
{
INFO_LOG(CONSOLE, "\n\nBegin: %i\n", Wm);
g_RecordingStart[Wm] = GetDoubleTime();
g_RecordingStart[Wm] = Common::Timer::GetDoubleTime();
}
// Get current time
g_RecordingCurrentTime[Wm] = GetDoubleTime() - g_RecordingStart[Wm];
g_RecordingCurrentTime[Wm] = Common::Timer::GetDoubleTime() - g_RecordingStart[Wm];
// Modify the current time
g_RecordingCurrentTime[Wm] *= ((25.0 + (double)VRecording.at(g_RecordingPlaying[Wm]).PlaybackSpeed * 25.0) / 100.0);

View File

@ -979,25 +979,6 @@ void InterruptDebugging(bool Emu, const void* _pData)
of the form seconds.milleseconds for example 1234.123. The leding seconds have no particular meaning
but are just there to enable use to tell if we have entered a new second or now. */
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
double GetDoubleTime()
{
#if defined(HAVE_WX) && HAVE_WX
wxDateTime datetime = wxDateTime::UNow(); // Get timestamp
u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970(); // Get continous timestamp
/* Remove a few years. We only really want enough seconds to make sure that we are
detecting actual actions, perhaps 60 seconds is enough really, but I leave a
year of seconds anyway, in case the user's clock is incorrect or something like that */
TmpSeconds = TmpSeconds - (38 * 365 * 24 * 60 * 60);
//if (TmpSeconds < 0) return 0; // Check the the user's clock is working somewhat
u32 Seconds = (u32)TmpSeconds; // Make a smaller integer that fits in the double
double ms = datetime.GetMillisecond() / 1000.0;
double TmpTime = Seconds + ms;
return TmpTime;
#endif
}
/* Calculate the current update frequency. Calculate the time between ten updates, and average
five such rates. If we assume there are 60 updates per second if the game is running at full
@ -1013,9 +994,9 @@ int GetUpdateRate()
if(g_UpdateTimeList.size() == 5) g_UpdateTimeList.erase(g_UpdateTimeList.begin() + 0);
// Calculate the time and save it
int Time = (int)(10 / (GetDoubleTime() - g_UpdateTime));
int Time = (int)(10 / (Common::Timer::GetDoubleTime() - g_UpdateTime));
g_UpdateTimeList.push_back(Time);
//INFO_LOG(CONSOLE, "Time: %i %f\n", Time, GetDoubleTime());
//INFO_LOG(CONSOLE, "Time: %i %f\n", Time, Common::Timer::GetDoubleTime());
int TotalTime = 0;
for (int i = 0; i < (int)g_UpdateTimeList.size(); i++)
@ -1023,7 +1004,7 @@ int GetUpdateRate()
g_UpdateRate = TotalTime / 5;
// Write the new update time
g_UpdateTime = GetDoubleTime();
g_UpdateTime = Common::Timer::GetDoubleTime();
g_UpdateCounter = 0;
}

View File

@ -31,7 +31,6 @@
#endif
// Definitions and declarations
void DoInitialize();
double GetDoubleTime();
int GetUpdateRate();
void InterruptDebugging(bool Emu, const void* _pData);
void ReadDebugging(bool Emu, const void* _pData, int Size);