2013-04-18 03:43:35 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2009-01-03 01:38:44 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <cstddef>
|
|
|
|
#include <mutex>
|
2014-02-17 10:18:15 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/chartype.h>
|
|
|
|
#include <wx/defs.h>
|
|
|
|
#include <wx/event.h>
|
|
|
|
#include <wx/frame.h>
|
|
|
|
#include <wx/gdicmn.h>
|
|
|
|
#include <wx/image.h>
|
2014-02-19 01:56:29 +00:00
|
|
|
#include <wx/mstream.h>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/panel.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/toplevel.h>
|
|
|
|
#include <wx/windowid.h>
|
2009-05-13 22:23:54 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-04-13 23:15:23 +00:00
|
|
|
#include "Common/Event.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/Globals.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "InputCommon/GCPadStatus.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
|
2010-04-12 01:33:10 +00:00
|
|
|
#if defined(HAVE_X11) && HAVE_X11
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/X11Utils.h"
|
2010-04-12 01:33:10 +00:00
|
|
|
#endif
|
2009-05-13 22:23:54 +00:00
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
// Class declarations
|
2008-12-08 04:46:09 +00:00
|
|
|
class CGameListCtrl;
|
2014-02-22 22:36:30 +00:00
|
|
|
class CCodeWindow;
|
2009-08-31 23:09:50 +00:00
|
|
|
class CLogWindow;
|
2011-03-27 02:55:08 +00:00
|
|
|
class FifoPlayerDlg;
|
2014-02-22 22:36:30 +00:00
|
|
|
class LogConfigWindow;
|
2011-02-27 02:27:43 +00:00
|
|
|
class NetPlaySetupDiag;
|
2014-02-22 22:36:30 +00:00
|
|
|
class TASInputDlg;
|
2011-02-27 02:27:43 +00:00
|
|
|
class wxCheatsWindow;
|
2009-06-18 08:22:02 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
class wxAuiManager;
|
|
|
|
class wxAuiManagerEvent;
|
|
|
|
class wxAuiNotebook;
|
|
|
|
class wxAuiNotebookEvent;
|
|
|
|
class wxAuiToolBar;
|
|
|
|
class wxAuiToolBarEvent;
|
|
|
|
class wxListEvent;
|
|
|
|
class wxMenuItem;
|
|
|
|
class wxWindow;
|
|
|
|
|
2011-02-02 16:34:12 +00:00
|
|
|
// The CPanel class to receive MSWWindowProc messages from the video backend.
|
2010-04-12 01:33:10 +00:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2010-04-15 03:25:35 +00:00
|
|
|
class CRenderFrame : public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CRenderFrame(wxFrame* parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
2014-05-17 17:17:28 +00:00
|
|
|
const wxString& title = "Dolphin",
|
2010-04-15 03:25:35 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
|
|
|
|
|
|
|
|
private:
|
2013-09-27 12:38:12 +00:00
|
|
|
void OnDropFiles(wxDropFilesEvent& event);
|
2010-04-15 03:25:35 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
// Receive WndProc messages
|
|
|
|
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
#endif
|
2013-09-27 12:38:12 +00:00
|
|
|
|
2010-04-15 03:25:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CFrame : public CRenderFrame
|
2008-12-08 04:46:09 +00:00
|
|
|
{
|
2011-03-15 23:09:12 +00:00
|
|
|
public:
|
|
|
|
CFrame(wxFrame* parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
2014-05-17 17:17:28 +00:00
|
|
|
const wxString& title = "Dolphin",
|
2011-03-15 23:09:12 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
bool _UseDebugger = false,
|
|
|
|
bool _BatchMode = false,
|
|
|
|
bool ShowLogWindow = false,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
|
|
|
|
|
|
|
|
virtual ~CFrame();
|
|
|
|
|
|
|
|
void* GetRenderHandle()
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
return (void *)m_RenderParent->GetHandle();
|
|
|
|
#elif defined(HAVE_X11) && HAVE_X11
|
|
|
|
return (void *)X11Utils::XWindowFromHandle(m_RenderParent->GetHandle());
|
|
|
|
#else
|
|
|
|
return m_RenderParent;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-04-08 05:16:50 +00:00
|
|
|
// These have to be public
|
2011-03-15 23:09:12 +00:00
|
|
|
CCodeWindow* g_pCodeWindow;
|
|
|
|
NetPlaySetupDiag* g_NetPlaySetupDiag;
|
|
|
|
wxCheatsWindow* g_CheatsWindow;
|
2012-11-11 22:38:01 +00:00
|
|
|
TASInputDlg* g_TASInputDlg[4];
|
2013-07-24 00:43:51 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
void InitBitmaps();
|
|
|
|
void DoPause();
|
|
|
|
void DoStop();
|
|
|
|
void DoRecordingSave();
|
|
|
|
void UpdateGUI();
|
|
|
|
void UpdateGameList();
|
|
|
|
void ToggleLogWindow(bool bShow);
|
|
|
|
void ToggleLogConfigWindow(bool bShow);
|
|
|
|
void PostEvent(wxCommandEvent& event);
|
|
|
|
void StatusBarMessage(const char * Text, ...);
|
|
|
|
void ClearStatusBar();
|
|
|
|
void GetRenderWindowSize(int& x, int& y, int& width, int& height);
|
|
|
|
void OnRenderWindowSizeRequest(int width, int height);
|
|
|
|
void BootGame(const std::string& filename);
|
|
|
|
void OnRenderParentClose(wxCloseEvent& event);
|
|
|
|
void OnRenderParentMove(wxMoveEvent& event);
|
|
|
|
bool RendererHasFocus();
|
|
|
|
void DoFullscreen(bool bF);
|
|
|
|
void ToggleDisplayMode (bool bFullscreen);
|
2014-03-09 20:14:26 +00:00
|
|
|
void UpdateWiiMenuChoice(wxMenuItem *WiiMenuItem=nullptr);
|
2011-03-15 23:09:12 +00:00
|
|
|
static void ConnectWiimote(int wm_idx, bool connect);
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
const CGameListCtrl *GetGameListCtrl() const;
|
2010-11-11 00:55:06 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
#ifdef __WXGTK__
|
|
|
|
Common::Event panic_event;
|
|
|
|
bool bPanicResult;
|
2011-03-16 01:12:27 +00:00
|
|
|
std::recursive_mutex keystate_lock;
|
2011-03-15 23:09:12 +00:00
|
|
|
#endif
|
2008-12-09 05:37:15 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
|
|
|
X11Utils::XRRConfiguration *m_XRRConfig;
|
|
|
|
#endif
|
2009-08-25 07:05:53 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
// AUI
|
|
|
|
wxAuiManager *m_Mgr;
|
|
|
|
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
|
|
|
|
bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
|
|
|
|
|
|
|
|
// Perspectives (Should find a way to make all of this private)
|
|
|
|
void DoAddPage(wxWindow *Win, int i, bool Float);
|
|
|
|
void DoRemovePage(wxWindow *, bool bHide = true);
|
|
|
|
struct SPerspectives
|
|
|
|
{
|
|
|
|
std::string Name;
|
|
|
|
wxString Perspective;
|
|
|
|
std::vector<int> Width, Height;
|
|
|
|
};
|
|
|
|
std::vector<SPerspectives> Perspectives;
|
2013-10-29 05:23:17 +00:00
|
|
|
u32 ActivePerspective;
|
2011-03-15 23:09:12 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
CGameListCtrl* m_GameListCtrl;
|
|
|
|
wxPanel* m_Panel;
|
|
|
|
CRenderFrame* m_RenderFrame;
|
|
|
|
wxPanel* m_RenderParent;
|
|
|
|
CLogWindow* m_LogWindow;
|
|
|
|
LogConfigWindow* m_LogConfigWindow;
|
2011-03-27 02:55:08 +00:00
|
|
|
FifoPlayerDlg* m_FifoPlayerDlg;
|
2011-03-15 23:09:12 +00:00
|
|
|
bool UseDebugger;
|
|
|
|
bool m_bBatchMode;
|
|
|
|
bool m_bEdit;
|
|
|
|
bool m_bTabSplit;
|
|
|
|
bool m_bNoDocking;
|
|
|
|
bool m_bGameLoading;
|
|
|
|
|
|
|
|
std::vector<std::string> drives;
|
|
|
|
|
|
|
|
enum EToolbar
|
|
|
|
{
|
|
|
|
Toolbar_FileOpen,
|
|
|
|
Toolbar_Refresh,
|
|
|
|
Toolbar_Browse,
|
|
|
|
Toolbar_Play,
|
|
|
|
Toolbar_Stop,
|
|
|
|
Toolbar_Pause,
|
|
|
|
Toolbar_Screenshot,
|
|
|
|
Toolbar_FullScreen,
|
|
|
|
Toolbar_ConfigMain,
|
|
|
|
Toolbar_ConfigGFX,
|
|
|
|
Toolbar_ConfigDSP,
|
|
|
|
Toolbar_ConfigPAD,
|
2013-04-08 05:16:50 +00:00
|
|
|
Toolbar_Wiimote,
|
2011-03-15 23:09:12 +00:00
|
|
|
EToolbar_Max
|
|
|
|
};
|
|
|
|
|
|
|
|
wxBitmap m_Bitmaps[EToolbar_Max];
|
|
|
|
wxBitmap m_BitmapsMenu[EToolbar_Max];
|
|
|
|
|
|
|
|
void PopulateToolbar(wxAuiToolBar* toolBar);
|
|
|
|
void PopulateToolbarAui(wxAuiToolBar* toolBar);
|
|
|
|
void RecreateToolbar();
|
|
|
|
void CreateMenu();
|
|
|
|
|
|
|
|
// Utility
|
|
|
|
wxString GetMenuLabel(int Id);
|
|
|
|
wxWindow * GetNotebookPageFromId(wxWindowID Id);
|
|
|
|
wxAuiNotebook * GetNotebookFromId(u32 NBId);
|
|
|
|
int GetNotebookCount();
|
|
|
|
wxAuiNotebook *CreateEmptyNotebook();
|
|
|
|
|
|
|
|
// Perspectives
|
|
|
|
void AddRemoveBlankPage();
|
|
|
|
void OnNotebookPageClose(wxAuiNotebookEvent& event);
|
|
|
|
void OnAllowNotebookDnD(wxAuiNotebookEvent& event);
|
|
|
|
void OnNotebookPageChanged(wxAuiNotebookEvent& event);
|
|
|
|
void OnFloatWindow(wxCommandEvent& event);
|
|
|
|
void ToggleFloatWindow(int Id);
|
|
|
|
void OnTab(wxAuiNotebookEvent& event);
|
|
|
|
int GetNotebookAffiliation(wxWindowID Id);
|
|
|
|
void ClosePages();
|
|
|
|
void CloseAllNotebooks();
|
2011-03-23 02:06:40 +00:00
|
|
|
void ShowResizePane();
|
2011-03-15 23:09:12 +00:00
|
|
|
void TogglePane();
|
|
|
|
void SetPaneSize();
|
|
|
|
void ResetToolbarStyle();
|
|
|
|
void TogglePaneStyle(bool On, int EventId);
|
|
|
|
void ToggleNotebookStyle(bool On, long Style);
|
|
|
|
// Float window
|
|
|
|
void DoUnfloatPage(int Id);
|
|
|
|
void OnFloatingPageClosed(wxCloseEvent& event);
|
|
|
|
void OnFloatingPageSize(wxSizeEvent& event);
|
|
|
|
void DoFloatNotebookPage(wxWindowID Id);
|
|
|
|
wxFrame * CreateParentFrame(wxWindowID Id = wxID_ANY,
|
2014-05-17 17:17:28 +00:00
|
|
|
const wxString& title = "",
|
2014-03-09 20:14:26 +00:00
|
|
|
wxWindow * = nullptr);
|
2011-03-15 23:09:12 +00:00
|
|
|
wxString AuiFullscreen, AuiCurrent;
|
|
|
|
void AddPane();
|
|
|
|
void UpdateCurrentPerspective();
|
|
|
|
void SaveIniPerspectives();
|
|
|
|
void LoadIniPerspectives();
|
|
|
|
void OnPaneClose(wxAuiManagerEvent& evt);
|
|
|
|
void ReloadPanes();
|
|
|
|
void DoLoadPerspective();
|
2013-10-29 05:23:17 +00:00
|
|
|
void OnDropDownToolbarSelect(wxCommandEvent& event);
|
2011-03-15 23:09:12 +00:00
|
|
|
void OnDropDownSettingsToolbar(wxAuiToolBarEvent& event);
|
|
|
|
void OnDropDownToolbarItem(wxAuiToolBarEvent& event);
|
2013-10-29 05:23:17 +00:00
|
|
|
void OnSelectPerspective(wxCommandEvent& event);
|
2010-07-30 03:51:49 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
#ifdef _WIN32
|
2011-03-15 23:09:12 +00:00
|
|
|
// Override window proc for tricks like screensaver disabling
|
|
|
|
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
2008-12-08 04:46:09 +00:00
|
|
|
#endif
|
2011-03-15 23:09:12 +00:00
|
|
|
// Event functions
|
|
|
|
void OnQuit(wxCommandEvent& event);
|
|
|
|
void OnHelp(wxCommandEvent& event);
|
|
|
|
void OnToolBar(wxCommandEvent& event);
|
|
|
|
void OnAuiToolBar(wxAuiToolBarEvent& event);
|
|
|
|
|
|
|
|
void OnOpen(wxCommandEvent& event); // File menu
|
|
|
|
void DoOpen(bool Boot);
|
|
|
|
void OnRefresh(wxCommandEvent& event);
|
|
|
|
void OnBrowse(wxCommandEvent& event);
|
|
|
|
void OnBootDrive(wxCommandEvent& event);
|
|
|
|
|
|
|
|
void OnPlay(wxCommandEvent& event); // Emulation
|
|
|
|
void OnStop(wxCommandEvent& event);
|
|
|
|
void OnReset(wxCommandEvent& event);
|
|
|
|
void OnRecord(wxCommandEvent& event);
|
|
|
|
void OnPlayRecording(wxCommandEvent& event);
|
|
|
|
void OnRecordExport(wxCommandEvent& event);
|
|
|
|
void OnRecordReadOnly(wxCommandEvent& event);
|
2011-06-24 06:50:50 +00:00
|
|
|
void OnTASInput(wxCommandEvent& event);
|
2012-11-11 02:57:31 +00:00
|
|
|
void OnTogglePauseMovie(wxCommandEvent& event);
|
2012-11-11 22:57:06 +00:00
|
|
|
void OnShowLag(wxCommandEvent& event);
|
2011-03-15 23:09:12 +00:00
|
|
|
void OnChangeDisc(wxCommandEvent& event);
|
|
|
|
void OnScreenshot(wxCommandEvent& event);
|
|
|
|
void OnActive(wxActivateEvent& event);
|
2013-10-29 05:23:17 +00:00
|
|
|
void OnClose(wxCloseEvent &event);
|
2011-03-15 23:09:12 +00:00
|
|
|
void OnLoadState(wxCommandEvent& event);
|
|
|
|
void OnSaveState(wxCommandEvent& event);
|
|
|
|
void OnLoadStateFromFile(wxCommandEvent& event);
|
|
|
|
void OnSaveStateToFile(wxCommandEvent& event);
|
|
|
|
void OnLoadLastState(wxCommandEvent& event);
|
2012-11-08 07:40:49 +00:00
|
|
|
void OnSaveFirstState(wxCommandEvent& event);
|
2011-03-15 23:09:12 +00:00
|
|
|
void OnUndoLoadState(wxCommandEvent& event);
|
|
|
|
void OnUndoSaveState(wxCommandEvent& event);
|
2013-04-08 05:16:50 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
void OnFrameSkip(wxCommandEvent& event);
|
|
|
|
void OnFrameStep(wxCommandEvent& event);
|
2013-04-08 05:16:50 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
void OnConfigMain(wxCommandEvent& event); // Options
|
|
|
|
void OnConfigGFX(wxCommandEvent& event);
|
|
|
|
void OnConfigDSP(wxCommandEvent& event);
|
|
|
|
void OnConfigPAD(wxCommandEvent& event);
|
|
|
|
void OnConfigWiimote(wxCommandEvent& event);
|
|
|
|
void OnConfigHotkey(wxCommandEvent& event);
|
|
|
|
|
|
|
|
void OnToggleFullscreen(wxCommandEvent& event);
|
|
|
|
void OnToggleDualCore(wxCommandEvent& event);
|
|
|
|
void OnToggleSkipIdle(wxCommandEvent& event);
|
|
|
|
void OnToggleThrottle(wxCommandEvent& event);
|
|
|
|
void OnManagerResize(wxAuiManagerEvent& event);
|
|
|
|
void OnMove(wxMoveEvent& event);
|
|
|
|
void OnResize(wxSizeEvent& event);
|
|
|
|
void OnToggleToolbar(wxCommandEvent& event);
|
|
|
|
void DoToggleToolbar(bool);
|
|
|
|
void OnToggleStatusbar(wxCommandEvent& event);
|
|
|
|
void OnToggleWindow(wxCommandEvent& event);
|
|
|
|
|
|
|
|
void OnKeyDown(wxKeyEvent& event); // Keyboard
|
|
|
|
void OnKeyUp(wxKeyEvent& event);
|
|
|
|
|
|
|
|
void OnMouse(wxMouseEvent& event); // Mouse
|
2013-04-08 05:16:50 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
void OnHostMessage(wxCommandEvent& event);
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
void OnMemcard(wxCommandEvent& event); // Misc
|
|
|
|
void OnImportSave(wxCommandEvent& event);
|
2013-08-18 21:59:05 +00:00
|
|
|
void OnExportAllSaves(wxCommandEvent& event);
|
2009-04-15 20:19:25 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
void OnNetPlay(wxCommandEvent& event);
|
2009-05-13 21:50:24 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
void OnShow_CheatsWindow(wxCommandEvent& event);
|
|
|
|
void OnLoadWiiMenu(wxCommandEvent& event);
|
2011-05-08 02:56:09 +00:00
|
|
|
void OnInstallWAD(wxCommandEvent& event);
|
2011-03-27 02:55:08 +00:00
|
|
|
void OnFifoPlayer(wxCommandEvent& event);
|
2011-03-15 23:09:12 +00:00
|
|
|
void OnConnectWiimote(wxCommandEvent& event);
|
|
|
|
void GameListChanged(wxCommandEvent& event);
|
2008-12-23 08:47:37 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
void OnGameListCtrl_ItemActivated(wxListEvent& event);
|
|
|
|
void OnRenderParentResize(wxSizeEvent& event);
|
|
|
|
bool RendererIsFullscreen();
|
|
|
|
void StartGame(const std::string& filename);
|
2009-01-07 09:06:42 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
// Event table
|
|
|
|
DECLARE_EVENT_TABLE();
|
2008-12-08 04:46:09 +00:00
|
|
|
};
|
|
|
|
|
2011-02-14 01:18:01 +00:00
|
|
|
int GetCmdForHotkey(unsigned int key);
|
2009-08-30 08:22:05 +00:00
|
|
|
|
2011-12-18 09:15:59 +00:00
|
|
|
void OnAfterLoadCallback();
|
|
|
|
|
2011-06-24 06:50:50 +00:00
|
|
|
// For TASInputDlg
|
|
|
|
void TASManipFunction(SPADStatus *PadStatus, int controllerID);
|
2012-11-11 21:35:08 +00:00
|
|
|
bool TASInputHasFocus();
|