mirror of https://github.com/PCSX2/pcsx2.git
wxGui Branch: Added some console logging code (not yet finished). Can't really use wxWidgets built in version because it's not extensible (grr).
git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@875 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
e79c1c3cd4
commit
b3043d4c41
|
@ -0,0 +1,195 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2009 Pcsx2 Team
|
||||
*
|
||||
* 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "Misc.h"
|
||||
#include "ConsoleLogger.h"
|
||||
|
||||
#include <wx/file.h>
|
||||
#include <wx/textfile.h>
|
||||
|
||||
// This code was 'borrowed' from wxWidgets and then heavily modified to suite
|
||||
// our needs. I would have used some crafty subclassing instead except who
|
||||
// ever wrote the code of wxWidgets had a peculiar love of the 'private' keyword,
|
||||
// thus killing any possibility of subclassing in a useful manner.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// pass an uninitialized file object, the function will ask the user for the
|
||||
// filename and try to open it, returns true on success (file was opened),
|
||||
// false if file couldn't be opened/created and -1 if the file selection
|
||||
// dialog was canceled
|
||||
static bool OpenLogFile(wxFile& file, wxString& filename, wxWindow *parent)
|
||||
{
|
||||
filename = wxSaveFileSelector(wxT("log"), wxT("txt"), wxT("log.txt"), parent);
|
||||
if ( !filename ) return false; // canceled
|
||||
|
||||
if( wxFile::Exists(filename) )
|
||||
{
|
||||
bool bAppend = false;
|
||||
wxString strMsg;
|
||||
strMsg.Printf(wxT("Append log to file '%s' (choosing [No] will overwrite it)?"),
|
||||
filename.c_str());
|
||||
|
||||
switch ( wxMessageBox(strMsg, _t("Question"), wxICON_QUESTION | wxYES_NO | wxCANCEL) )
|
||||
{
|
||||
case wxYES:
|
||||
bAppend = true;
|
||||
break;
|
||||
|
||||
case wxNO:
|
||||
bAppend = false;
|
||||
break;
|
||||
|
||||
case wxCANCEL:
|
||||
return false;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "invalid message box return value" );
|
||||
}
|
||||
|
||||
return ( bAppend ) ?
|
||||
file.Open(filename, wxFile::write_append) :
|
||||
file.Create(filename, true /* overwrite */);
|
||||
}
|
||||
|
||||
return file.Create(filename);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
BEGIN_EVENT_TABLE(ConsoleLogFrame, wxFrame)
|
||||
// wxLogWindow menu events
|
||||
EVT_MENU(Menu_Close, ConsoleLogFrame::OnClose)
|
||||
EVT_MENU(Menu_Save, ConsoleLogFrame::OnSave)
|
||||
EVT_MENU(Menu_Clear, ConsoleLogFrame::OnClear)
|
||||
EVT_CLOSE(ConsoleLogFrame::OnCloseWindow)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
ConsoleLogFrame::ConsoleLogFrame(wxWindow *parent, const wxString& title) :
|
||||
wxFrame(parent, wxID_ANY, title),
|
||||
m_TextCtrl( *new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE |
|
||||
wxHSCROLL |
|
||||
#if !wxUSE_UNICODE
|
||||
wxTE_RICH |
|
||||
#endif
|
||||
wxTE_READONLY ) )
|
||||
{
|
||||
// wxTE_RICH note:
|
||||
// needed for Win32 to avoid 65Kb limit but it doesn't work well
|
||||
// when using RichEdit 2.0 which we always do in the Unicode build
|
||||
|
||||
m_TextCtrl.SetBackgroundColour( wxColor( 48, 48, 64 ) );
|
||||
|
||||
// create menu
|
||||
wxMenuBar *pMenuBar = new wxMenuBar;
|
||||
wxMenu *pMenu = new wxMenu;
|
||||
pMenu->Append(Menu_Save, _t("&Save..."), wxT("Save log contents to file"));
|
||||
pMenu->Append(Menu_Clear, _t("C&lear"), wxT("Clear the log contents"));
|
||||
pMenu->AppendSeparator();
|
||||
pMenu->Append(Menu_Close, _t("&Close"), wxT("Close this window"));
|
||||
|
||||
pMenuBar->Append(pMenu, _t("&Log"));
|
||||
SetMenuBar(pMenuBar);
|
||||
|
||||
// status bar for menu prompts
|
||||
CreateStatusBar();
|
||||
}
|
||||
|
||||
ConsoleLogFrame::~ConsoleLogFrame() { }
|
||||
|
||||
void ConsoleLogFrame::DoClose()
|
||||
{
|
||||
// instead of closing just hide the window to be able to Show() it later
|
||||
Show(false);
|
||||
}
|
||||
|
||||
void ConsoleLogFrame::OnClose(wxCommandEvent& WXUNUSED(event)) { DoClose(); }
|
||||
void ConsoleLogFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) { DoClose(); }
|
||||
|
||||
void ConsoleLogFrame::OnSave(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString filename;
|
||||
wxFile file;
|
||||
int rc = OpenLogFile( file, filename, this );
|
||||
if ( rc == -1 )
|
||||
{
|
||||
// canceled
|
||||
return;
|
||||
}
|
||||
|
||||
// retrieve text and save it
|
||||
// -------------------------
|
||||
int nLines = m_TextCtrl.GetNumberOfLines();
|
||||
for ( int nLine = 0; nLine < nLines; nLine++ )
|
||||
{
|
||||
if( !file.Write(m_TextCtrl.GetLineText(nLine) + wxTextFile::GetEOL()) )
|
||||
{
|
||||
wxLogError( wxT("Can't save log contents to file.") );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
wxLogStatus(this, wxT("Log saved to the file '%s'."), filename.c_str());
|
||||
}
|
||||
|
||||
void ConsoleLogFrame::OnClear(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_TextCtrl.Clear();
|
||||
}
|
||||
|
||||
static const wxTextAttr tbl_color_codes[] =
|
||||
{
|
||||
wxTextAttr( wxColor( 0, 0, 0 ) ),
|
||||
wxTextAttr( wxColor( 255, 0, 0 ) ),
|
||||
wxTextAttr( wxColor( 0,255, 0 ) ),
|
||||
wxTextAttr( wxColor( 255,255, 0 ) ),
|
||||
wxTextAttr( wxColor( 0, 0,255 ) ),
|
||||
wxTextAttr( wxColor( 0,255,255 ) ),
|
||||
wxTextAttr( wxColor( 255,255,255 ) )
|
||||
};
|
||||
|
||||
static const wxTextAttr color_default( wxColor( 192, 192, 192 ) );
|
||||
|
||||
void ConsoleLogFrame::SetColor( Console::Colors color )
|
||||
{
|
||||
m_TextCtrl.SetDefaultStyle( tbl_color_codes[(int)color] );
|
||||
}
|
||||
|
||||
void ConsoleLogFrame::ClearColor()
|
||||
{
|
||||
m_TextCtrl.SetDefaultStyle( color_default );
|
||||
}
|
||||
|
||||
void ConsoleLogFrame::Write( const wxChar* text )
|
||||
{
|
||||
// remove selection (WriteText is in fact ReplaceSelection)
|
||||
#ifdef __WXMSW__
|
||||
wxTextPos nLen = m_TextCtrl.GetLastPosition();
|
||||
m_TextCtrl.SetSelection(nLen, nLen);
|
||||
#endif // Windows
|
||||
|
||||
m_TextCtrl.AppendText( text );
|
||||
}
|
||||
|
||||
void ConsoleLogFrame::WriteLn( const wxChar* text )
|
||||
{
|
||||
Write( text );
|
||||
Write( "\n" );
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2009 Pcsx2 Team
|
||||
*
|
||||
* 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include "Misc.h"
|
||||
|
||||
class ConsoleLogFrame : public wxFrame, public NoncopyableObject
|
||||
{
|
||||
protected:
|
||||
wxTextCtrl& m_TextCtrl;
|
||||
|
||||
public:
|
||||
// ctor & dtor
|
||||
ConsoleLogFrame(wxWindow *pParent, const wxString& szTitle);
|
||||
virtual ~ConsoleLogFrame();
|
||||
|
||||
// menu callbacks
|
||||
virtual void OnClose(wxCommandEvent& event);
|
||||
virtual void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
virtual void OnSave (wxCommandEvent& event);
|
||||
virtual void OnClear(wxCommandEvent& event);
|
||||
|
||||
virtual void Write( const wxChar* text );
|
||||
virtual void WriteLn( const wxChar* text );
|
||||
|
||||
virtual void SetColor( Console::Colors color );
|
||||
virtual void ClearColor();
|
||||
|
||||
protected:
|
||||
// use standard ids for our commands!
|
||||
enum
|
||||
{
|
||||
Menu_Close = wxID_CLOSE,
|
||||
Menu_Save = wxID_SAVE,
|
||||
Menu_Clear = wxID_CLEAR
|
||||
};
|
||||
|
||||
// common part of OnClose() and OnCloseWindow()
|
||||
virtual void DoClose();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
|
@ -17,11 +17,12 @@
|
|||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "Misc.h"
|
||||
#include "frmMain.h"
|
||||
#include "frmGameFixes.h"
|
||||
#include "frmLogging.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
wxMenu* frmMain::MakeLanguagesMenu() const
|
||||
{
|
||||
wxMenu* menuLangs = new wxMenu();
|
||||
|
@ -82,34 +83,53 @@ void frmMain::PopulatePadMenu()
|
|||
m_menuPad.Append( Menu_Pad_Advanced, _T("Advanced..."), wxEmptyString, wxITEM_NORMAL );
|
||||
}
|
||||
|
||||
#define ConnectMenu( id, handler ) \
|
||||
Connect( id, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::handler) )
|
||||
|
||||
void frmMain::ConnectMenus()
|
||||
{
|
||||
// This just seems a bit more flexable & intuitive to me, if overly verbose.
|
||||
// This just seems a bit more flexible & intuitive to me, if overly verbose.
|
||||
|
||||
Connect( Menu_QuickBootCD, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_QuickBootCD_Click));
|
||||
Connect( Menu_FullBootCD, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_BootCD_Click));
|
||||
Connect( Menu_BootNoCD, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_BootNoCD_Click));
|
||||
ConnectMenu( Menu_QuickBootCD, Menu_QuickBootCD_Click );
|
||||
ConnectMenu( Menu_FullBootCD, Menu_BootCD_Click );
|
||||
ConnectMenu( Menu_BootNoCD, Menu_BootNoCD_Click );
|
||||
|
||||
Connect( Menu_RunELF, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_OpenELF_Click));
|
||||
Connect( Menu_Run_Exit, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_Exit_Click));
|
||||
ConnectMenu( Menu_RunELF, Menu_OpenELF_Click );
|
||||
ConnectMenu( Menu_Run_Exit, Menu_Exit_Click );
|
||||
|
||||
Connect( Menu_SuspendExec, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_Suspend_Click));
|
||||
Connect( Menu_ResumeExec, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_Resume_Click));
|
||||
Connect( Menu_Reset, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_Reset_Click));
|
||||
ConnectMenu( Menu_SuspendExec, Menu_Suspend_Click );
|
||||
ConnectMenu( Menu_ResumeExec, Menu_Resume_Click );
|
||||
ConnectMenu( Menu_Reset, Menu_Reset_Click );
|
||||
|
||||
Connect( Menu_State_LoadOther, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_LoadStateOther_Click));
|
||||
Connect( Menu_State_SaveOther, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_SaveStateOther_Click));
|
||||
ConnectMenu( Menu_State_LoadOther, Menu_LoadStateOther_Click );
|
||||
ConnectMenu( Menu_State_SaveOther, Menu_SaveStateOther_Click );
|
||||
|
||||
Connect( Menu_Config_Gamefixes, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_Gamefixes_Click));
|
||||
ConnectMenu( Menu_Config_Gamefixes, Menu_Gamefixes_Click );
|
||||
|
||||
Connect( Menu_Debug_Open, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_Debug_Open_Click));
|
||||
Connect( Menu_Debug_MemoryDump, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_Debug_MemoryDump_Click));
|
||||
Connect( Menu_Debug_Logging, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::Menu_Debug_Logging_Click));
|
||||
ConnectMenu( Menu_Debug_Open, Menu_Debug_Open_Click );
|
||||
ConnectMenu( Menu_Debug_MemoryDump, Menu_Debug_MemoryDump_Click );
|
||||
ConnectMenu( Menu_Debug_Logging, Menu_Debug_Logging_Click );
|
||||
|
||||
ConnectMenu( Menu_Console, Menu_ShowConsole );
|
||||
}
|
||||
|
||||
void frmMain::OnLogBoxShown()
|
||||
{
|
||||
newConfig.ConLogBox.Show = true;
|
||||
m_MenuItem_Console.Check( true );
|
||||
}
|
||||
|
||||
void frmMain::OnLogBoxHidden()
|
||||
{
|
||||
newConfig.ConLogBox.Show = false;
|
||||
m_MenuItem_Console.Check( false );
|
||||
}
|
||||
|
||||
frmMain::frmMain(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
|
||||
wxFrame(parent, id, title, pos, size, wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxBORDER_THEME),
|
||||
|
||||
m_logbox( *new ConsoleLogFrame( this, "Pcsx2 Log" ) ),
|
||||
|
||||
m_menubar( *new wxMenuBar() ),
|
||||
m_statusbar( *CreateStatusBar(2, 0) ),
|
||||
m_background( *new wxStaticBitmap(this, wxID_ANY, wxBitmap(_T("./pcsxAbout.png"), wxBITMAP_TYPE_PNG) ) ),
|
||||
|
@ -124,9 +144,55 @@ frmMain::frmMain(wxWindow* parent, int id, const wxString& title, const wxPoint&
|
|||
m_menuDebug( *new wxMenu() ),
|
||||
|
||||
m_LoadStatesSubmenu( *MakeStatesSubMenu( Menu_State_Load01 ) ),
|
||||
m_SaveStatesSubmenu( *MakeStatesSubMenu( Menu_State_Save01 ) )
|
||||
m_SaveStatesSubmenu( *MakeStatesSubMenu( Menu_State_Save01 ) ),
|
||||
|
||||
m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, Menu_Console, _T("Show Console"), wxEmptyString, wxITEM_CHECK ) )
|
||||
{
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Initial menubar setup. This needs to be done first so that the menu bar's visible size
|
||||
// can be factored into the window size (which ends up being background+status+menus)
|
||||
|
||||
m_menubar.Append( &m_menuRun, _T("Run" ));
|
||||
m_menubar.Append( &m_menuConfig, _T("Config" ));
|
||||
m_menubar.Append( &m_menuVideo, _T("Video" ));
|
||||
m_menubar.Append( &m_menuAudio, _T("Audio" ));
|
||||
m_menubar.Append( &m_menuPad, _T("Pad" ));
|
||||
m_menubar.Append( &m_menuMisc, _T("Misc" ));
|
||||
m_menubar.Append( &m_menuDebug, _T("Debug" ));
|
||||
SetMenuBar( &m_menubar );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
wxSize backsize( m_background.GetSize() );
|
||||
|
||||
SetTitle(_t("Pcsx2"));
|
||||
SetIcon( wxIcon( wxT("./cdrom02.png"), wxBITMAP_TYPE_PNG ) );
|
||||
int m_statusbar_widths[] = { (int)(backsize.GetWidth()*0.73), (int)(backsize.GetWidth()*0.25) };
|
||||
m_statusbar.SetStatusWidths(2, m_statusbar_widths);
|
||||
m_statusbar.SetStatusText( _T("The Status is Good!"), 0);
|
||||
m_statusbar.SetStatusText( _T("Good Status"), 1);
|
||||
|
||||
wxBoxSizer& joe( *new wxBoxSizer( wxVERTICAL ) );
|
||||
joe.Add( &m_background );
|
||||
SetSizerAndFit( &joe );
|
||||
|
||||
if( newConfig.MainGuiPosition == wxDefaultPosition )
|
||||
newConfig.MainGuiPosition = GetPosition();
|
||||
else
|
||||
SetPosition( newConfig.MainGuiPosition );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Sort out the console log window position (must be done after fitting the window
|
||||
// sizer, to ensure correct 'docked mode' positioning).
|
||||
|
||||
if( newConfig.ConLogBox.DisplayArea == wxRectUnspecified )
|
||||
newConfig.ConLogBox.DisplayArea =
|
||||
wxRect( GetPosition() + wxSize( GetSize().x, 0 ), wxSize( 540, 540 ) );
|
||||
|
||||
m_logbox.SetSize( newConfig.ConLogBox.DisplayArea );
|
||||
m_logbox.Show( newConfig.ConLogBox.Show );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
m_menuRun.Append(Menu_QuickBootCD, _T("Boot CDVD (Quick)"), wxEmptyString, wxITEM_NORMAL);
|
||||
|
@ -166,7 +232,7 @@ frmMain::frmMain(wxWindow* parent, int id, const wxString& title, const wxPoint&
|
|||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
m_menuMisc.Append(Menu_Console, _T("Enable Console"), wxEmptyString, wxITEM_CHECK);
|
||||
m_menuMisc.Append( &m_MenuItem_Console );
|
||||
m_menuMisc.Append(Menu_Patches, _T("Enable Patches"), wxEmptyString, wxITEM_CHECK);
|
||||
m_menuMisc.Append(Menu_Profiler,_T("Enable Profiler"), wxEmptyString, wxITEM_CHECK);
|
||||
m_menuMisc.AppendSeparator();
|
||||
|
@ -185,23 +251,13 @@ frmMain::frmMain(wxWindow* parent, int id, const wxString& title, const wxPoint&
|
|||
m_menuMisc.Append(Menu_Website, _T("Pcsx2 Website..."), _T("Opens your web-browser!"), wxITEM_NORMAL);
|
||||
|
||||
|
||||
m_menuDebug.Append(Menu_Debug_Open, _T("Open Debug Window..."), wxEmptyString, wxITEM_NORMAL);
|
||||
m_menuDebug.Append(Menu_Debug_MemoryDump, _T("Memory Dump..."), wxEmptyString, wxITEM_NORMAL);
|
||||
m_menuDebug.Append(Menu_Debug_Open, _T("Open Debug Window..."), wxEmptyString, wxITEM_NORMAL);
|
||||
m_menuDebug.Append(Menu_Debug_MemoryDump, _T("Memory Dump..."), wxEmptyString, wxITEM_NORMAL);
|
||||
m_menuDebug.Append(Menu_Debug_Logging, _T("Logging..."), wxEmptyString, wxITEM_NORMAL);
|
||||
|
||||
m_menubar.Append( &m_menuRun, _T("Run" ));
|
||||
m_menubar.Append( &m_menuConfig, _T("Config" ));
|
||||
m_menubar.Append( &m_menuVideo, _T("Video" ));
|
||||
m_menubar.Append( &m_menuAudio, _T("Audio" ));
|
||||
m_menubar.Append( &m_menuPad, _T("Pad" ));
|
||||
m_menubar.Append( &m_menuMisc, _T("Misc" ));
|
||||
m_menubar.Append( &m_menuDebug, _T("Debug" ));
|
||||
|
||||
SetMenuBar( &m_menubar );
|
||||
ConnectMenus();
|
||||
// The many other fancy portions of our main window!
|
||||
|
||||
set_properties();
|
||||
|
||||
m_MenuItem_Console.Check( newConfig.ConLogBox.Show );
|
||||
}
|
||||
|
||||
void frmMain::Menu_QuickBootCD_Click(wxCommandEvent &event)
|
||||
|
@ -266,23 +322,7 @@ void frmMain::Menu_Debug_Logging_Click(wxCommandEvent &event)
|
|||
joe.ShowModal();
|
||||
}
|
||||
|
||||
void frmMain::set_properties()
|
||||
void frmMain::Menu_ShowConsole(wxCommandEvent &event)
|
||||
{
|
||||
wxSize backsize( m_background.GetSize() );
|
||||
|
||||
SetTitle(_("Pcsx2"));
|
||||
wxIcon _icon( _T("./cdrom02.png"), wxBITMAP_TYPE_PNG );
|
||||
SetIcon(_icon);
|
||||
SetClientSize( backsize );
|
||||
int m_statusbar_widths[] = { (int)(backsize.GetWidth()*0.73), (int)(backsize.GetWidth()*0.25) };
|
||||
m_statusbar.SetStatusWidths(2, m_statusbar_widths);
|
||||
m_statusbar.SetStatusText( _T("The Status is Good!"), 0);
|
||||
m_statusbar.SetStatusText( _T("Good Status"), 1);
|
||||
|
||||
wxBoxSizer& joe( *new wxBoxSizer( wxVERTICAL ) );
|
||||
|
||||
joe.Add( &m_background );
|
||||
SetSizerAndFit( &joe );
|
||||
|
||||
//Layout();
|
||||
}
|
||||
m_logbox.Show( event.IsChecked() );
|
||||
}
|
|
@ -21,11 +21,51 @@
|
|||
#include <wx/wx.h>
|
||||
#include <wx/image.h>
|
||||
|
||||
#include "Misc.h"
|
||||
#include "ConsoleLogger.h"
|
||||
|
||||
struct wxPcsx2Config
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool Show;
|
||||
wxRect DisplayArea;
|
||||
} ConLogBox;
|
||||
|
||||
wxPoint MainGuiPosition;
|
||||
};
|
||||
|
||||
extern wxPcsx2Config newConfig;
|
||||
|
||||
extern const wxRect wxRectUnspecified;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class LogWindow : public wxLogWindow
|
||||
{
|
||||
public:
|
||||
LogWindow(wxWindow *pParent, const wxChar *szTitle );
|
||||
|
||||
protected:
|
||||
// Implemented to ensure that the parent's menu option for log visibility is consistent with
|
||||
// the current status of the log window.
|
||||
virtual void OnFrameCreate(wxFrame *frame);
|
||||
|
||||
// Implemented to ensure that the parent's menu option for log visibility is consistent with
|
||||
// the current status of the log window.
|
||||
virtual bool OnFrameClose(wxFrame *frame);
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class frmMain: public wxFrame
|
||||
{
|
||||
public:
|
||||
frmMain(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE);
|
||||
|
||||
void OnLogBoxShown();
|
||||
void OnLogBoxHidden();
|
||||
|
||||
protected:
|
||||
|
||||
enum Identifiers
|
||||
|
@ -116,14 +156,12 @@ protected:
|
|||
void PopulatePadMenu();
|
||||
void ConnectMenus();
|
||||
|
||||
private:
|
||||
void set_properties();
|
||||
|
||||
protected:
|
||||
ConsoleLogFrame& m_logbox;
|
||||
wxMenuBar& m_menubar;
|
||||
wxStatusBar& m_statusbar;
|
||||
wxStaticBitmap& m_background;
|
||||
|
||||
|
||||
wxMenu& m_menuRun;
|
||||
wxMenu& m_menuConfig;
|
||||
wxMenu& m_menuMisc;
|
||||
|
@ -135,11 +173,13 @@ protected:
|
|||
|
||||
wxMenu& m_LoadStatesSubmenu;
|
||||
wxMenu& m_SaveStatesSubmenu;
|
||||
|
||||
wxMenuItem& m_MenuItem_Console;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Menu Options for the Main Window! :D
|
||||
|
||||
public:
|
||||
protected:
|
||||
void Menu_QuickBootCD_Click(wxCommandEvent &event);
|
||||
void Menu_BootCD_Click(wxCommandEvent &event);
|
||||
void Menu_BootNoCD_Click(wxCommandEvent &event);
|
||||
|
@ -158,6 +198,8 @@ public:
|
|||
void Menu_Debug_Open_Click(wxCommandEvent &event);
|
||||
void Menu_Debug_MemoryDump_Click(wxCommandEvent &event);
|
||||
void Menu_Debug_Logging_Click(wxCommandEvent &event);
|
||||
|
||||
void Menu_ShowConsole(wxCommandEvent &event);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -31,9 +31,17 @@ public:
|
|||
|
||||
IMPLEMENT_APP(Pcsx2GUI)
|
||||
|
||||
const wxRect wxRectUnspecified( wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord );
|
||||
wxPcsx2Config newConfig;
|
||||
|
||||
bool Pcsx2GUI::OnInit()
|
||||
{
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
newConfig.ConLogBox.Show = true;
|
||||
newConfig.ConLogBox.DisplayArea = wxRectUnspecified;
|
||||
newConfig.MainGuiPosition = wxDefaultPosition;
|
||||
|
||||
frmMain* frameMain = new frmMain( NULL, wxID_ANY, wxEmptyString );
|
||||
SetTopWindow( frameMain );
|
||||
frameMain->Show();
|
||||
|
|
|
@ -2912,6 +2912,14 @@
|
|||
RelativePath="..\..\NewGUI\CheckedStaticBox.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\NewGUI\ConsoleLogger.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\NewGUI\ConsoleLogger.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\NewGUI\frmGameFixes.cpp"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue