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
|
|
|
|
2010-02-21 20:09:49 +00:00
|
|
|
// 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
|
2009-09-06 13:36:05 +00:00
|
|
|
// be accessed from Core::GetWindowHandle().
|
2009-01-04 21:53:41 +00:00
|
|
|
|
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"
|
2010-01-19 19:28:27 +00:00
|
|
|
#include "ConsoleListener.h"
|
2008-12-08 05:30:24 +00:00
|
|
|
|
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"
|
2010-01-03 23:05:52 +00:00
|
|
|
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
|
2008-12-08 05:30:24 +00:00
|
|
|
#include "State.h"
|
2008-12-23 08:47:37 +00:00
|
|
|
#include "VolumeHandler.h"
|
2009-08-31 23:09:50 +00:00
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
#include <wx/datetime.h> // wxWidgets
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2010-02-17 17:53:08 +00:00
|
|
|
#if defined HAVE_X11 && HAVE_X11
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#endif
|
|
|
|
|
2009-09-01 13:06:37 +00:00
|
|
|
// Resources
|
2009-09-01 12:44:02 +00:00
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
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
|
|
|
|
2010-02-02 08:10:23 +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
|
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-09-01 12:44:02 +00:00
|
|
|
|
2009-09-06 13:36:05 +00:00
|
|
|
// ---------------
|
|
|
|
// The CPanel class to receive MSWWindowProc messages from the video plugin.
|
2009-01-04 21:53:41 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
}
|
2010-01-03 23:05:52 +00:00
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
WXLRESULT CPanel::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (nMsg)
|
|
|
|
{
|
|
|
|
case WM_USER:
|
|
|
|
switch(wParam)
|
|
|
|
{
|
2010-02-09 00:34:27 +00:00
|
|
|
// Pause
|
|
|
|
case WM_USER_PAUSE:
|
|
|
|
main_frame->DoPause();
|
|
|
|
break;
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
// Stop
|
2009-11-15 07:46:43 +00:00
|
|
|
case WM_USER_STOP:
|
2009-01-04 21:53:41 +00:00
|
|
|
main_frame->DoStop();
|
2010-02-08 09:57:52 +00:00
|
|
|
break;
|
2009-01-04 21:53:41 +00:00
|
|
|
|
2009-11-15 07:46:43 +00:00
|
|
|
case 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;
|
2010-02-08 09:57:52 +00:00
|
|
|
break;
|
2010-01-03 23:05:52 +00:00
|
|
|
|
|
|
|
case WIIMOTE_DISCONNECT:
|
2010-01-25 05:12:24 +00:00
|
|
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
|
|
|
|
{
|
2010-01-22 23:24:43 +00:00
|
|
|
if (main_frame->bNoWiimoteMsg)
|
|
|
|
main_frame->bNoWiimoteMsg = false;
|
|
|
|
else
|
|
|
|
{
|
2010-03-30 17:57:44 +00:00
|
|
|
int wiimote_idx = lParam;
|
|
|
|
int wiimote_num = wiimote_idx + 1;
|
2010-03-27 04:21:19 +00:00
|
|
|
//Auto reconnect if option is turned on.
|
|
|
|
//TODO: Make this only auto reconnect wiimotes that have the option activated.
|
2010-03-30 17:57:44 +00:00
|
|
|
SConfig::GetInstance().LoadSettingsWii();//Make sure we are using the newest settings.
|
|
|
|
if (SConfig::GetInstance().m_WiiAutoReconnect[wiimote_idx])
|
2010-03-30 11:53:41 +00:00
|
|
|
{
|
2010-03-30 17:57:44 +00:00
|
|
|
GetUsbPointer()->AccessWiiMote(wiimote_idx | 0x100)->Activate(true);
|
|
|
|
NOTICE_LOG(WIIMOTE, "Wiimote %i has been auto-reconnected...", wiimote_num);
|
2010-03-27 04:21:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// The Wiimote has been disconnected, we offer reconnect here.
|
|
|
|
wxMessageDialog *dlg = new wxMessageDialog(
|
|
|
|
this,
|
|
|
|
wxString::Format(wxT("Wiimote %i has been disconnected by system.\n")
|
|
|
|
wxT("Maybe this game doesn't support multi-wiimote,\n")
|
|
|
|
wxT("or maybe it is due to idle time out or other reason.\n\n")
|
2010-03-30 17:57:44 +00:00
|
|
|
wxT("Do you want to reconnect immediately?"), wiimote_num),
|
2010-03-27 04:21:19 +00:00
|
|
|
wxT("Reconnect Wiimote Confirm"),
|
|
|
|
wxYES_NO | wxSTAY_ON_TOP | wxICON_INFORMATION, //wxICON_QUESTION,
|
|
|
|
wxDefaultPosition);
|
|
|
|
|
|
|
|
if (dlg->ShowModal() == wxID_YES)
|
2010-03-30 17:57:44 +00:00
|
|
|
GetUsbPointer()->AccessWiiMote(wiimote_idx | 0x100)->Activate(true);
|
2010-03-27 04:21:19 +00:00
|
|
|
|
|
|
|
dlg->Destroy();
|
|
|
|
}
|
2010-01-22 23:24:43 +00:00
|
|
|
}
|
2010-01-04 03:11:31 +00:00
|
|
|
}
|
2009-01-04 21:53:41 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-02-08 09:57:52 +00:00
|
|
|
default:
|
|
|
|
// By default let wxWidgets do what it normally does with this event
|
|
|
|
return wxPanel::MSWWindowProc(nMsg, wParam, lParam);
|
2009-01-04 21:53:41 +00:00
|
|
|
}
|
2010-02-08 09:57:52 +00:00
|
|
|
return 0;
|
2009-01-04 21:53:41 +00:00
|
|
|
}
|
|
|
|
#endif
|
2009-09-01 12:44:02 +00:00
|
|
|
|
|
|
|
// event tables
|
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)
|
2009-09-03 05:24:30 +00:00
|
|
|
|
|
|
|
// Menu bar
|
2008-12-08 05:30:24 +00:00
|
|
|
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-10-06 15:49:20 +00:00
|
|
|
EVT_MENU(IDM_STOP, CFrame::OnStop)
|
|
|
|
EVT_MENU(IDM_RESET, CFrame::OnReset)
|
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)
|
2009-08-22 02:05:02 +00:00
|
|
|
EVT_MENU(IDM_FRAMESTEP, CFrame::OnFrameStep)
|
2009-11-07 23:54:10 +00:00
|
|
|
EVT_MENU(IDM_LUA, CFrame::OnOpenLuaWindow)
|
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_MENU(IDM_SAVE_PERSPECTIVE, CFrame::OnToolBar)
|
2009-09-01 19:47:04 +00:00
|
|
|
EVT_AUITOOLBAR_TOOL_DROPDOWN(IDM_SAVE_PERSPECTIVE, CFrame::OnDropDownToolbarItem)
|
2009-08-30 19:44:42 +00:00
|
|
|
EVT_MENU(IDM_EDIT_PERSPECTIVES, CFrame::OnToolBar)
|
2009-09-01 19:47:04 +00:00
|
|
|
EVT_AUITOOLBAR_TOOL_DROPDOWN(IDM_EDIT_PERSPECTIVES, CFrame::OnDropDownSettingsToolbar)
|
|
|
|
// Drop down
|
|
|
|
EVT_MENU(IDM_PERSPECTIVES_ADD_PANE, CFrame::OnToolBar)
|
2009-08-30 19:44:42 +00:00
|
|
|
EVT_MENU_RANGE(IDM_PERSPECTIVES_0, IDM_PERSPECTIVES_100, CFrame::OnSelectPerspective)
|
2009-09-01 19:47:04 +00:00
|
|
|
EVT_MENU(IDM_ADD_PERSPECTIVE, CFrame::OnDropDownToolbarSelect)
|
|
|
|
EVT_MENU(IDM_TAB_SPLIT, CFrame::OnDropDownToolbarSelect)
|
2009-09-02 15:23:53 +00:00
|
|
|
EVT_MENU(IDM_NO_DOCKING, CFrame::OnDropDownToolbarSelect)
|
2009-09-05 04:50:45 +00:00
|
|
|
// Drop down float
|
|
|
|
EVT_MENU(IDM_FLOAT_LOGWINDOW, CFrame::OnFloatWindow)
|
|
|
|
EVT_MENU(IDM_FLOAT_CONSOLEWINDOW, CFrame::OnFloatWindow)
|
|
|
|
EVT_MENU(IDM_FLOAT_CODEWINDOW, CFrame::OnFloatWindow)
|
|
|
|
EVT_MENU(IDM_FLOAT_REGISTERWINDOW, CFrame::OnFloatWindow)
|
|
|
|
EVT_MENU(IDM_FLOAT_BREAKPOINTWINDOW, CFrame::OnFloatWindow)
|
|
|
|
EVT_MENU(IDM_FLOAT_MEMORYWINDOW, CFrame::OnFloatWindow)
|
|
|
|
EVT_MENU(IDM_FLOAT_JITWINDOW, CFrame::OnFloatWindow)
|
|
|
|
EVT_MENU(IDM_FLOAT_SOUNDWINDOW, CFrame::OnFloatWindow)
|
|
|
|
EVT_MENU(IDM_FLOAT_VIDEOWINDOW, CFrame::OnFloatWindow)
|
|
|
|
|
2009-05-13 21:50:24 +00:00
|
|
|
EVT_MENU(IDM_NETPLAY, CFrame::OnNetPlay)
|
2008-12-08 05:30:24 +00:00
|
|
|
EVT_MENU(IDM_BROWSE, CFrame::OnBrowse)
|
|
|
|
EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard)
|
2010-01-05 07:34:03 +00:00
|
|
|
EVT_MENU(IDM_IMPORTSAVE, CFrame::OnImportSave)
|
2008-12-08 05:30:24 +00:00
|
|
|
EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow)
|
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)
|
2010-01-08 21:57:31 +00:00
|
|
|
|
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-31 23:09:50 +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-06-06 07:36:22 +00:00
|
|
|
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)
|
2010-01-08 21:57:31 +00:00
|
|
|
EVT_MENU_RANGE(IDM_CONNECT_WIIMOTE1, IDM_CONNECT_WIIMOTE4, CFrame::OnConnectWiimote)
|
2010-01-11 05:07:56 +00:00
|
|
|
EVT_MENU_RANGE(IDM_LISTWAD, IDM_LISTDRIVES, CFrame::GameListChanged)
|
2009-01-04 21:53:41 +00:00
|
|
|
|
2009-09-03 05:24:30 +00:00
|
|
|
// Other
|
2009-12-30 09:00:43 +00:00
|
|
|
EVT_ACTIVATE(CFrame::OnActive)
|
2009-09-03 05:24:30 +00:00
|
|
|
EVT_CLOSE(CFrame::OnClose)
|
2008-12-12 03:38:50 +00:00
|
|
|
EVT_SIZE(CFrame::OnResize)
|
2010-01-18 18:01:03 +00:00
|
|
|
EVT_MOVE(CFrame::OnMove)
|
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)
|
2010-02-06 01:08:36 +00:00
|
|
|
#if wxUSE_TIMER
|
2009-09-03 05:24:30 +00:00
|
|
|
EVT_TIMER(wxID_ANY, CFrame::OnTimer)
|
2009-01-04 21:53:41 +00:00
|
|
|
#endif
|
2009-08-25 01:50:27 +00:00
|
|
|
|
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-09-05 04:50:45 +00:00
|
|
|
EVT_AUINOTEBOOK_TAB_RIGHT_UP(wxID_ANY, CFrame::OnTab)
|
2009-08-26 09:19:15 +00:00
|
|
|
|
2009-09-03 05:24:30 +00:00
|
|
|
// Post events to child panels
|
|
|
|
EVT_MENU(wxID_ANY, CFrame::PostEvent)
|
|
|
|
EVT_TEXT(wxID_ANY, CFrame::PostEvent)
|
|
|
|
//EVT_MENU_HIGHLIGHT_ALL(CFrame::PostMenuEvent)
|
|
|
|
//EVT_UPDATE_UI(wxID_ANY, CFrame::PostUpdateUIEvent)
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
END_EVENT_TABLE()
|
2009-01-05 04:08:18 +00:00
|
|
|
|
2009-09-03 07:56:35 +00:00
|
|
|
// ---------------
|
2009-09-01 12:44:02 +00:00
|
|
|
// Creation and close, quit functions
|
2009-09-01 13:06:37 +00:00
|
|
|
|
2009-09-01 14:33:16 +00:00
|
|
|
CFrame::CFrame(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,
|
2009-09-01 15:16:44 +00:00
|
|
|
bool ShowLogWindow,
|
2008-12-08 05:30:24 +00:00
|
|
|
long style)
|
2009-09-08 19:54:31 +00:00
|
|
|
: wxFrame(parent, id, title, pos, size, style)
|
|
|
|
, g_pCodeWindow(NULL)
|
|
|
|
, m_MenuBar(NULL)
|
2010-02-24 03:38:36 +00:00
|
|
|
, bRenderToMain(false), bNoWiimoteMsg(false)
|
2009-09-08 19:54:31 +00:00
|
|
|
, m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
|
2010-02-24 03:38:36 +00:00
|
|
|
, bFloatLogWindow(false), bFloatConsoleWindow(false)
|
2009-09-01 20:09:15 +00:00
|
|
|
, m_pStatusBar(NULL), m_GameListCtrl(NULL), m_Panel(NULL)
|
2010-02-24 03:38:36 +00:00
|
|
|
, m_LogWindow(NULL)
|
2009-09-06 18:45:22 +00:00
|
|
|
, UseDebugger(_UseDebugger), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false)
|
2010-02-25 06:12:35 +00:00
|
|
|
, m_bControlsCreated(false), m_StopDlg(NULL)
|
2010-02-06 01:08:36 +00:00
|
|
|
#if wxUSE_TIMER
|
|
|
|
#ifdef _WIN32
|
2010-02-04 21:50:02 +00:00
|
|
|
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
|
2010-02-06 01:08:36 +00:00
|
|
|
#endif
|
2009-01-04 21:53:41 +00:00
|
|
|
, m_timer(this)
|
|
|
|
#endif
|
2008-12-10 18:33:13 +00:00
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2009-09-01 15:16:44 +00:00
|
|
|
if (ShowLogWindow) SConfig::GetInstance().m_InterfaceLogWindow = true;
|
|
|
|
|
2009-09-01 14:33:16 +00:00
|
|
|
// Give it a console early to show potential messages from this onward
|
2009-08-27 15:53:19 +00:00
|
|
|
ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener();
|
2009-09-01 19:47:04 +00:00
|
|
|
if (SConfig::GetInstance().m_InterfaceConsole) Console->Open();
|
2009-09-05 04:50:45 +00:00
|
|
|
if (SConfig::GetInstance().m_InterfaceLogWindow) m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW);
|
2009-08-27 15:53:19 +00:00
|
|
|
|
2009-08-25 06:34:58 +00:00
|
|
|
// Start debugging mazimized
|
2009-09-06 18:54:20 +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-09-07 12:40:43 +00:00
|
|
|
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, IDM_CODEWINDOW);
|
2009-08-30 19:44:42 +00:00
|
|
|
g_pCodeWindow->Hide();
|
2009-08-30 22:04:30 +00:00
|
|
|
g_pCodeWindow->Load();
|
2009-09-07 12:40:43 +00:00
|
|
|
}
|
2009-08-25 01:50:27 +00:00
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
// Create timer
|
2010-02-06 01:08:36 +00:00
|
|
|
#if wxUSE_TIMER
|
2009-01-04 21:53:41 +00:00
|
|
|
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-09-01 13:06:37 +00:00
|
|
|
// ---------------
|
2009-09-01 12:44:02 +00:00
|
|
|
// Main panel
|
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-09-01 13:06:37 +00:00
|
|
|
// ---------------
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2009-09-01 19:47:04 +00:00
|
|
|
// Manager
|
2010-02-19 18:32:40 +00:00
|
|
|
// wxAUI_MGR_LIVE_RESIZE does not exist in the wxWidgets 2.8.9 that comes with Ubuntu 9.04
|
|
|
|
// Could just check for wxWidgets version if it becomes a problem.
|
2009-09-01 19:47:04 +00:00
|
|
|
m_Mgr = new wxAuiManager(this, wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE);
|
2009-09-08 08:47:33 +00:00
|
|
|
NOTEBOOK_STYLE = wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON | wxNO_BORDER;
|
2009-10-24 00:18:21 +00:00
|
|
|
TOOLBAR_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_TEXT /*wxAUI_TB_OVERFLOW overflow visible*/;
|
2010-02-24 03:38:36 +00:00
|
|
|
aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
|
2009-08-27 07:33:07 +00:00
|
|
|
|
2009-09-07 12:40:43 +00:00
|
|
|
if (g_pCodeWindow)
|
2009-08-30 19:44:42 +00:00
|
|
|
{
|
|
|
|
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-09-15 21:35:32 +00:00
|
|
|
m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo().Name(wxT("Pane 1")).Caption(wxT("Logging")).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-09-07 12:40:43 +00:00
|
|
|
if (g_pCodeWindow)
|
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
|
|
|
|
{
|
2010-02-24 03:38:36 +00:00
|
|
|
IniFile ini; int winpos;
|
2010-02-02 21:56:29 +00:00
|
|
|
ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
|
2010-02-24 03:38:36 +00:00
|
|
|
ini.Get("LogWindow", "pos", &winpos, 2);
|
2009-09-15 21:35:32 +00:00
|
|
|
|
2009-08-30 19:44:42 +00:00
|
|
|
m_Mgr->GetPane(wxT("Pane 0")).Show().PaneBorder(false).CaptionVisible(false).Layer(0).Center();
|
2009-09-15 21:35:32 +00:00
|
|
|
m_Mgr->GetPane(wxT("Pane 1")).Hide().PaneBorder(false).CaptionVisible(true).Layer(0)
|
2010-02-24 03:38:36 +00:00
|
|
|
.FloatingSize(wxSize(600, 350)).CloseButton(false).Direction(winpos);
|
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);
|
|
|
|
|
2009-08-31 05:56:30 +00:00
|
|
|
// Create list of available plugins for the configuration window
|
|
|
|
CPluginManager::GetInstance().ScanForPlugins();
|
|
|
|
|
2009-08-27 10:46:43 +00:00
|
|
|
// Setup perspectives
|
2009-09-07 12:40:43 +00:00
|
|
|
if (g_pCodeWindow)
|
2009-08-30 19:44:42 +00:00
|
|
|
{
|
2009-08-27 07:33:07 +00:00
|
|
|
// Load perspective
|
2009-09-01 07:32:07 +00:00
|
|
|
SaveLocal();
|
2009-08-31 05:56:30 +00:00
|
|
|
DoLoadPerspective();
|
2009-08-27 07:33:07 +00:00
|
|
|
}
|
|
|
|
else
|
2009-08-31 05:56:30 +00:00
|
|
|
{
|
|
|
|
SetSimplePaneSize();
|
2009-09-01 14:33:16 +00:00
|
|
|
if (SConfig::GetInstance().m_InterfaceLogWindow) DoToggleWindow(IDM_LOGWINDOW, true);
|
2009-08-31 05:56:30 +00:00
|
|
|
if (SConfig::GetInstance().m_InterfaceConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true);
|
|
|
|
}
|
2009-08-27 10:10:07 +00:00
|
|
|
|
2009-09-15 21:35:32 +00:00
|
|
|
// Show window
|
|
|
|
Show();
|
2008-12-08 05:30:24 +00:00
|
|
|
|
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-09-01 12:44:02 +00:00
|
|
|
// -------------------------
|
|
|
|
// Connect event handlers
|
2009-09-03 07:56:35 +00:00
|
|
|
|
2009-09-07 12:40:43 +00:00
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_SIZE, // Keyboard
|
|
|
|
wxSizeEventHandler(CFrame::OnResizeAll),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
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-09-06 13:36:05 +00:00
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_LEFT_DCLICK,
|
2009-09-05 04:50:45 +00:00
|
|
|
wxMouseEventHandler(CFrame::OnDoubleClick),
|
|
|
|
(wxObject*)0, this);
|
2010-02-05 14:37:32 +00:00
|
|
|
#ifdef _WIN32
|
2009-09-05 04:50:45 +00:00
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_MOTION,
|
|
|
|
wxMouseEventHandler(CFrame::OnMotion),
|
|
|
|
(wxObject*)0, this);
|
2010-02-04 21:50:02 +00:00
|
|
|
#endif
|
2009-09-01 12:44:02 +00:00
|
|
|
// ----------
|
2009-01-15 06:48:15 +00:00
|
|
|
|
2009-09-01 12:44:02 +00:00
|
|
|
// Update controls
|
2009-12-31 16:25:12 +00:00
|
|
|
m_bControlsCreated = true;
|
2008-12-08 05:30:24 +00:00
|
|
|
UpdateGUI();
|
2009-02-16 06:18:18 +00:00
|
|
|
|
2009-09-01 12:44:02 +00:00
|
|
|
//if we are ever going back to optional iso caching:
|
|
|
|
//m_GameListCtrl->Update(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache);
|
2010-02-19 20:41:40 +00:00
|
|
|
if (m_GameListCtrl) m_GameListCtrl->Update();
|
2009-08-31 20:26:11 +00:00
|
|
|
|
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();
|
2009-09-01 12:44:02 +00:00
|
|
|
// It's to early for the OnHostMessage(), we will update the status when Ctrl or Space is pressed
|
|
|
|
//Core::WriteStatus();
|
2009-02-16 06:18:18 +00:00
|
|
|
#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-12-31 16:25:12 +00:00
|
|
|
m_bControlsCreated = false;
|
|
|
|
|
2010-02-16 08:46:21 +00:00
|
|
|
drives.clear();
|
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 */
|
2010-02-06 01:08:36 +00:00
|
|
|
#if wxUSE_TIMER
|
2009-08-27 10:46:43 +00:00
|
|
|
if (m_timer.IsRunning()) m_timer.Stop();
|
|
|
|
#endif
|
2009-09-01 12:44:02 +00:00
|
|
|
|
|
|
|
ClosePages();
|
2010-02-16 04:34:41 +00:00
|
|
|
|
|
|
|
delete m_Mgr;
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2009-01-05 04:08:18 +00:00
|
|
|
void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
Close(true);
|
|
|
|
}
|
|
|
|
|
2010-03-08 23:29:16 +00:00
|
|
|
#if defined HAVE_X11 && HAVE_X11
|
2010-03-15 23:25:11 +00:00
|
|
|
void CFrame::X11_SendClientEvent(const char *message)
|
2010-03-08 23:29:16 +00:00
|
|
|
{
|
|
|
|
XEvent event;
|
|
|
|
Display *dpy = (Display *)Core::GetWindowHandle();
|
|
|
|
Window win = *(Window *)Core::GetXWindow();
|
|
|
|
|
|
|
|
// Init X event structure for client message
|
|
|
|
event.xclient.type = ClientMessage;
|
|
|
|
event.xclient.format = 32;
|
|
|
|
event.xclient.data.l[0] = XInternAtom(dpy, message, False);
|
|
|
|
|
|
|
|
// Send the event
|
|
|
|
if (!XSendEvent(dpy, win, False, False, &event))
|
|
|
|
ERROR_LOG(VIDEO, "Failed to send message %s to the emulator window.\n", message);
|
2010-03-15 23:25:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void X11_SendKeyEvent(int key)
|
|
|
|
{
|
|
|
|
XEvent event;
|
|
|
|
Display *dpy = (Display *)Core::GetWindowHandle();
|
|
|
|
Window win = *(Window *)Core::GetXWindow();
|
|
|
|
|
|
|
|
// Init X event structure for key press event
|
|
|
|
event.xkey.type = KeyPress;
|
|
|
|
// WARNING: This works for '3' to '7'. If in the future other keys are needed
|
|
|
|
// convert with InputCommon::wxCharCodeWXToX from X11InputBase.cpp.
|
|
|
|
event.xkey.keycode = XKeysymToKeycode(dpy, key);
|
|
|
|
|
|
|
|
// Send the event
|
|
|
|
if (!XSendEvent(dpy, win, False, False, &event))
|
|
|
|
ERROR_LOG(VIDEO, "Failed to send key press event to the emulator window.\n");
|
2010-03-08 23:29:16 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-09-03 07:56:35 +00:00
|
|
|
// --------
|
2009-09-01 15:16:44 +00:00
|
|
|
// Events
|
2009-12-30 09:00:43 +00:00
|
|
|
void CFrame::OnActive(wxActivateEvent& event)
|
|
|
|
{
|
2010-03-12 04:10:48 +00:00
|
|
|
#if defined(HAVE_X11) && HAVE_X11 && defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
2010-03-15 23:25:11 +00:00
|
|
|
if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)
|
|
|
|
{
|
|
|
|
if (event.GetActive())
|
|
|
|
X11_SendClientEvent("FOCUSIN");
|
|
|
|
else
|
|
|
|
X11_SendClientEvent("FOCUSOUT");
|
|
|
|
}
|
2010-03-08 23:29:16 +00:00
|
|
|
#endif
|
2009-12-30 09:00:43 +00:00
|
|
|
event.Skip();
|
|
|
|
}
|
2009-09-01 15:16:44 +00:00
|
|
|
|
2009-01-05 04:08:18 +00:00
|
|
|
void CFrame::OnClose(wxCloseEvent& event)
|
|
|
|
{
|
2010-01-23 06:15:17 +00:00
|
|
|
//Stop Dolphin from saving the minimized Xpos and Ypos
|
|
|
|
if(main_frame->IsIconized())
|
|
|
|
main_frame->Iconize(false);
|
|
|
|
|
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
|
2009-09-07 12:40:43 +00:00
|
|
|
if (g_pCodeWindow) Save();
|
2009-09-01 02:41:48 +00:00
|
|
|
// Uninit
|
|
|
|
m_Mgr->UnInit();
|
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-09-01 15:16:44 +00:00
|
|
|
// Post events
|
2009-09-01 07:32:07 +00:00
|
|
|
|
2009-09-01 15:16:44 +00:00
|
|
|
// Warning: This may cause an endless loop if the event is propagated back to its parent
|
|
|
|
void CFrame::PostEvent(wxCommandEvent& event)
|
2009-08-27 07:33:07 +00:00
|
|
|
{
|
2009-09-01 15:16:44 +00:00
|
|
|
if (g_pCodeWindow
|
|
|
|
&& event.GetId() >= IDM_INTERPRETER && event.GetId() <= IDM_ADDRBOX
|
2009-09-03 05:24:30 +00:00
|
|
|
//&& event.GetId() != IDM_JITUNLIMITED
|
2009-09-01 15:16:44 +00:00
|
|
|
)
|
2009-09-03 05:24:30 +00:00
|
|
|
{
|
|
|
|
event.StopPropagation();
|
2010-01-20 11:49:11 +00:00
|
|
|
g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
|
2009-09-03 05:24:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
event.Skip();
|
2009-08-31 05:56:30 +00:00
|
|
|
}
|
2009-09-01 15:16:44 +00:00
|
|
|
void CFrame::PostMenuEvent(wxMenuEvent& event)
|
2009-08-31 05:56:30 +00:00
|
|
|
{
|
2010-01-20 11:49:11 +00:00
|
|
|
if (g_pCodeWindow) g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
|
2009-08-31 05:56:30 +00:00
|
|
|
}
|
2009-09-01 15:16:44 +00:00
|
|
|
void CFrame::PostUpdateUIEvent(wxUpdateUIEvent& event)
|
2009-08-31 05:56:30 +00:00
|
|
|
{
|
2010-01-20 11:49:11 +00:00
|
|
|
if (g_pCodeWindow) g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
|
2009-08-31 05:56:30 +00:00
|
|
|
}
|
|
|
|
|
2010-01-18 18:01:03 +00:00
|
|
|
void CFrame::OnMove(wxMoveEvent& event)
|
|
|
|
{
|
|
|
|
event.Skip();
|
|
|
|
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.iPosX = GetPosition().x;
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.iPosY = GetPosition().y;
|
|
|
|
}
|
2010-03-08 23:29:16 +00:00
|
|
|
|
2009-09-07 12:40:43 +00:00
|
|
|
void CFrame::OnResize(wxSizeEvent& event)
|
|
|
|
{
|
|
|
|
event.Skip();
|
|
|
|
|
2010-01-18 18:01:03 +00:00
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth = GetSize().GetWidth();
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight = GetSize().GetHeight();
|
2009-09-07 12:40:43 +00:00
|
|
|
}
|
|
|
|
void CFrame::OnResizeAll(wxSizeEvent& event)
|
|
|
|
{
|
|
|
|
event.Skip();
|
2010-03-12 04:10:48 +00:00
|
|
|
#if defined(HAVE_X11) && HAVE_X11 && defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
|
|
|
if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)
|
2010-03-15 23:25:11 +00:00
|
|
|
X11_SendClientEvent("RESIZE");
|
2010-03-12 04:10:48 +00:00
|
|
|
#endif
|
2009-09-07 12:40:43 +00:00
|
|
|
//wxWindow * Win = (wxWindow*)event.GetEventObject();
|
|
|
|
//NOTICE_LOG(CONSOLE, "OnResizeAll: %i", (HWND)Win->GetHWND());
|
|
|
|
}
|
2009-08-31 05:56:30 +00:00
|
|
|
|
2009-09-01 12:44:02 +00:00
|
|
|
// Host messages
|
2009-09-01 13:06:37 +00:00
|
|
|
|
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:
|
2010-02-25 06:12:35 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
2010-02-25 06:12:35 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
2010-02-25 06:12:35 +00:00
|
|
|
return 0;
|
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
|
|
|
|
2010-02-06 01:08:36 +00:00
|
|
|
void CFrame::OnTimer(wxTimerEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
Update();
|
|
|
|
#else
|
|
|
|
// Process events in linux. Primarily to update the statusbar text.
|
|
|
|
// This should be unnecessary if we ever get WXGL and render to main working
|
|
|
|
if (wxGetApp().Pending())
|
|
|
|
wxGetApp().ProcessPendingEvents();
|
|
|
|
#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;
|
2010-02-07 02:41:02 +00:00
|
|
|
#if defined(HAVE_X11) && HAVE_X11
|
2010-03-15 23:25:11 +00:00
|
|
|
case WM_USER_CREATE:
|
|
|
|
bRenderToMain = true;
|
|
|
|
break;
|
|
|
|
case TOGGLE_FULLSCREEN:
|
|
|
|
DoFullscreen(!IsFullScreen());
|
|
|
|
break;
|
2010-02-07 02:41:02 +00:00
|
|
|
case WM_USER_STOP:
|
2010-03-15 23:25:11 +00:00
|
|
|
DoStop();
|
2010-02-07 06:07:56 +00:00
|
|
|
break;
|
2010-02-17 23:44:07 +00:00
|
|
|
case WM_USER_PAUSE:
|
2010-03-15 23:25:11 +00:00
|
|
|
DoPause();
|
2010-02-17 23:44:07 +00:00
|
|
|
break;
|
2010-02-07 02:41:02 +00:00
|
|
|
#endif
|
2010-02-07 06:07:56 +00:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2009-09-07 12:40:43 +00:00
|
|
|
void CFrame::OnCustomHostMessage(int Id)
|
|
|
|
{
|
|
|
|
wxWindow *Win;
|
|
|
|
|
|
|
|
switch(Id)
|
|
|
|
{
|
|
|
|
// Destroy windows
|
|
|
|
case AUDIO_DESTROY:
|
|
|
|
Win = GetWxWindow(wxT("Sound"));
|
|
|
|
if (Win)
|
|
|
|
{
|
|
|
|
DoRemovePage(Win, false);
|
|
|
|
|
|
|
|
CPluginManager::GetInstance().OpenDebug(
|
|
|
|
GetHandle(),
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
|
|
|
|
PLUGIN_TYPE_DSP, false
|
|
|
|
);
|
|
|
|
|
|
|
|
//Win->Reparent(NULL);
|
2009-09-07 13:33:40 +00:00
|
|
|
//g_pCodeWindow->OnToggleDLLWindow(false, 0);
|
2009-09-07 12:40:43 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_SOUNDWINDOW)->Check(false);
|
|
|
|
NOTICE_LOG(CONSOLE, "%s", Core::StopMessage(true, "Sound debugging window closed").c_str());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VIDEO_DESTROY:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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() &&
|
2009-09-25 16:29:00 +00:00
|
|
|
!((SConfig::GetInstance().m_ListGC &&
|
|
|
|
SConfig::GetInstance().m_ListWii &&
|
2009-06-09 05:08:58 +00:00
|
|
|
SConfig::GetInstance().m_ListWad) &&
|
2009-09-25 16:29:00 +00:00
|
|
|
(SConfig::GetInstance().m_ListJap &&
|
|
|
|
SConfig::GetInstance().m_ListUsa &&
|
2010-01-11 05:07:56 +00:00
|
|
|
SConfig::GetInstance().m_ListPal &&
|
|
|
|
SConfig::GetInstance().m_ListFrance &&
|
|
|
|
SConfig::GetInstance().m_ListItaly &&
|
|
|
|
SConfig::GetInstance().m_ListKorea &&
|
|
|
|
SConfig::GetInstance().m_ListTaiwan &&
|
|
|
|
SConfig::GetInstance().m_ListUnknown)))
|
2009-06-09 05:08:58 +00:00
|
|
|
{
|
2010-01-11 05:07:56 +00:00
|
|
|
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_ListFrance = SConfig::GetInstance().m_ListItaly =
|
|
|
|
SConfig::GetInstance().m_ListKorea = SConfig::GetInstance().m_ListTaiwan =
|
|
|
|
SConfig::GetInstance().m_ListUnknown= true;
|
2009-06-09 05:08:58 +00:00
|
|
|
|
|
|
|
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);
|
2010-01-11 05:07:56 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_LISTFRANCE)->Check(true);
|
|
|
|
GetMenuBar()->FindItem(IDM_LISTITALY)->Check(true);
|
|
|
|
GetMenuBar()->FindItem(IDM_LISTKOREA)->Check(true);
|
|
|
|
GetMenuBar()->FindItem(IDM_LISTTAIWAN)->Check(true);
|
|
|
|
GetMenuBar()->FindItem(IDM_LIST_UNK)->Check(true);
|
2009-06-09 05:08:58 +00:00
|
|
|
|
|
|
|
m_GameListCtrl->Update();
|
|
|
|
}
|
2010-01-18 12:10:51 +00:00
|
|
|
else
|
|
|
|
// Game started by double click
|
2010-01-22 21:41:25 +00:00
|
|
|
StartGame(std::string(""));
|
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-09-06 13:36:05 +00:00
|
|
|
// Toggle fullscreen
|
2010-02-08 09:57:52 +00:00
|
|
|
if (event.GetKeyCode() == WXK_RETURN && event.GetModifiers() == wxMOD_ALT)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2009-11-08 09:13:42 +00:00
|
|
|
DoFullscreen(!IsFullScreen());
|
2009-10-24 21:31:28 +00:00
|
|
|
|
|
|
|
// We do that to avoid the event to be double processed (which would cause the window to be stuck in fullscreen)
|
|
|
|
event.StopPropagation();
|
2009-04-28 23:47:18 +00:00
|
|
|
}
|
2010-02-08 09:57:52 +00:00
|
|
|
else if(event.GetKeyCode() == WXK_ESCAPE)
|
|
|
|
{
|
2010-02-09 00:34:27 +00:00
|
|
|
main_frame->DoPause();
|
2010-02-08 09:57:52 +00:00
|
|
|
}
|
2009-10-24 21:31:28 +00:00
|
|
|
// event.Skip() allows the event to propagate to the gamelist for example
|
|
|
|
else if (! (Core::GetState() == Core::CORE_RUN && bRenderToMain && event.GetEventObject() == this))
|
|
|
|
event.Skip();
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
#ifdef _WIN32
|
2009-09-06 15:39:06 +00:00
|
|
|
if(event.GetKeyCode() == 'M', '3', '4', '5', '6', '7') // Send this to the video plugin WndProc
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2009-11-15 07:46:43 +00:00
|
|
|
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, WM_USER_KEYDOWN, event.GetKeyCode());
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
2010-03-15 23:25:11 +00:00
|
|
|
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
|
|
|
if (event.GetKeyCode() >= '3' && event.GetKeyCode() <= '7') // Send this to the video plugin
|
|
|
|
{
|
|
|
|
X11_SendKeyEvent(event.GetKeyCode());
|
|
|
|
}
|
2009-02-16 06:18:18 +00:00
|
|
|
#endif
|
|
|
|
|
2010-03-15 23:25:11 +00:00
|
|
|
|
2009-02-16 06:18:18 +00:00
|
|
|
// 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
|
2008-12-28 18:50:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnKeyUp(wxKeyEvent& event)
|
|
|
|
{
|
2009-09-06 13:36:05 +00:00
|
|
|
event.Skip();
|
|
|
|
|
2008-12-28 18:50:24 +00:00
|
|
|
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-08 05:30:24 +00:00
|
|
|
}
|
2009-09-01 12:44:02 +00:00
|
|
|
|
2009-09-01 13:06:37 +00:00
|
|
|
// ---------------
|
2009-09-06 13:36:05 +00:00
|
|
|
// Detect double click
|
2009-09-01 13:06:37 +00:00
|
|
|
|
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
|
2009-09-06 13:36:05 +00:00
|
|
|
if (! (Core::GetState() == Core::CORE_RUN && bRenderToMain && event.GetEventObject() == m_Panel)) return;
|
2009-01-04 21:53:41 +00:00
|
|
|
|
2009-09-06 13:36:05 +00:00
|
|
|
DoFullscreen(!IsFullScreen());
|
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-09-01 13:06:37 +00:00
|
|
|
|
2010-02-04 21:50:02 +00:00
|
|
|
#if wxUSE_TIMER && defined _WIN32
|
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
|
|
|
MSWSetCursor(true);
|
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
|
|
|
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);
|
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
|
|
|
if(bRenderToMain) MSWSetCursor(true);
|
|
|
|
else PostMessage((HWND)Core::GetWindowHandle(), WM_USER, 10, 1);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
2009-01-15 06:48:15 +00:00
|
|
|
|
2009-01-04 21:53:41 +00:00
|
|
|
}
|
2010-02-04 21:50:02 +00:00
|
|
|
#endif
|
2009-01-04 21:53:41 +00:00
|
|
|
|
|
|
|
// Check for mouse status a couple of times per second for the auto hide option
|
2010-02-04 21:50:02 +00:00
|
|
|
#if wxUSE_TIMER && defined _WIN32
|
2009-01-04 21:53:41 +00:00
|
|
|
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-09-15 21:35:32 +00:00
|
|
|
if(m_iLastMotionTime < CompareTime) // Update cursor
|
|
|
|
MSWSetCursor(false);
|
2009-01-04 21:53:41 +00:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
2009-09-01 15:16:44 +00:00
|
|
|
#endif
|
|
|
|
|
2009-09-06 18:45:22 +00:00
|
|
|
|
2009-09-03 07:56:35 +00:00
|
|
|
// --------
|
2009-09-01 15:16:44 +00:00
|
|
|
// Functions
|
2009-09-03 07:56:35 +00:00
|
|
|
|
2009-09-06 18:45:22 +00:00
|
|
|
|
|
|
|
wxFrame * CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title, wxWindow * Child)
|
|
|
|
{
|
2009-09-07 12:40:43 +00:00
|
|
|
wxFrame * Frame = new wxFrame(this, Id, Title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE);
|
2009-09-06 18:45:22 +00:00
|
|
|
|
|
|
|
Child->Reparent(Frame);
|
|
|
|
Child->Show();
|
|
|
|
|
|
|
|
wxBoxSizer * m_MainSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
|
|
|
|
m_MainSizer->Add(Child, 1, wxEXPAND);
|
|
|
|
|
|
|
|
Frame->Connect(wxID_ANY, wxEVT_CLOSE_WINDOW,
|
|
|
|
wxCloseEventHandler(CFrame::OnFloatingPageClosed),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
|
|
|
|
if (Id == IDM_CONSOLEWINDOW_PARENT)
|
|
|
|
{
|
|
|
|
Frame->Connect(wxID_ANY, wxEVT_SIZE,
|
|
|
|
wxSizeEventHandler(CFrame::OnFloatingPageSize),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Main sizer
|
|
|
|
Frame->SetSizer( m_MainSizer );
|
|
|
|
// Minimum frame size
|
|
|
|
Frame->SetMinSize(wxSize(200, -1));
|
|
|
|
Frame->Show();
|
|
|
|
return Frame;
|
|
|
|
}
|
2009-09-05 04:50:45 +00:00
|
|
|
wxPanel* CFrame::CreateEmptyPanel(wxWindowID Id)
|
2009-09-01 15:16:44 +00:00
|
|
|
{
|
2009-09-05 04:50:45 +00:00
|
|
|
wxPanel* Panel = new wxPanel(this, Id);
|
2009-09-01 15:16:44 +00:00
|
|
|
return Panel;
|
|
|
|
}
|
|
|
|
wxAuiNotebook* CFrame::CreateEmptyNotebook()
|
|
|
|
{
|
2009-09-01 19:47:04 +00:00
|
|
|
wxAuiNotebook* NB = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, NOTEBOOK_STYLE);
|
2009-09-01 15:16:44 +00:00
|
|
|
return NB;
|
|
|
|
}
|
|
|
|
|
2009-09-06 13:36:05 +00:00
|
|
|
void CFrame::DoFullscreen(bool bF)
|
2009-09-01 15:16:44 +00:00
|
|
|
{
|
2009-11-08 09:13:42 +00:00
|
|
|
// Only switch this to fullscreen if we're rendering to main AND if we're running a game
|
|
|
|
// plus if a modal dialog is open, this will still process the keyboard events, and may cause
|
|
|
|
// the main window to become unresponsive, so we have to avoid that.
|
2010-03-15 23:25:11 +00:00
|
|
|
if ((Core::GetState() == Core::CORE_RUN) || (Core::GetState() == Core::CORE_PAUSE))
|
2009-09-01 15:16:44 +00:00
|
|
|
{
|
2010-03-15 23:25:11 +00:00
|
|
|
if (bRenderToMain)
|
2009-10-24 21:31:28 +00:00
|
|
|
{
|
2010-03-15 23:25:11 +00:00
|
|
|
ShowFullScreen(bF);
|
2009-10-24 21:31:28 +00:00
|
|
|
|
2010-03-15 23:25:11 +00:00
|
|
|
if (bF)
|
|
|
|
{
|
|
|
|
// Save the current mode before going to fullscreen
|
|
|
|
AuiCurrent = m_Mgr->SavePerspective();
|
|
|
|
m_Mgr->LoadPerspective(AuiFullscreen, true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Restore saved perspective
|
|
|
|
m_Mgr->LoadPerspective(AuiCurrent, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
// Show the cursor again, in case it was hidden
|
|
|
|
if (IsFullScreen())
|
|
|
|
{
|
|
|
|
MSWSetCursor(true);
|
|
|
|
}
|
|
|
|
#endif
|
2009-10-24 21:31:28 +00:00
|
|
|
}
|
|
|
|
#ifdef _WIN32
|
2010-03-15 23:25:11 +00:00
|
|
|
else // Post the message to the separate rendering window which will then handle it.
|
|
|
|
{
|
|
|
|
BringWindowToTop((HWND)Core::GetWindowHandle());
|
|
|
|
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, TOGGLE_FULLSCREEN, 0);
|
|
|
|
}
|
|
|
|
#elif defined HAVE_X11 && HAVE_X11
|
|
|
|
else // Send the event to the separate rendering window which will then handle it.
|
|
|
|
X11_SendClientEvent("TOGGLE_FULLSCREEN");
|
2009-10-24 21:31:28 +00:00
|
|
|
#endif
|
2010-03-15 23:25:11 +00:00
|
|
|
}
|
2009-09-05 04:50:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Debugging, show loose windows
|
|
|
|
void CFrame::ListChildren()
|
|
|
|
{
|
|
|
|
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
|
|
|
wxAuiNotebook * NB = NULL;
|
|
|
|
|
|
|
|
Console->Log(LogTypes::LNOTICE, "--------------------------------------------------------------------\n");
|
|
|
|
|
|
|
|
for (u32 i = 0; i < this->GetChildren().size(); i++)
|
|
|
|
{
|
|
|
|
wxWindow * Win = this->GetChildren().Item(i)->GetData();
|
|
|
|
Console->Log(LogTypes::LNOTICE, StringFromFormat(
|
|
|
|
"%i: %s (%s) :: %s", i,
|
|
|
|
(const char*)Win->GetName().mb_str(), (const char*)Win->GetLabel().mb_str(), (const char*)Win->GetParent()->GetName().mb_str()).c_str());
|
|
|
|
//if (Win->GetName().IsSameAs(wxT("control")))
|
|
|
|
if (Win->IsKindOf(CLASSINFO(wxAuiNotebook)))
|
|
|
|
{
|
|
|
|
NB = (wxAuiNotebook*)Win;
|
|
|
|
Console->Log(LogTypes::LNOTICE, StringFromFormat(" :: NB", (const char*)NB->GetName().mb_str()).c_str());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NB = NULL;
|
|
|
|
}
|
|
|
|
Console->Log(LogTypes::LNOTICE, StringFromFormat("\n").c_str());
|
|
|
|
|
|
|
|
Win = this->GetChildren().Item(i)->GetData();
|
|
|
|
for (u32 j = 0; j < Win->GetChildren().size(); j++)
|
|
|
|
{
|
|
|
|
Console->Log(LogTypes::LNOTICE, StringFromFormat(
|
|
|
|
" %i.%i: %s (%s) :: %s", i, j,
|
|
|
|
(const char*)Win->GetName().mb_str(), (const char*)Win->GetLabel().mb_str(), (const char*)Win->GetParent()->GetName().mb_str()).c_str());
|
|
|
|
if (NB)
|
|
|
|
{
|
|
|
|
if (j < NB->GetPageCount())
|
|
|
|
Console->Log(LogTypes::LNOTICE, StringFromFormat(" :: %s", (const char*)NB->GetPage(j)->GetName().mb_str()).c_str());
|
|
|
|
}
|
|
|
|
Console->Log(LogTypes::LNOTICE, StringFromFormat("\n").c_str());
|
|
|
|
|
|
|
|
/*
|
|
|
|
Win = this->GetChildren().Item(j)->GetData();
|
|
|
|
for (int k = 0; k < Win->GetChildren().size(); k++)
|
|
|
|
{
|
|
|
|
Console->Log(LogTypes::LNOTICE, StringFromFormat(
|
|
|
|
" %i.%i.%i: %s (%s) :: %s\n", i, j, k,
|
|
|
|
Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str());
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Console->Log(LogTypes::LNOTICE, "--------------------------------------------------------------------\n");
|
|
|
|
|
|
|
|
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
|
|
|
{
|
|
|
|
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
|
|
|
|
wxAuiNotebook * _NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
|
|
|
|
Console->Log(LogTypes::LNOTICE, StringFromFormat("%i: %s\n", i, (const char *)m_Mgr->GetAllPanes().Item(i).name.mb_str()).c_str());
|
|
|
|
|
|
|
|
for (u32 j = 0; j < _NB->GetPageCount(); j++)
|
|
|
|
{
|
|
|
|
Console->Log(LogTypes::LNOTICE, StringFromFormat("%i.%i: %s\n", i, j, (const char *)_NB->GetPageText(j).mb_str()).c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Console->Log(LogTypes::LNOTICE, "--------------------------------------------------------------------\n");
|
2009-09-07 12:40:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::ListTopWindows()
|
|
|
|
{
|
|
|
|
wxWindowList::const_iterator i;
|
|
|
|
int j = 0;
|
|
|
|
const wxWindowList::const_iterator end = wxTopLevelWindows.end();
|
|
|
|
|
|
|
|
for (i = wxTopLevelWindows.begin(); i != end; ++i)
|
|
|
|
{
|
|
|
|
wxTopLevelWindow * const Win = wx_static_cast(wxTopLevelWindow *, *i);
|
2009-09-07 21:37:27 +00:00
|
|
|
NOTICE_LOG(CONSOLE, "%i: %i %s", j, Win, (const char *)Win->GetTitle().mb_str());
|
2009-09-07 12:40:43 +00:00
|
|
|
/*
|
|
|
|
if ( win->ShouldPreventAppExit() )
|
|
|
|
{
|
|
|
|
// there remains at least one important TLW, don't exit
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
NOTICE_LOG(CONSOLE, "\n");
|
2010-03-08 23:29:16 +00:00
|
|
|
}
|