2009-07-28 21:32:10 +00:00
|
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
2009-01-14 16:36:43 +00:00
|
|
|
|
// Windows
|
2009-01-04 21:53:41 +00:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
CFrame is the main parent window. Inside CFrame there is an m_Panel that is the parent for
|
|
|
|
|
the rendering window (when we render to the main window). In Windows the rendering window is
|
|
|
|
|
created by giving CreateWindow() m_Panel->GetHandle() as parent window and creating a new
|
|
|
|
|
child window to m_Panel. The new child window handle that is returned by CreateWindow() can
|
|
|
|
|
be accessed from Core::GetWindowHandle().
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
// includes
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
2009-06-20 11:05:52 +00:00
|
|
|
|
#include "Common.h" // Common
|
|
|
|
|
#include "FileUtil.h"
|
|
|
|
|
#include "Timer.h"
|
|
|
|
|
#include "Setup.h"
|
|
|
|
|
|
2008-12-23 08:47:37 +00:00
|
|
|
|
#include "Globals.h" // Local
|
2008-12-08 05:30:24 +00:00
|
|
|
|
#include "Frame.h"
|
2008-12-23 08:47:37 +00:00
|
|
|
|
#include "ConfigMain.h"
|
|
|
|
|
#include "PluginManager.h"
|
|
|
|
|
#include "MemcardManager.h"
|
|
|
|
|
#include "CheatsWindow.h"
|
|
|
|
|
#include "AboutDolphin.h"
|
2008-12-08 05:30:24 +00:00
|
|
|
|
#include "GameListCtrl.h"
|
|
|
|
|
#include "BootManager.h"
|
|
|
|
|
|
2009-01-17 23:41:21 +00:00
|
|
|
|
#include "ConfigManager.h" // Core
|
2008-12-08 05:30:24 +00:00
|
|
|
|
#include "Core.h"
|
2008-12-23 07:34:23 +00:00
|
|
|
|
#include "HW/DVDInterface.h"
|
2008-12-08 05:30:24 +00:00
|
|
|
|
#include "State.h"
|
2008-12-23 08:47:37 +00:00
|
|
|
|
#include "VolumeHandler.h"
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
#include <wx/datetime.h> // wxWidgets
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
// resources
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
2009-01-04 21:53:41 +00:00
|
|
|
|
#include "../resources/Dolphin.c" // Dolphin icon
|
2008-12-08 05:30:24 +00:00
|
|
|
|
#include "../resources/toolbar_browse.c"
|
|
|
|
|
#include "../resources/toolbar_file_open.c"
|
|
|
|
|
#include "../resources/toolbar_fullscreen.c"
|
|
|
|
|
#include "../resources/toolbar_help.c"
|
|
|
|
|
#include "../resources/toolbar_pause.c"
|
|
|
|
|
#include "../resources/toolbar_play.c"
|
|
|
|
|
#include "../resources/toolbar_plugin_dsp.c"
|
|
|
|
|
#include "../resources/toolbar_plugin_gfx.c"
|
|
|
|
|
#include "../resources/toolbar_plugin_options.c"
|
|
|
|
|
#include "../resources/toolbar_plugin_pad.c"
|
|
|
|
|
#include "../resources/toolbar_refresh.c"
|
|
|
|
|
#include "../resources/toolbar_stop.c"
|
2009-01-04 21:53:41 +00:00
|
|
|
|
#include "../resources/Boomy.h" // Theme packages
|
|
|
|
|
#include "../resources/Vista.h"
|
|
|
|
|
#include "../resources/X-Plastik.h"
|
|
|
|
|
#include "../resources/KDE.h"
|
2008-12-08 05:30:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
2008-12-23 04:35:21 +00:00
|
|
|
|
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2009-01-04 21:53:41 +00:00
|
|
|
|
/* 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 */
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-01-04 23:24:13 +00:00
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
// Declare a blank icon and one that will be the normal cursor
|
2009-01-04 21:53:41 +00:00
|
|
|
|
HCURSOR hCursor = NULL, hCursorBlank = NULL;
|
|
|
|
|
|
|
|
|
|
// Create the default cursor
|
|
|
|
|
void CreateCursor()
|
2008-12-08 05:30:24 +00:00
|
|
|
|
{
|
2009-01-04 21:53:41 +00:00
|
|
|
|
hCursor = LoadCursor( NULL, IDC_ARROW );
|
2008-12-08 05:30:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
void MSWSetCursor(bool Show)
|
|
|
|
|
{
|
|
|
|
|
if(Show)
|
|
|
|
|
SetCursor(hCursor);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SetCursor(hCursorBlank);
|
|
|
|
|
//wxSetCursor(wxCursor(wxNullCursor));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// I could not use FindItemByHWND() instead of this, it crashed on that occation I used it */
|
|
|
|
|
HWND MSWGetParent_(HWND Parent)
|
|
|
|
|
{
|
|
|
|
|
return GetParent(Parent);
|
|
|
|
|
}
|
2009-01-04 23:24:13 +00:00
|
|
|
|
#endif
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2009-01-04 21:53:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2009-01-04 21:53:41 +00:00
|
|
|
|
/* The CPanel class to receive MSWWindowProc messages from the video plugin. */
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
extern CFrame* main_frame;
|
|
|
|
|
|
|
|
|
|
class CPanel : public wxPanel
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CPanel(
|
|
|
|
|
wxWindow* parent,
|
|
|
|
|
wxWindowID id = wxID_ANY
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
DECLARE_EVENT_TABLE();
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
// Receive WndProc messages
|
|
|
|
|
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CPanel, wxPanel)
|
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
CPanel::CPanel(
|
|
|
|
|
wxWindow *parent,
|
|
|
|
|
wxWindowID id
|
|
|
|
|
)
|
|
|
|
|
: wxPanel(parent, id)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
int abc = 0;
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
WXLRESULT CPanel::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
switch (nMsg)
|
|
|
|
|
{
|
|
|
|
|
//case WM_LBUTTONDOWN:
|
|
|
|
|
//case WM_LBUTTONUP:
|
|
|
|
|
//case WM_MOUSEMOVE:
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
|
|
// This doesn't work, strange
|
|
|
|
|
//case WM_LBUTTONDBLCLK:
|
|
|
|
|
//PanicAlert("Double click");
|
|
|
|
|
//break;
|
|
|
|
|
|
|
|
|
|
case WM_USER:
|
|
|
|
|
switch(wParam)
|
|
|
|
|
{
|
|
|
|
|
// Stop
|
2009-02-07 03:16:41 +00:00
|
|
|
|
case OPENGL_WM_USER_STOP:
|
2009-01-04 21:53:41 +00:00
|
|
|
|
main_frame->DoStop();
|
|
|
|
|
return 0; // Don't bother letting wxWidgets process this at all
|
|
|
|
|
|
2009-02-07 03:16:41 +00:00
|
|
|
|
case OPENGL_WM_USER_CREATE:
|
2009-01-04 21:53:41 +00:00
|
|
|
|
// We don't have a local setting for bRenderToMain but we can detect it this way instead
|
|
|
|
|
//PanicAlert("main call %i %i %i %i", lParam, (HWND)Core::GetWindowHandle(), MSWGetParent_((HWND)Core::GetWindowHandle()), (HWND)this->GetHWND());
|
2009-04-28 23:47:18 +00:00
|
|
|
|
if (lParam == NULL)
|
|
|
|
|
main_frame->bRenderToMain = false;
|
|
|
|
|
else
|
|
|
|
|
main_frame->bRenderToMain = true;
|
2009-01-04 21:53:41 +00:00
|
|
|
|
return 0;
|
2009-02-07 03:16:41 +00:00
|
|
|
|
|
|
|
|
|
case NJOY_RELOAD:
|
|
|
|
|
// DirectInput in nJoy has failed
|
2009-02-11 10:30:02 +00:00
|
|
|
|
Core::ReconnectPad();
|
2009-02-07 03:16:41 +00:00
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
case WIIMOTE_RECONNECT:
|
|
|
|
|
// The Wiimote plugin has been shut down, now reconnect the Wiimote
|
2009-03-18 17:17:58 +00:00
|
|
|
|
//INFO_LOG(CONSOLE, "WIIMOTE_RECONNECT\n");
|
2009-02-07 03:16:41 +00:00
|
|
|
|
Core::ReconnectWiimote();
|
|
|
|
|
return 0;
|
2009-02-16 07:17:34 +00:00
|
|
|
|
|
2009-02-22 21:16:12 +00:00
|
|
|
|
// -----------------------------------------
|
2009-02-16 07:17:34 +00:00
|
|
|
|
#ifdef RERECORDING
|
2009-02-22 21:16:12 +00:00
|
|
|
|
// -----------------
|
|
|
|
|
case INPUT_FRAME_COUNTER:
|
|
|
|
|
// Wind back the frame counter after a save state has been loaded
|
|
|
|
|
Core::WindBack((int)lParam);
|
|
|
|
|
return 0;
|
2009-02-16 07:17:34 +00:00
|
|
|
|
#endif
|
2009-02-22 21:16:12 +00:00
|
|
|
|
// -----------------------------
|
2009-01-04 21:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2009-02-22 21:16:12 +00:00
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
//default:
|
|
|
|
|
// return wxPanel::MSWWindowProc(nMsg, wParam, lParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// By default let wxWidgets do what it normally does with this event
|
|
|
|
|
return wxPanel::MSWWindowProc(nMsg, wParam, lParam);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
|
|
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2008-12-08 05:30:24 +00:00
|
|
|
|
// event tables
|
2009-06-20 11:05:52 +00:00
|
|
|
|
// ----------------------------
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
|
|
// Notice that wxID_HELP will be processed for the 'About' menu and the toolbar
|
|
|
|
|
// help button.
|
|
|
|
|
|
|
|
|
|
const wxEventType wxEVT_HOST_COMMAND = wxNewEventType();
|
|
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CFrame, wxFrame)
|
|
|
|
|
EVT_CLOSE(CFrame::OnClose)
|
|
|
|
|
EVT_MENU(wxID_OPEN, CFrame::OnOpen)
|
|
|
|
|
EVT_MENU(wxID_EXIT, CFrame::OnQuit)
|
|
|
|
|
EVT_MENU(IDM_HELPWEBSITE, CFrame::OnHelp)
|
|
|
|
|
EVT_MENU(IDM_HELPGOOGLECODE, CFrame::OnHelp)
|
|
|
|
|
EVT_MENU(IDM_HELPABOUT, CFrame::OnHelp)
|
|
|
|
|
EVT_MENU(wxID_REFRESH, CFrame::OnRefresh)
|
|
|
|
|
EVT_MENU(IDM_PLAY, CFrame::OnPlay)
|
2009-08-21 09:26:34 +00:00
|
|
|
|
EVT_MENU(IDM_RECORD, CFrame::OnRecord)
|
2009-08-21 19:55:03 +00:00
|
|
|
|
EVT_MENU(IDM_PLAYRECORD, CFrame::OnPlayRecording)
|
2008-12-08 05:30:24 +00:00
|
|
|
|
EVT_MENU(IDM_STOP, CFrame::OnStop)
|
2009-08-22 02:05:02 +00:00
|
|
|
|
EVT_MENU(IDM_FRAMESTEP, CFrame::OnFrameStep)
|
2009-02-27 03:56:34 +00:00
|
|
|
|
EVT_MENU(IDM_SCREENSHOT, CFrame::OnScreenshot)
|
2008-12-08 05:30:24 +00:00
|
|
|
|
EVT_MENU(IDM_CONFIG_MAIN, CFrame::OnConfigMain)
|
|
|
|
|
EVT_MENU(IDM_CONFIG_GFX_PLUGIN, CFrame::OnPluginGFX)
|
|
|
|
|
EVT_MENU(IDM_CONFIG_DSP_PLUGIN, CFrame::OnPluginDSP)
|
|
|
|
|
EVT_MENU(IDM_CONFIG_PAD_PLUGIN, CFrame::OnPluginPAD)
|
|
|
|
|
EVT_MENU(IDM_CONFIG_WIIMOTE_PLUGIN, CFrame::OnPluginWiimote)
|
2009-01-03 01:38:44 +00:00
|
|
|
|
|
2009-08-30 19:44:42 +00:00
|
|
|
|
EVT_AUITOOLBAR_TOOL_DROPDOWN(IDM_SAVE_PERSPECTIVE, CFrame::OnDropDownToolbarItem)
|
|
|
|
|
EVT_MENU(IDM_SAVE_PERSPECTIVE, CFrame::OnToolBar)
|
|
|
|
|
EVT_MENU(IDM_ADD_PERSPECTIVE, CFrame::OnCreatePerspective)
|
|
|
|
|
EVT_MENU(IDM_PERSPECTIVES_ADD_PANE, CFrame::OnToolBar)
|
|
|
|
|
EVT_MENU(IDM_EDIT_PERSPECTIVES, CFrame::OnToolBar)
|
2009-08-27 17:17:48 +00:00
|
|
|
|
EVT_MENU(IDM_TAB_SPLIT, CFrame::OnToolBar)
|
2009-08-30 19:44:42 +00:00
|
|
|
|
EVT_MENU_RANGE(IDM_PERSPECTIVES_0, IDM_PERSPECTIVES_100, CFrame::OnSelectPerspective)
|
2009-08-27 07:33:07 +00:00
|
|
|
|
|
2009-07-02 01:49:28 +00:00
|
|
|
|
#if defined(HAVE_SFML) && HAVE_SFML
|
2009-05-13 21:50:24 +00:00
|
|
|
|
EVT_MENU(IDM_NETPLAY, CFrame::OnNetPlay)
|
2009-07-02 01:49:28 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
|
EVT_MENU(IDM_BROWSE, CFrame::OnBrowse)
|
|
|
|
|
EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard)
|
|
|
|
|
EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow)
|
2009-04-24 18:04:50 +00:00
|
|
|
|
EVT_MENU(IDM_INFO, CFrame::OnShow_InfoWindow)
|
2008-12-23 08:47:37 +00:00
|
|
|
|
EVT_MENU(IDM_CHANGEDISC, CFrame::OnChangeDisc)
|
2009-02-27 23:44:15 +00:00
|
|
|
|
EVT_MENU(IDM_LOAD_WII_MENU, CFrame::OnLoadWiiMenu)
|
2008-12-08 05:30:24 +00:00
|
|
|
|
EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen)
|
|
|
|
|
EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore)
|
|
|
|
|
EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle)
|
|
|
|
|
EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar)
|
|
|
|
|
EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar)
|
2009-08-27 10:10:07 +00:00
|
|
|
|
EVT_MENU(IDM_LOGWINDOW, CFrame::OnToggleLogWindow)
|
2009-08-27 19:38:35 +00:00
|
|
|
|
EVT_MENU(IDM_CONSOLEWINDOW, CFrame::OnToggleConsole)
|
2009-02-27 23:44:15 +00:00
|
|
|
|
|
2009-04-28 02:30:50 +00:00
|
|
|
|
EVT_MENU(IDM_LISTDRIVES, CFrame::GameListChanged)
|
2009-06-06 07:36:22 +00:00
|
|
|
|
EVT_MENU(IDM_LISTWII, CFrame::GameListChanged)
|
|
|
|
|
EVT_MENU(IDM_LISTGC, CFrame::GameListChanged)
|
2009-06-07 02:27:36 +00:00
|
|
|
|
EVT_MENU(IDM_LISTWAD, CFrame::GameListChanged)
|
2009-06-06 07:36:22 +00:00
|
|
|
|
EVT_MENU(IDM_LISTJAP, CFrame::GameListChanged)
|
|
|
|
|
EVT_MENU(IDM_LISTPAL, CFrame::GameListChanged)
|
|
|
|
|
EVT_MENU(IDM_LISTUSA, CFrame::GameListChanged)
|
|
|
|
|
EVT_MENU(IDM_PURGECACHE, CFrame::GameListChanged)
|
2009-04-28 02:30:50 +00:00
|
|
|
|
|
2009-06-28 01:11:35 +00:00
|
|
|
|
EVT_MENU(IDM_LOADLASTSTATE, CFrame::OnLoadLastState)
|
2009-06-28 21:11:51 +00:00
|
|
|
|
EVT_MENU(IDM_UNDOLOADSTATE, CFrame::OnUndoLoadState)
|
|
|
|
|
EVT_MENU(IDM_UNDOSAVESTATE, CFrame::OnUndoSaveState)
|
2009-06-28 01:11:35 +00:00
|
|
|
|
EVT_MENU(IDM_LOADSTATEFILE, CFrame::OnLoadStateFromFile)
|
|
|
|
|
EVT_MENU(IDM_SAVESTATEFILE, CFrame::OnSaveStateToFile)
|
|
|
|
|
|
2009-06-28 19:47:02 +00:00
|
|
|
|
EVT_MENU_RANGE(IDM_LOADSLOT1, IDM_LOADSLOT8, CFrame::OnLoadState)
|
|
|
|
|
EVT_MENU_RANGE(IDM_SAVESLOT1, IDM_SAVESLOT8, CFrame::OnSaveState)
|
2009-08-08 01:39:56 +00:00
|
|
|
|
EVT_MENU_RANGE(IDM_FRAMESKIP0, IDM_FRAMESKIP9, CFrame::OnFrameSkip)
|
2009-02-21 23:44:40 +00:00
|
|
|
|
EVT_MENU_RANGE(IDM_DRIVE1, IDM_DRIVE24, CFrame::OnBootDrive)
|
2009-01-04 21:53:41 +00:00
|
|
|
|
|
2008-12-12 03:38:50 +00:00
|
|
|
|
EVT_SIZE(CFrame::OnResize)
|
2009-01-28 16:51:05 +00:00
|
|
|
|
EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, CFrame::OnGameListCtrl_ItemActivated)
|
2008-12-08 05:30:24 +00:00
|
|
|
|
EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage)
|
2009-01-04 21:53:41 +00:00
|
|
|
|
#if wxUSE_TIMER
|
|
|
|
|
EVT_TIMER(wxID_ANY, CFrame::OnTimer)
|
|
|
|
|
#endif
|
2009-08-25 01:50:27 +00:00
|
|
|
|
|
|
|
|
|
// Debugger Menu Entries
|
|
|
|
|
EVT_MENU(wxID_ANY, CFrame::PostEvent)
|
2009-08-25 10:58:13 +00:00
|
|
|
|
EVT_TEXT(wxID_ANY, CFrame::PostEvent)
|
|
|
|
|
|
2009-08-25 01:50:27 +00:00
|
|
|
|
//EVT_MENU_HIGHLIGHT_ALL(CFrame::PostMenuEvent)
|
|
|
|
|
//EVT_UPDATE_UI(wxID_ANY, CFrame::PostUpdateUIEvent)
|
|
|
|
|
|
2009-08-30 19:44:42 +00:00
|
|
|
|
EVT_AUI_PANE_CLOSE(CFrame::OnPaneClose)
|
2009-08-26 09:19:15 +00:00
|
|
|
|
EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, CFrame::OnNotebookPageClose)
|
2009-08-26 15:23:48 +00:00
|
|
|
|
EVT_AUINOTEBOOK_ALLOW_DND(wxID_ANY, CFrame::OnAllowNotebookDnD)
|
2009-08-27 15:53:19 +00:00
|
|
|
|
EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, CFrame::OnNotebookPageChanged)
|
2009-08-26 09:19:15 +00:00
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
|
END_EVENT_TABLE()
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2009-01-05 04:08:18 +00:00
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2009-01-05 04:08:18 +00:00
|
|
|
|
// Creation and close, quit functions
|
2009-08-27 11:08:52 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-03-18 17:17:58 +00:00
|
|
|
|
CFrame::CFrame(bool showLogWindow,
|
|
|
|
|
wxFrame* parent,
|
2008-12-08 05:30:24 +00:00
|
|
|
|
wxWindowID id,
|
|
|
|
|
const wxString& title,
|
|
|
|
|
const wxPoint& pos,
|
|
|
|
|
const wxSize& size,
|
2009-08-25 01:50:27 +00:00
|
|
|
|
bool _UseDebugger,
|
2008-12-08 05:30:24 +00:00
|
|
|
|
long style)
|
|
|
|
|
: wxFrame(parent, id, title, pos, size, style)
|
2009-08-27 10:10:07 +00:00
|
|
|
|
, UseDebugger(_UseDebugger), m_LogWindow(NULL)
|
2009-06-28 20:38:01 +00:00
|
|
|
|
, m_pStatusBar(NULL), bRenderToMain(true), HaveLeds(false)
|
2009-08-27 07:33:07 +00:00
|
|
|
|
, HaveSpeakers(false), m_Panel(NULL), m_ToolBar(NULL), m_ToolBarDebug(NULL)
|
2009-03-18 17:17:58 +00:00
|
|
|
|
, m_bLogWindow(showLogWindow || SConfig::GetInstance().m_InterfaceLogWindow)
|
2009-01-04 21:53:41 +00:00
|
|
|
|
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
|
|
|
|
|
#if wxUSE_TIMER
|
|
|
|
|
, m_timer(this)
|
|
|
|
|
#endif
|
2008-12-10 18:33:13 +00:00
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
|
{
|
2009-08-27 15:53:19 +00:00
|
|
|
|
// Give it a console
|
|
|
|
|
ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener();
|
|
|
|
|
if (SConfig::GetInstance().m_InterfaceConsole) Console->Open();
|
|
|
|
|
|
2009-08-25 06:34:58 +00:00
|
|
|
|
// Start debugging mazimized
|
2009-08-27 15:53:19 +00:00
|
|
|
|
if (UseDebugger) this->Maximize(true);
|
2009-08-25 01:50:27 +00:00
|
|
|
|
// Debugger class
|
|
|
|
|
if (UseDebugger)
|
2009-08-30 19:44:42 +00:00
|
|
|
|
{
|
2009-08-27 10:10:07 +00:00
|
|
|
|
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, this);
|
2009-08-30 19:44:42 +00:00
|
|
|
|
g_pCodeWindow->Hide();
|
2009-08-30 22:04:30 +00:00
|
|
|
|
g_pCodeWindow->Load();
|
2009-08-30 19:44:42 +00:00
|
|
|
|
}
|
2009-08-25 01:50:27 +00:00
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
// Create timer
|
|
|
|
|
#if wxUSE_TIMER
|
|
|
|
|
int TimesPerSecond = 10; // We don't need more than this
|
|
|
|
|
m_timer.Start( floor((double)(1000 / TimesPerSecond)) );
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-08-27 10:10:07 +00:00
|
|
|
|
// Create toolbar bitmaps
|
2008-12-08 05:30:24 +00:00
|
|
|
|
InitBitmaps();
|
|
|
|
|
|
|
|
|
|
// Give it an icon
|
|
|
|
|
wxIcon IconTemp;
|
2009-05-27 21:24:29 +00:00
|
|
|
|
IconTemp.CopyFromBitmap(wxGetBitmapFromMemory(dolphin_ico32x32));
|
2008-12-08 05:30:24 +00:00
|
|
|
|
SetIcon(IconTemp);
|
|
|
|
|
|
2008-12-09 14:57:55 +00:00
|
|
|
|
// Give it a status bar
|
2009-01-18 11:43:10 +00:00
|
|
|
|
m_pStatusBar = CreateStatusBar(1, wxST_SIZEGRIP, ID_STATUSBAR);
|
2009-03-18 17:17:58 +00:00
|
|
|
|
if (!SConfig::GetInstance().m_InterfaceStatusbar)
|
|
|
|
|
m_pStatusBar->Hide();
|
2008-12-09 05:37:15 +00:00
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
// Give it a menu bar
|
2008-12-08 05:30:24 +00:00
|
|
|
|
CreateMenu();
|
|
|
|
|
|
2009-08-26 09:19:15 +00:00
|
|
|
|
// -------------------------------------------------------------------------
|
2009-08-30 19:44:42 +00:00
|
|
|
|
// Main panel
|
2009-08-26 09:19:15 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-08-27 11:08:52 +00:00
|
|
|
|
// This panel is the parent for rendering and it holds the gamelistctrl
|
2009-01-04 21:53:41 +00:00
|
|
|
|
m_Panel = new CPanel(this, IDM_MPANEL);
|
2009-03-18 17:17:58 +00:00
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
|
m_GameListCtrl = new CGameListCtrl(m_Panel, LIST_CTRL,
|
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
|
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT);
|
|
|
|
|
|
|
|
|
|
sizerPanel = new wxBoxSizer(wxHORIZONTAL);
|
2009-03-07 05:32:16 +00:00
|
|
|
|
sizerPanel->Add(m_GameListCtrl, 1, wxEXPAND | wxALL);
|
2008-12-08 05:30:24 +00:00
|
|
|
|
m_Panel->SetSizer(sizerPanel);
|
2009-08-30 19:44:42 +00:00
|
|
|
|
// -------------------------------------------------------------------------
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
2009-08-25 01:50:27 +00:00
|
|
|
|
m_Mgr = new wxAuiManager();
|
|
|
|
|
m_Mgr->SetManagedWindow(this);
|
|
|
|
|
|
2009-08-27 10:10:07 +00:00
|
|
|
|
|
2009-08-30 19:44:42 +00:00
|
|
|
|
DefaultNBStyle = wxAUI_NB_TOP | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
|
|
|
|
|
wxBitmap aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
|
2009-08-27 07:33:07 +00:00
|
|
|
|
|
2009-08-30 19:44:42 +00:00
|
|
|
|
if (UseDebugger)
|
|
|
|
|
{
|
|
|
|
|
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane 0")).Caption(wxT("Pane 0")).Show());
|
2009-08-25 01:50:27 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2009-08-30 19:44:42 +00:00
|
|
|
|
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane 0")).Caption(wxT("Pane 0")).Hide());
|
2009-08-30 22:04:30 +00:00
|
|
|
|
m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo().Name(wxT("Pane 1")).Caption(wxT("Pane 1")).Hide());
|
2009-08-25 01:50:27 +00:00
|
|
|
|
}
|
2009-08-25 07:05:53 +00:00
|
|
|
|
|
2009-08-27 10:46:43 +00:00
|
|
|
|
// Setup perspectives
|
2009-08-27 07:33:07 +00:00
|
|
|
|
if (UseDebugger)
|
2009-08-27 10:46:43 +00:00
|
|
|
|
{
|
2009-08-30 22:04:30 +00:00
|
|
|
|
m_Mgr->GetPane(wxT("Pane 0")).CenterPane().PaneBorder(false);
|
2009-08-27 07:33:07 +00:00
|
|
|
|
AuiFullscreen = m_Mgr->SavePerspective();
|
2009-08-30 22:04:30 +00:00
|
|
|
|
m_Mgr->GetPane(wxT("Pane 0")).CenterPane().PaneBorder(true);
|
2009-08-27 10:46:43 +00:00
|
|
|
|
}
|
2009-08-27 15:54:30 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2009-08-30 19:44:42 +00:00
|
|
|
|
m_Mgr->GetPane(wxT("Pane 0")).Show().PaneBorder(false).CaptionVisible(false).Layer(0).Center();
|
2009-08-27 15:54:30 +00:00
|
|
|
|
AuiFullscreen = m_Mgr->SavePerspective();
|
|
|
|
|
}
|
2009-08-27 07:33:07 +00:00
|
|
|
|
|
2009-08-27 10:46:43 +00:00
|
|
|
|
// Create toolbar
|
|
|
|
|
RecreateToolbar();
|
|
|
|
|
if (!SConfig::GetInstance().m_InterfaceToolbar) DoToggleToolbar(false);
|
|
|
|
|
|
|
|
|
|
// Setup perspectives
|
|
|
|
|
if (UseDebugger)
|
2009-08-30 19:44:42 +00:00
|
|
|
|
{
|
2009-08-27 07:33:07 +00:00
|
|
|
|
// Load perspective
|
2009-08-30 19:44:42 +00:00
|
|
|
|
std::vector<std::string> VPerspectives;
|
|
|
|
|
std::string _Perspectives;
|
|
|
|
|
|
2009-08-27 07:33:07 +00:00
|
|
|
|
IniFile ini;
|
|
|
|
|
ini.Load(DEBUGGER_CONFIG_FILE);
|
2009-08-30 19:44:42 +00:00
|
|
|
|
ini.Get("Perspectives", "Perspectives", &_Perspectives, "");
|
|
|
|
|
ini.Get("Perspectives", "Active", &ActivePerspective, 0);
|
|
|
|
|
SplitString(_Perspectives, ",", VPerspectives);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
for (int i = 0; i < VPerspectives.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
SPerspectives Tmp;
|
|
|
|
|
std::string _Section, _Perspective, _Width, _Height;
|
|
|
|
|
std::vector<std::string> _SWidth, _SHeight;
|
|
|
|
|
Tmp.Name = VPerspectives.at(i);
|
|
|
|
|
_Section = StringFromFormat("P - %s", Tmp.Name.c_str());
|
|
|
|
|
if (!ini.Exists(_Section.c_str(), "Width")) continue;
|
|
|
|
|
|
|
|
|
|
ini.Get(_Section.c_str(), "Perspective", &_Perspective, "");
|
|
|
|
|
ini.Get(_Section.c_str(), "Width", &_Width, "");
|
|
|
|
|
ini.Get(_Section.c_str(), "Height", &_Height, "");
|
|
|
|
|
|
|
|
|
|
Tmp.Perspective = wxString::FromAscii(_Perspective.c_str());
|
|
|
|
|
|
|
|
|
|
SplitString(_Width, ",", _SWidth);
|
|
|
|
|
SplitString(_Height, ",", _SHeight);
|
|
|
|
|
for (int i = 0; i < _SWidth.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
int _Tmp;
|
|
|
|
|
if (TryParseInt(_SWidth.at(0).c_str(), &_Tmp)) Tmp.Width.push_back(_Tmp);
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < _SHeight.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
int _Tmp;
|
|
|
|
|
if (TryParseInt(_SHeight.at(0).c_str(), &_Tmp)) Tmp.Height.push_back(_Tmp);
|
|
|
|
|
}
|
|
|
|
|
Perspectives.push_back(Tmp);
|
|
|
|
|
|
|
|
|
|
//Console->Log(LogTypes::LCUSTOM, StringFromFormat("Read: %s %s\n", _Width.c_str(), _Height.c_str()).c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Perspectives.size() > 0)
|
|
|
|
|
{
|
|
|
|
|
// Create new panes with notebooks
|
|
|
|
|
for (int j = 0; j < Perspectives.at(0).Width.size() - 1; j++)
|
|
|
|
|
{
|
2009-08-30 22:04:30 +00:00
|
|
|
|
m_Mgr->AddPane(new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle));
|
2009-08-30 19:44:42 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
NamePanes();
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> FormatNames;
|
|
|
|
|
SplitString(StringFromFormat("%s", Perspectives.at(0).Perspective.mb_str()), "|", FormatNames);
|
|
|
|
|
//Console->Log(LogTypes::LCUSTOM, StringFromFormat("Perspective: %s\n", Perspectives.at(0).Perspective.mb_str()).c_str());
|
|
|
|
|
for (int i = 0; i < FormatNames.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
Console->Log(LogTypes::LCUSTOM, StringFromFormat("Perspective: %s\n", FormatNames.at(i).c_str()).c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ActivePerspective >= Perspectives.size()) ActivePerspective = 0;
|
|
|
|
|
DoLoadPerspective(Perspectives.at(ActivePerspective).Perspective);
|
|
|
|
|
}
|
|
|
|
|
// Create one pane by default
|
|
|
|
|
else
|
|
|
|
|
{
|
2009-08-30 22:04:30 +00:00
|
|
|
|
m_Mgr->AddPane(new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle));
|
2009-08-30 19:44:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Console->Log(LogTypes::LCUSTOM, StringFromFormat("Panes: %i\n", m_Mgr->GetAllPanes().GetCount()).c_str());
|
2009-08-27 07:33:07 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2009-08-30 22:04:30 +00:00
|
|
|
|
m_Mgr->GetPane(wxT("Pane 1")).Hide().PaneBorder(false).CaptionVisible(false).Layer(0).Right();
|
|
|
|
|
//if (m_bLogWindow || SConfig::GetInstance().m_InterfaceConsole) m_Mgr->GetPane(wxT("Pane 1")).Show();
|
2009-08-27 07:33:07 +00:00
|
|
|
|
}
|
2009-08-27 10:21:51 +00:00
|
|
|
|
|
2009-08-27 19:38:35 +00:00
|
|
|
|
// Show window
|
2009-08-25 06:34:58 +00:00
|
|
|
|
Show();
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
2009-02-08 10:09:26 +00:00
|
|
|
|
// Create list of available plugins for the configuration window
|
2009-01-09 12:46:04 +00:00
|
|
|
|
CPluginManager::GetInstance().ScanForPlugins();
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
2009-08-30 19:44:42 +00:00
|
|
|
|
// Load GUI settings
|
|
|
|
|
if (UseDebugger) g_pCodeWindow->Load();
|
2009-08-27 01:30:08 +00:00
|
|
|
|
// Open notebook pages
|
2009-08-30 19:44:42 +00:00
|
|
|
|
if (UseDebugger) AddRemoveBlankPage();
|
2009-08-27 01:30:08 +00:00
|
|
|
|
if (UseDebugger) g_pCodeWindow->OpenPages();
|
2009-08-30 10:01:45 +00:00
|
|
|
|
if (m_bLogWindow) DoToggleWindow(IDM_LOGWINDOW, true);
|
|
|
|
|
if (SConfig::GetInstance().m_InterfaceConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true);
|
2009-08-27 10:10:07 +00:00
|
|
|
|
if (!UseDebugger) SetSimplePaneSize();
|
|
|
|
|
|
2009-01-15 06:48:15 +00:00
|
|
|
|
//if we are ever going back to optional iso caching:
|
2008-12-08 05:30:24 +00:00
|
|
|
|
//m_GameListCtrl->Update(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache);
|
|
|
|
|
m_GameListCtrl->Update();
|
|
|
|
|
//sizerPanel->SetSizeHints(m_Panel);
|
|
|
|
|
|
2009-08-25 01:50:27 +00:00
|
|
|
|
// Commit
|
|
|
|
|
m_Mgr->Update();
|
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
// Create cursors
|
2009-01-04 23:24:13 +00:00
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
CreateCursor();
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
// -------------------------
|
|
|
|
|
// Connect event handlers
|
|
|
|
|
// ----------
|
|
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
|
|
|
|
|
wxKeyEventHandler(CFrame::OnKeyDown),
|
|
|
|
|
(wxObject*)0, this);
|
2008-12-28 18:50:24 +00:00
|
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_UP,
|
|
|
|
|
wxKeyEventHandler(CFrame::OnKeyUp),
|
|
|
|
|
(wxObject*)0, this);
|
|
|
|
|
|
2009-08-29 06:08:14 +00:00
|
|
|
|
m_Mgr->Connect(wxID_ANY, wxEVT_AUI_RENDER, // Resize
|
|
|
|
|
wxAuiManagerEventHandler(CFrame::OnManagerResize),
|
|
|
|
|
(wxObject*)0, this);
|
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
#ifdef _WIN32 // The functions are only tested in Windows so far
|
2009-08-27 10:46:43 +00:00
|
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_LEFT_DOWN,
|
2009-01-04 21:53:41 +00:00
|
|
|
|
wxMouseEventHandler(CFrame::OnDoubleClick),
|
|
|
|
|
(wxObject*)0, this);
|
|
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_MOTION,
|
|
|
|
|
wxMouseEventHandler(CFrame::OnMotion),
|
|
|
|
|
(wxObject*)0, this);
|
|
|
|
|
#endif
|
|
|
|
|
// ----------
|
2009-01-15 06:48:15 +00:00
|
|
|
|
|
2009-08-25 06:34:58 +00:00
|
|
|
|
// Update controls
|
2008-12-08 05:30:24 +00:00
|
|
|
|
UpdateGUI();
|
2009-02-16 06:18:18 +00:00
|
|
|
|
|
|
|
|
|
// If we are rerecording create the status bar now instead of later when a game starts
|
|
|
|
|
#ifdef RERECORDING
|
|
|
|
|
ModifyStatusBar();
|
|
|
|
|
// It's to early for the OnHostMessage(), we will update the status when Ctrl or Space is pressed
|
|
|
|
|
//Core::WriteStatus();
|
|
|
|
|
#endif
|
2008-12-08 05:30:24 +00:00
|
|
|
|
}
|
2009-01-04 21:53:41 +00:00
|
|
|
|
// Destructor
|
|
|
|
|
CFrame::~CFrame()
|
2008-12-08 05:30:24 +00:00
|
|
|
|
{
|
2009-02-24 15:04:12 +00:00
|
|
|
|
cdio_free_device_list(drives);
|
2009-08-27 10:46:43 +00:00
|
|
|
|
/* The statbar sample has this so I add this to, but I guess timer will be deleted after
|
|
|
|
|
this anyway */
|
|
|
|
|
#if wxUSE_TIMER
|
|
|
|
|
if (m_timer.IsRunning()) m_timer.Stop();
|
|
|
|
|
#endif
|
2008-12-08 05:30:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-01-05 04:08:18 +00:00
|
|
|
|
void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event))
|
|
|
|
|
{
|
|
|
|
|
Close(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CFrame::OnClose(wxCloseEvent& event)
|
|
|
|
|
{
|
2009-04-15 20:19:25 +00:00
|
|
|
|
// Don't forget the skip or the window won't be destroyed
|
2009-01-05 04:08:18 +00:00
|
|
|
|
event.Skip();
|
2009-08-27 01:30:08 +00:00
|
|
|
|
// Save GUI settings
|
|
|
|
|
if (UseDebugger) g_pCodeWindow->Save();
|
2009-08-27 07:33:07 +00:00
|
|
|
|
if (UseDebugger) Save();
|
2009-01-05 04:08:18 +00:00
|
|
|
|
|
|
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
|
|
|
{
|
|
|
|
|
Core::Stop();
|
|
|
|
|
UpdateGUI();
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-08-26 09:19:15 +00:00
|
|
|
|
|
2009-08-30 10:01:45 +00:00
|
|
|
|
wxPanel* CFrame::CreateEmptyPanel()
|
|
|
|
|
{
|
|
|
|
|
wxPanel* Panel = new wxPanel(this, wxID_ANY);
|
|
|
|
|
return Panel;
|
|
|
|
|
}
|
2009-08-30 22:04:30 +00:00
|
|
|
|
wxAuiNotebook* CFrame::CreateEmptyNotebook()
|
|
|
|
|
{
|
|
|
|
|
wxAuiNotebook* NB = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle);
|
|
|
|
|
return NB;
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-30 10:01:45 +00:00
|
|
|
|
|
2009-08-25 06:34:58 +00:00
|
|
|
|
void CFrame::DoFullscreen(bool _F)
|
|
|
|
|
{
|
|
|
|
|
ShowFullScreen(_F);
|
|
|
|
|
if (_F)
|
2009-08-25 07:49:23 +00:00
|
|
|
|
{
|
|
|
|
|
// Save the current mode before going to fullscreen
|
|
|
|
|
AuiCurrent = m_Mgr->SavePerspective();
|
2009-08-25 07:05:53 +00:00
|
|
|
|
m_Mgr->LoadPerspective(AuiFullscreen, true);
|
2009-08-25 07:49:23 +00:00
|
|
|
|
}
|
2009-08-25 06:34:58 +00:00
|
|
|
|
else
|
2009-08-25 07:49:23 +00:00
|
|
|
|
{
|
|
|
|
|
// Restore saved perspective
|
|
|
|
|
m_Mgr->LoadPerspective(AuiCurrent, true);
|
|
|
|
|
}
|
2009-08-25 06:34:58 +00:00
|
|
|
|
}
|
2009-08-27 10:10:07 +00:00
|
|
|
|
void CFrame::SetSimplePaneSize()
|
2009-08-27 07:33:07 +00:00
|
|
|
|
{
|
2009-08-27 10:10:07 +00:00
|
|
|
|
wxArrayInt i, j;
|
|
|
|
|
i.Add(0); j.Add(50);
|
|
|
|
|
i.Add(1); j.Add(50);
|
|
|
|
|
SetPaneSize(i, j);
|
|
|
|
|
}
|
|
|
|
|
void CFrame::SetPaneSize(wxArrayInt Pane, wxArrayInt Size)
|
|
|
|
|
{
|
|
|
|
|
int iClientSize = this->GetSize().GetX();
|
2009-08-27 07:33:07 +00:00
|
|
|
|
|
2009-08-27 10:10:07 +00:00
|
|
|
|
for (int i = 0; i < Pane.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
// Check limits
|
|
|
|
|
if (Size[i] > 95) Size[i] = 95; if (Size[i] < 5) Size[i] = 5;
|
|
|
|
|
// Produce pixel width from percentage width
|
|
|
|
|
Size[i] = iClientSize * (float)(Size[i]/100.0);
|
|
|
|
|
// Update size
|
2009-08-30 22:04:30 +00:00
|
|
|
|
m_Mgr->GetPane(wxString::Format(wxT("Pane %i"), Pane[i])).BestSize(Size[i], -1).MinSize(Size[i], -1).MaxSize(Size[i], -1);
|
2009-08-27 10:10:07 +00:00
|
|
|
|
}
|
|
|
|
|
m_Mgr->Update();
|
|
|
|
|
for (int i = 0; i < Pane.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
// Remove the size limits
|
2009-08-30 22:04:30 +00:00
|
|
|
|
m_Mgr->GetPane(wxString::Format(wxT("Pane %i"), Pane[i])).MinSize(-1, -1).MaxSize(-1, -1);
|
2009-08-27 10:10:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2009-08-30 19:44:42 +00:00
|
|
|
|
void CFrame::DoLoadPerspective(wxString Perspective)
|
|
|
|
|
{
|
|
|
|
|
m_Mgr->LoadPerspective(Perspective, true);
|
2009-08-27 07:33:07 +00:00
|
|
|
|
|
2009-08-30 19:44:42 +00:00
|
|
|
|
/*
|
2009-08-27 10:10:07 +00:00
|
|
|
|
m_Mgr->LoadPerspective(AuiPerspective[Perspective], true);
|
2009-08-27 07:33:07 +00:00
|
|
|
|
|
2009-08-27 10:10:07 +00:00
|
|
|
|
int _iRightWidth, iClientSize = this->GetSize().GetX();
|
|
|
|
|
wxArrayInt i, j;
|
2009-08-27 07:33:07 +00:00
|
|
|
|
|
|
|
|
|
// Set the size
|
2009-08-27 10:10:07 +00:00
|
|
|
|
if (Perspective == 0)
|
2009-08-27 07:33:07 +00:00
|
|
|
|
{
|
2009-08-27 10:10:07 +00:00
|
|
|
|
_iRightWidth = 100 - iLeftWidth[0];
|
|
|
|
|
i.Add(0); j.Add(iLeftWidth[0]);
|
|
|
|
|
i.Add(2); j.Add(_iRightWidth);
|
2009-08-30 22:04:30 +00:00
|
|
|
|
//m_Mgr->GetPane(wxT("Pane 1")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
|
|
|
|
|
//m_Mgr->GetPane(wxT("Pane 2")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1);
|
2009-08-27 07:33:07 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2009-08-27 10:10:07 +00:00
|
|
|
|
_iRightWidth = 100 - iLeftWidth[1] - iMidWidth[1];
|
|
|
|
|
i.Add(0); j.Add(iLeftWidth[1]);
|
|
|
|
|
i.Add(2); j.Add(iMidWidth[1]);
|
|
|
|
|
i.Add(3); j.Add(_iRightWidth);
|
2009-08-27 07:33:07 +00:00
|
|
|
|
|
2009-08-30 19:44:42 +00:00
|
|
|
|
//m_Mgr->GetPane(wxT("Pane 0")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
|
2009-08-27 07:33:07 +00:00
|
|
|
|
//m_Mgr->GetPane(wxT("Pane1")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
|
2009-08-27 10:10:07 +00:00
|
|
|
|
//m_Mgr->GetPane(wxT("Pane2")).BestSize(_iMidWidth, -1).MinSize(_iMidWidth, -1).MaxSize(_iMidWidth, -1);
|
|
|
|
|
//m_Mgr->GetPane(wxT("Pane3")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1);
|
2009-08-27 07:33:07 +00:00
|
|
|
|
}
|
2009-08-27 10:10:07 +00:00
|
|
|
|
SetPaneSize(i, j);
|
2009-08-30 19:44:42 +00:00
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
int CFrame::PixelsToPercentage(int Pixels, int Total)
|
|
|
|
|
{
|
|
|
|
|
int Percentage = (int)(((float)Pixels / (float)Total) * 100.0);
|
|
|
|
|
return Percentage;
|
2009-08-27 07:33:07 +00:00
|
|
|
|
}
|
2009-08-30 19:44:42 +00:00
|
|
|
|
|
|
|
|
|
void CFrame::NamePanes()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
|
|
|
|
{
|
|
|
|
|
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiToolBar)))
|
|
|
|
|
{
|
|
|
|
|
m_Mgr->GetAllPanes().Item(i).Name(wxString::Format(wxT("Pane %i"), j));
|
|
|
|
|
m_Mgr->GetAllPanes().Item(i).Caption(wxString::Format(wxT("Pane %i"), j));
|
|
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CFrame::AddPane()
|
|
|
|
|
{
|
|
|
|
|
m_Mgr->AddPane(new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle));
|
|
|
|
|
NamePanes();
|
|
|
|
|
m_Mgr->Update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CFrame::OnPaneClose(wxAuiManagerEvent& event)
|
|
|
|
|
{
|
2009-08-30 22:04:30 +00:00
|
|
|
|
event.Veto();
|
|
|
|
|
|
2009-08-30 19:44:42 +00:00
|
|
|
|
wxAuiNotebook * nb = (wxAuiNotebook*)event.pane->window;
|
2009-08-30 22:04:30 +00:00
|
|
|
|
if (!nb) return;
|
|
|
|
|
if (! (nb->GetPageCount() == 0 || (nb->GetPageCount() == 1 && nb->GetPageText(0).IsSameAs(wxT("<>")))))
|
2009-08-30 19:44:42 +00:00
|
|
|
|
{
|
|
|
|
|
wxMessageBox(wxT("You can't close panes that have pages in them."),
|
|
|
|
|
wxT("Notice"),
|
|
|
|
|
wxOK,
|
|
|
|
|
this);
|
2009-08-30 22:04:30 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
|
|
|
|
Console->Log(LogTypes::LCUSTOM, StringFromFormat("GetNotebookCount before: %i\n", GetNotebookCount()).c_str());
|
|
|
|
|
|
|
|
|
|
// Detach and delete the empty notebook
|
|
|
|
|
m_Mgr->DetachPane(event.pane->window);
|
|
|
|
|
//event.pane->window->Close();
|
|
|
|
|
event.pane->window->Destroy();
|
|
|
|
|
|
|
|
|
|
Console->Log(LogTypes::LCUSTOM, StringFromFormat("GetNotebookCount after: %i\n", GetNotebookCount()).c_str());
|
2009-08-30 19:44:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-08-30 22:04:30 +00:00
|
|
|
|
m_Mgr->Update();
|
2009-08-30 19:44:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-08-27 07:33:07 +00:00
|
|
|
|
void CFrame::Save()
|
|
|
|
|
{
|
2009-08-30 19:44:42 +00:00
|
|
|
|
// Turn off edit before saving
|
|
|
|
|
TogglePaneStyle(false);
|
2009-08-27 07:33:07 +00:00
|
|
|
|
|
2009-08-30 19:44:42 +00:00
|
|
|
|
/**/
|
2009-08-27 07:33:07 +00:00
|
|
|
|
// Get client size
|
2009-08-30 19:44:42 +00:00
|
|
|
|
int iClientX = this->GetSize().GetX(), iClientY = this->GetSize().GetY();;
|
2009-08-27 07:33:07 +00:00
|
|
|
|
|
|
|
|
|
IniFile ini;
|
|
|
|
|
ini.Load(DEBUGGER_CONFIG_FILE);
|
2009-08-30 19:44:42 +00:00
|
|
|
|
std::string _Section = StringFromFormat("P - %s", Perspectives.at(ActivePerspective).Name.c_str());
|
|
|
|
|
ini.Set(_Section.c_str(), "Perspective", m_Mgr->SavePerspective().mb_str());
|
|
|
|
|
|
|
|
|
|
std::string SWidth = "", SHeight = "";
|
|
|
|
|
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
2009-08-27 07:33:07 +00:00
|
|
|
|
{
|
2009-08-30 19:44:42 +00:00
|
|
|
|
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiToolBar)))
|
|
|
|
|
{
|
|
|
|
|
SWidth += StringFromFormat("%i", PixelsToPercentage(m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetX(), iClientX));
|
|
|
|
|
SHeight += StringFromFormat("%i", PixelsToPercentage(m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetY(), iClientY));
|
|
|
|
|
SWidth += ","; SHeight += ",";
|
|
|
|
|
}
|
2009-08-27 07:33:07 +00:00
|
|
|
|
}
|
2009-08-30 19:44:42 +00:00
|
|
|
|
// Remove the ending ","
|
|
|
|
|
SWidth = SWidth.substr(0, SWidth.length()-1); SHeight = SHeight.substr(0, SHeight.length()-1);
|
|
|
|
|
|
|
|
|
|
ini.Set(_Section.c_str(), "Width", SWidth.c_str());
|
|
|
|
|
ini.Set(_Section.c_str(), "Height", SHeight.c_str());
|
|
|
|
|
|
|
|
|
|
// Save perspective names
|
|
|
|
|
std::string STmp = "";
|
|
|
|
|
for (int i = 0; i < Perspectives.size(); i++)
|
2009-08-27 07:33:07 +00:00
|
|
|
|
{
|
2009-08-30 19:44:42 +00:00
|
|
|
|
STmp += Perspectives.at(i).Name + ",";
|
2009-08-27 07:33:07 +00:00
|
|
|
|
}
|
2009-08-30 19:44:42 +00:00
|
|
|
|
STmp = STmp.substr(0, STmp.length()-1);
|
|
|
|
|
ini.Set("Perspectives", "Perspectives", STmp.c_str());
|
|
|
|
|
|
|
|
|
|
ini.Set("Perspectives", "Active", ActivePerspective);
|
|
|
|
|
|
2009-08-27 07:33:07 +00:00
|
|
|
|
ini.Save(DEBUGGER_CONFIG_FILE);
|
2009-08-30 19:44:42 +00:00
|
|
|
|
|
|
|
|
|
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
|
|
|
|
Console->Log(LogTypes::LCUSTOM, StringFromFormat("Saved: %s\n", STmp.c_str()).c_str());
|
|
|
|
|
|
|
|
|
|
TogglePaneStyle(m_ToolBarAui->GetToolToggled(IDM_EDIT_PERSPECTIVES));
|
2009-08-27 07:33:07 +00:00
|
|
|
|
}
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2009-01-05 04:08:18 +00:00
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2009-08-25 01:50:27 +00:00
|
|
|
|
// Host messages
|
2009-08-25 07:49:23 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2008-12-14 17:37:59 +00:00
|
|
|
|
#ifdef _WIN32
|
2009-07-02 21:17:36 +00:00
|
|
|
|
WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
switch (nMsg)
|
2008-12-23 08:47:37 +00:00
|
|
|
|
{
|
2009-07-02 21:17:36 +00:00
|
|
|
|
case WM_SYSCOMMAND:
|
|
|
|
|
switch (wParam & 0xFFF0)
|
2008-12-08 05:30:24 +00:00
|
|
|
|
{
|
2009-07-02 21:17:36 +00:00
|
|
|
|
case SC_SCREENSAVE:
|
|
|
|
|
case SC_MONITORPOWER:
|
|
|
|
|
return 0;
|
2008-12-08 05:30:24 +00:00
|
|
|
|
}
|
2009-07-02 21:17:36 +00:00
|
|
|
|
default:
|
|
|
|
|
// Let wxWidgets process it as normal
|
|
|
|
|
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
2008-12-08 05:30:24 +00:00
|
|
|
|
}
|
2009-07-02 21:17:36 +00:00
|
|
|
|
}
|
2009-01-04 21:53:41 +00:00
|
|
|
|
#endif
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
|
|
void CFrame::OnHostMessage(wxCommandEvent& event)
|
|
|
|
|
{
|
|
|
|
|
switch (event.GetId())
|
|
|
|
|
{
|
2008-12-10 08:57:57 +00:00
|
|
|
|
case IDM_UPDATEGUI:
|
|
|
|
|
UpdateGUI();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDM_UPDATESTATUSBAR:
|
|
|
|
|
if (m_pStatusBar != NULL)
|
|
|
|
|
{
|
|
|
|
|
m_pStatusBar->SetStatusText(event.GetString(), event.GetInt());
|
|
|
|
|
}
|
|
|
|
|
break;
|
2008-12-08 05:30:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-25 01:50:27 +00:00
|
|
|
|
// Post events
|
2009-08-25 10:58:13 +00:00
|
|
|
|
// Warning: This may cause an endless loop if the event is propagated back to its parent
|
2009-08-25 01:50:27 +00:00
|
|
|
|
void CFrame::PostEvent(wxCommandEvent& event)
|
2009-08-25 10:58:13 +00:00
|
|
|
|
{
|
|
|
|
|
event.Skip();
|
|
|
|
|
event.StopPropagation();
|
|
|
|
|
|
2009-08-25 09:13:17 +00:00
|
|
|
|
if (g_pCodeWindow
|
|
|
|
|
&& event.GetId() >= IDM_INTERPRETER && event.GetId() <= IDM_ADDRBOX
|
|
|
|
|
&& event.GetId() != IDM_JITUNLIMITED
|
|
|
|
|
)
|
|
|
|
|
wxPostEvent(g_pCodeWindow, event);
|
2009-08-25 01:50:27 +00:00
|
|
|
|
}
|
|
|
|
|
void CFrame::PostMenuEvent(wxMenuEvent& event)
|
|
|
|
|
{
|
|
|
|
|
if (g_pCodeWindow) wxPostEvent(g_pCodeWindow, event);
|
|
|
|
|
}
|
|
|
|
|
void CFrame::PostUpdateUIEvent(wxUpdateUIEvent& event)
|
|
|
|
|
{
|
|
|
|
|
if (g_pCodeWindow) wxPostEvent(g_pCodeWindow, event);
|
|
|
|
|
}
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
2009-08-25 01:50:27 +00:00
|
|
|
|
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2009-08-25 01:50:27 +00:00
|
|
|
|
// Input
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-01-28 16:51:05 +00:00
|
|
|
|
void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
|
2009-01-07 09:06:42 +00:00
|
|
|
|
{
|
2009-06-09 05:08:58 +00:00
|
|
|
|
// Show all platforms and regions if...
|
|
|
|
|
// 1. All platforms are set to hide
|
|
|
|
|
// 2. All Regions are set to hide
|
|
|
|
|
// Otherwise call BootGame to either...
|
|
|
|
|
// 1. Boot the selected iso
|
2009-07-01 04:55:53 +00:00
|
|
|
|
// 2. Boot the default or last loaded iso.
|
|
|
|
|
// 3. Call BrowseForDirectory if the gamelist is empty
|
2009-06-09 05:08:58 +00:00
|
|
|
|
if (!m_GameListCtrl->GetGameNames().size() &&
|
|
|
|
|
!((SConfig::GetInstance().m_ListGC ||
|
|
|
|
|
SConfig::GetInstance().m_ListWii ||
|
|
|
|
|
SConfig::GetInstance().m_ListWad) &&
|
|
|
|
|
(SConfig::GetInstance().m_ListJap ||
|
|
|
|
|
SConfig::GetInstance().m_ListUsa ||
|
|
|
|
|
SConfig::GetInstance().m_ListPal)))
|
|
|
|
|
{
|
|
|
|
|
SConfig::GetInstance().m_ListGC = SConfig::GetInstance().m_ListWii =
|
|
|
|
|
SConfig::GetInstance().m_ListWad = SConfig::GetInstance().m_ListJap =
|
|
|
|
|
SConfig::GetInstance().m_ListUsa = SConfig::GetInstance().m_ListPal = true;
|
|
|
|
|
|
|
|
|
|
GetMenuBar()->FindItem(IDM_LISTGC)->Check(true);
|
|
|
|
|
GetMenuBar()->FindItem(IDM_LISTWII)->Check(true);
|
|
|
|
|
GetMenuBar()->FindItem(IDM_LISTWAD)->Check(true);
|
|
|
|
|
GetMenuBar()->FindItem(IDM_LISTJAP)->Check(true);
|
|
|
|
|
GetMenuBar()->FindItem(IDM_LISTUSA)->Check(true);
|
|
|
|
|
GetMenuBar()->FindItem(IDM_LISTPAL)->Check(true);
|
|
|
|
|
|
|
|
|
|
m_GameListCtrl->Update();
|
|
|
|
|
}
|
|
|
|
|
else BootGame();
|
2009-01-07 09:06:42 +00:00
|
|
|
|
}
|
2009-01-28 16:51:05 +00:00
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
|
void CFrame::OnKeyDown(wxKeyEvent& event)
|
|
|
|
|
{
|
2009-04-28 23:47:18 +00:00
|
|
|
|
// Escape key turn off fullscreen then Stop emulation in windowed mode
|
|
|
|
|
if (event.GetKeyCode() == WXK_ESCAPE)
|
2008-12-08 05:30:24 +00:00
|
|
|
|
{
|
2009-08-25 06:34:58 +00:00
|
|
|
|
// 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());
|
2009-04-28 23:47:18 +00:00
|
|
|
|
if (IsFullScreen())
|
|
|
|
|
{
|
2009-08-25 06:34:58 +00:00
|
|
|
|
#ifdef _WIN32
|
2009-04-28 23:47:18 +00:00
|
|
|
|
MSWSetCursor(true);
|
2009-08-25 06:34:58 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
//UpdateGUI();
|
2008-12-08 05:30:24 +00:00
|
|
|
|
}
|
2009-04-28 23:47:18 +00:00
|
|
|
|
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
|
2009-08-25 06:34:58 +00:00
|
|
|
|
DoFullscreen(!IsFullScreen());
|
2009-04-28 23:47:18 +00:00
|
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
|
#ifdef _WIN32
|
2009-06-08 02:48:38 +00:00
|
|
|
|
if(event.GetKeyCode() == 'M', '3', '4', '5', '6') // Send this to the video plugin WndProc
|
2008-12-08 05:30:24 +00:00
|
|
|
|
{
|
|
|
|
|
PostMessage((HWND)Core::GetWindowHandle(), WM_KEYDOWN, event.GetKeyCode(), 0);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2009-02-16 06:18:18 +00:00
|
|
|
|
|
|
|
|
|
#ifdef RERECORDING
|
|
|
|
|
// Turn on or off frame advance
|
|
|
|
|
if (event.GetKeyCode() == WXK_CONTROL) Core::FrameStepOnOff();
|
|
|
|
|
|
|
|
|
|
// Step forward
|
|
|
|
|
if (event.GetKeyCode() == WXK_SPACE) Core::FrameAdvance();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Send the keyboard status to the Input plugin
|
|
|
|
|
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
|
|
|
CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 1); // 1 = Down
|
|
|
|
|
|
|
|
|
|
// Don't block other events
|
|
|
|
|
event.Skip();
|
2008-12-28 18:50:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CFrame::OnKeyUp(wxKeyEvent& event)
|
|
|
|
|
{
|
|
|
|
|
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
2009-01-24 12:09:30 +00:00
|
|
|
|
CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 0); // 0 = Up
|
2008-12-28 18:50:24 +00:00
|
|
|
|
event.Skip();
|
2008-12-08 05:30:24 +00:00
|
|
|
|
}
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
2008-12-23 08:47:37 +00:00
|
|
|
|
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2009-01-04 21:53:41 +00:00
|
|
|
|
// Detect double click. Kind of, for some reason we have to manually create the double click for now.
|
2009-08-25 06:34:58 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-01-04 21:53:41 +00:00
|
|
|
|
void CFrame::OnDoubleClick(wxMouseEvent& event)
|
2008-12-08 05:30:24 +00:00
|
|
|
|
{
|
2009-01-04 21:53:41 +00:00
|
|
|
|
// Don't block the mouse click
|
|
|
|
|
event.Skip();
|
|
|
|
|
|
|
|
|
|
// Don't use this in Wii mode since we use the mouse as input to the game there
|
|
|
|
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) return;
|
|
|
|
|
|
|
|
|
|
// Only detect double clicks in the rendering window, and only use this when a game is running
|
|
|
|
|
if(Core::GetState() == Core::CORE_UNINITIALIZED || event.GetId() != IDM_MPANEL) return;
|
|
|
|
|
|
|
|
|
|
// For first click just save the time
|
2009-08-25 06:34:58 +00:00
|
|
|
|
if(m_fLastClickTime == 0) { m_fLastClickTime = Common::Timer::GetDoubleTime(); return; }
|
2009-01-04 21:53:41 +00:00
|
|
|
|
|
|
|
|
|
// -------------------------------------------
|
|
|
|
|
/* Manually detect double clicks since both wxEVT_LEFT_DCLICK and WM_LBUTTONDBLCLK stops
|
|
|
|
|
working after the child window is created by the plugin */
|
|
|
|
|
// ----------------------
|
2009-08-25 06:34:58 +00:00
|
|
|
|
double TmpTime = Common::Timer::GetDoubleTime();
|
2009-01-04 21:53:41 +00:00
|
|
|
|
int Elapsed = (TmpTime - m_fLastClickTime) * 1000;
|
|
|
|
|
|
|
|
|
|
// Get the double click time, if avaliable
|
|
|
|
|
int DoubleClickTime;
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
DoubleClickTime = GetDoubleClickTime();
|
|
|
|
|
#else
|
|
|
|
|
DoubleClickTime = 500; // The default in Windows
|
2009-01-03 01:38:44 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
m_fLastClickTime = TmpTime; // Save the click time
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
if (Elapsed < DoubleClickTime)
|
2008-12-12 03:38:50 +00:00
|
|
|
|
{
|
2009-08-25 06:34:58 +00:00
|
|
|
|
DoFullscreen(!IsFullScreen());
|
2009-01-04 23:24:13 +00:00
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
MSWSetCursor(true); // Show the cursor again, in case it was hidden
|
|
|
|
|
#endif
|
2009-01-04 21:53:41 +00:00
|
|
|
|
m_fLastClickTime -= 10; // Don't treat repeated clicks as double clicks
|
2009-04-28 23:47:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateGUI();
|
2009-01-04 21:53:41 +00:00
|
|
|
|
}
|
2008-12-23 08:47:37 +00:00
|
|
|
|
|
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
// Check for mouse motion. Here we process the bHideCursor setting.
|
2009-08-25 06:34:58 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-01-04 21:53:41 +00:00
|
|
|
|
void CFrame::OnMotion(wxMouseEvent& event)
|
2009-01-15 06:48:15 +00:00
|
|
|
|
{
|
2009-01-04 21:53:41 +00:00
|
|
|
|
event.Skip();
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
// The following is only interesting when a game is running
|
|
|
|
|
if(Core::GetState() == Core::CORE_UNINITIALIZED) return;
|
2008-12-23 08:47:37 +00:00
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
/* For some reason WM_MOUSEMOVE events are sent from the plugin even when there is no movement
|
|
|
|
|
so we have to check that the cursor position has actually changed */
|
|
|
|
|
if(bRenderToMain) //
|
2008-12-12 03:38:50 +00:00
|
|
|
|
{
|
2009-01-04 21:53:41 +00:00
|
|
|
|
bool PositionIdentical = false;
|
|
|
|
|
if (event.GetX() == LastMouseX && event.GetY() == LastMouseY) PositionIdentical = true;
|
|
|
|
|
LastMouseX = event.GetX(); LastMouseY = event.GetY();
|
|
|
|
|
if(PositionIdentical) return;
|
2008-12-12 03:38:50 +00:00
|
|
|
|
}
|
2009-01-04 21:53:41 +00:00
|
|
|
|
|
|
|
|
|
// Now we know that we have an actual mouse movement event
|
|
|
|
|
|
|
|
|
|
// Update motion for the auto hide option and return
|
|
|
|
|
if(IsFullScreen() && SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor)
|
2008-12-12 03:38:50 +00:00
|
|
|
|
{
|
2009-08-25 06:34:58 +00:00
|
|
|
|
m_iLastMotionTime = Common::Timer::GetDoubleTime();
|
2009-01-04 23:24:13 +00:00
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
MSWSetCursor(true);
|
|
|
|
|
#endif
|
2009-01-04 21:53:41 +00:00
|
|
|
|
return;
|
2008-12-08 05:30:24 +00:00
|
|
|
|
}
|
2008-12-12 03:38:50 +00:00
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
if(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor && event.GetId() == IDM_MPANEL)
|
2008-12-08 05:30:24 +00:00
|
|
|
|
{
|
2009-01-04 23:24:13 +00:00
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
if(bRenderToMain) MSWSetCursor(false);
|
2009-01-04 21:53:41 +00:00
|
|
|
|
|
2009-01-04 23:24:13 +00:00
|
|
|
|
/* We only need to use this if we are rendering to a separate window. It does work
|
|
|
|
|
for rendering to the main window to, but in that case our MSWSetCursor() works to
|
|
|
|
|
so we can use that instead. If we one day determine that the separate window
|
|
|
|
|
rendering is superfluous we could do without this */
|
|
|
|
|
else PostMessage((HWND)Core::GetWindowHandle(), WM_USER, 10, 0);
|
|
|
|
|
#endif
|
2008-12-12 03:38:50 +00:00
|
|
|
|
}
|
2009-01-04 21:53:41 +00:00
|
|
|
|
|
|
|
|
|
// For some reason we need this to, otherwise the cursor can get stuck with the resizing arrows
|
2008-12-12 03:38:50 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2009-01-04 23:24:13 +00:00
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
if(bRenderToMain) MSWSetCursor(true);
|
|
|
|
|
else PostMessage((HWND)Core::GetWindowHandle(), WM_USER, 10, 1);
|
|
|
|
|
#endif
|
2008-12-08 05:30:24 +00:00
|
|
|
|
}
|
2009-01-15 06:48:15 +00:00
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check for mouse status a couple of times per second for the auto hide option
|
2009-08-25 06:34:58 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2009-01-04 21:53:41 +00:00
|
|
|
|
#if wxUSE_TIMER
|
|
|
|
|
void CFrame::Update()
|
|
|
|
|
{
|
|
|
|
|
// Check if auto hide is on, or if we are already hiding the cursor all the time
|
|
|
|
|
if(!SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor
|
|
|
|
|
|| SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) return;
|
|
|
|
|
|
|
|
|
|
if(IsFullScreen())
|
|
|
|
|
{
|
|
|
|
|
int HideDelay = 1; // Wait 1 second to hide the cursor, just like Windows Media Player
|
2009-08-25 06:34:58 +00:00
|
|
|
|
double TmpSeconds = Common::Timer::GetDoubleTime(); // Get timestamp
|
2009-01-04 21:53:41 +00:00
|
|
|
|
double CompareTime = TmpSeconds - HideDelay; // Compare it
|
2009-01-03 01:38:44 +00:00
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
|
if(m_iLastMotionTime < CompareTime) // Update cursor
|
2009-01-04 23:24:13 +00:00
|
|
|
|
#ifdef _WIN32
|
2009-01-04 21:53:41 +00:00
|
|
|
|
MSWSetCursor(false);
|
2009-01-04 23:24:13 +00:00
|
|
|
|
#else
|
|
|
|
|
{}
|
|
|
|
|
#endif
|
2009-01-04 21:53:41 +00:00
|
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
|
}
|
2009-01-04 21:53:41 +00:00
|
|
|
|
#endif
|
2009-08-25 06:34:58 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|