mirror of https://github.com/PCSX2/pcsx2.git
Added a new CheckedStaticBox panel, which is something I like to use a lot (semi-working test use in frmLogging).
git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@846 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
376b694baa
commit
5cfb4e6e49
|
@ -205,7 +205,6 @@ extern bool SrcLog_GPU( const char* fmt, ... );
|
||||||
#define PSXDMA_LOG 0&&
|
#define PSXDMA_LOG 0&&
|
||||||
|
|
||||||
#define PAD_LOG 0&&
|
#define PAD_LOG 0&&
|
||||||
#define GTE_LOG 0&&
|
|
||||||
#define CDR_LOG 0&&
|
#define CDR_LOG 0&&
|
||||||
#define GPU_LOG 0&&
|
#define GPU_LOG 0&&
|
||||||
#define PSXCNT_LOG 0&&
|
#define PSXCNT_LOG 0&&
|
||||||
|
|
|
@ -22,60 +22,88 @@
|
||||||
|
|
||||||
#include <wx/statline.h>
|
#include <wx/statline.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace wxHelpers;
|
using namespace wxHelpers;
|
||||||
|
|
||||||
|
//wxString frmLogging::m_DisasmWarning( "\nWarning: Disasm dumps are incredibly slow, and generate extremely large logfiles." );
|
||||||
|
|
||||||
|
frmLogging::eeLogOptionsPanel::eeLogOptionsPanel( wxWindow* parent ) :
|
||||||
|
CheckedStaticBox( parent, wxHORIZONTAL, "EE Logs" )
|
||||||
|
{
|
||||||
|
wxStaticBoxSizer& eeDisasm = *new wxStaticBoxSizer( wxVERTICAL, this, _T("Disasm") );
|
||||||
|
wxStaticBoxSizer& eeHw = *new wxStaticBoxSizer( wxVERTICAL, this, _T("Hardware") );
|
||||||
|
|
||||||
|
wxBoxSizer& eeStack = *new wxBoxSizer( wxVERTICAL );
|
||||||
|
wxBoxSizer& eeMisc = *new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
//wxToolTip
|
||||||
|
wxHelpers::AddCheckBox( this, eeDisasm,_T("Core"), EE_CPU_LOG );
|
||||||
|
wxHelpers::AddCheckBox( this, eeDisasm,_T("Fpu"), EE_FPU_LOG );
|
||||||
|
wxHelpers::AddCheckBox( this, eeDisasm,_T("VU0"), EE_VU0_LOG );
|
||||||
|
wxHelpers::AddCheckBox( this, eeDisasm,_T("Cop0"), EE_COP0_LOG );
|
||||||
|
wxHelpers::AddCheckBox( this, eeDisasm,_T("VU Macro"), EE_VU_MACRO_LOG );
|
||||||
|
|
||||||
|
wxHelpers::AddCheckBox( this, eeMisc, _T("Memory"), EE_MEM_LOG );
|
||||||
|
wxHelpers::AddCheckBox( this, eeMisc, _T("Bios"), EE_BIOS_LOG );
|
||||||
|
wxHelpers::AddCheckBox( this, eeMisc, _T("Elf"), EE_ELF_LOG );
|
||||||
|
|
||||||
|
wxHelpers::AddCheckBox( this, eeHw, _T("Registers"),EE_HW_LOG );
|
||||||
|
wxHelpers::AddCheckBox( this, eeHw, _T("Dma"), EE_DMA_LOG );
|
||||||
|
wxHelpers::AddCheckBox( this, eeHw, _T("Vif"), EE_VIF_LOG );
|
||||||
|
wxHelpers::AddCheckBox( this, eeHw, _T("SPR"), EE_SPR_LOG );
|
||||||
|
wxHelpers::AddCheckBox( this, eeHw, _T("GIF"), EE_GIF_LOG );
|
||||||
|
wxHelpers::AddCheckBox( this, eeHw, _T("Sif"), EE_SIF_LOG );
|
||||||
|
wxHelpers::AddCheckBox( this, eeHw, _T("IPU"), EE_IPU_LOG );
|
||||||
|
wxHelpers::AddCheckBox( this, eeHw, _T("RPC"), EE_RPC_LOG );
|
||||||
|
|
||||||
|
// Sizer hierarchy:
|
||||||
|
|
||||||
|
eeStack.Add( &eeDisasm, stdSpacingFlags );
|
||||||
|
eeStack.Add( &eeMisc );
|
||||||
|
|
||||||
|
BoxSizer.Add( &eeHw, stdSpacingFlags );
|
||||||
|
BoxSizer.Add( &eeStack );
|
||||||
|
|
||||||
|
SetSizerAndFit( &BoxSizer, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
frmLogging::frmLogging(wxWindow* parent, int id, const wxPoint& pos, const wxSize& size):
|
frmLogging::frmLogging(wxWindow* parent, int id, const wxPoint& pos, const wxSize& size):
|
||||||
wxDialogWithHelpers( parent, id, _T("Logging"), pos, size )
|
wxDialogWithHelpers( parent, id, _T("Logging"), true, pos, size )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
wxStaticBox* mainbox = new wxStaticBox( this, -1, wxEmptyString);
|
|
||||||
wxBoxSizer *mainsizer = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
|
|
||||||
wxStaticBoxSizer& eeDisasm = *new wxStaticBoxSizer( wxVERTICAL, this, _T("EE Disasm") );
|
//wxStaticBoxSizer& eeBox = *new wxStaticBoxSizer( wxHORIZONTAL, this );
|
||||||
wxStaticBoxSizer& eeHw = *new wxStaticBoxSizer( wxVERTICAL, this, _T("EE Hardware") );
|
|
||||||
|
|
||||||
AddCheckBox( eeDisasm, _T("Core"), EE_CPU_LOG );
|
eeLogOptionsPanel& eeBox = *new eeLogOptionsPanel( this );
|
||||||
AddCheckBox( eeDisasm, _T("Memory"), EE_MEM_LOG );
|
|
||||||
AddCheckBox( eeDisasm, _T("Bios"), EE_BIOS_LOG );
|
|
||||||
AddCheckBox( eeDisasm, _T("Elf"), EE_ELF_LOG );
|
|
||||||
AddCheckBox( eeDisasm, _T("Fpu"), EE_FPU_LOG );
|
|
||||||
AddCheckBox( eeDisasm, _T("VU0"), EE_VU0_LOG );
|
|
||||||
AddCheckBox( eeDisasm, _T("Cop0"), EE_COP0_LOG );
|
|
||||||
AddCheckBox( eeDisasm, _T("VU Macro"), EE_VU_MACRO_LOG );
|
|
||||||
|
|
||||||
AddCheckBox( eeHw, _T("Registers"), EE_HW_LOG );
|
wxStaticBoxSizer& iopSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _T("IOP Logs") );
|
||||||
AddCheckBox( eeHw, _T("Dma"), EE_DMA_LOG );
|
|
||||||
AddCheckBox( eeHw, _T("Vif"), EE_VIF_LOG );
|
|
||||||
AddCheckBox( eeHw, _T("SPR"), EE_SPR_LOG );
|
|
||||||
AddCheckBox( eeHw, _T("GIF"), EE_GIF_LOG );
|
|
||||||
AddCheckBox( eeHw, _T("Sif"), EE_SIF_LOG );
|
|
||||||
AddCheckBox( eeHw, _T("IPU"), EE_IPU_LOG );
|
|
||||||
AddCheckBox( eeHw, _T("RPC"), EE_RPC_LOG );
|
|
||||||
|
|
||||||
wxStaticBox* iopbox = new wxStaticBox( this, -1, _T("IOP Logs"));
|
AddCheckBox( iopSizer, _T("Disasm"), IOP_IOP_LOG );
|
||||||
wxStaticBoxSizer& iopSizer = *new wxStaticBoxSizer( iopbox, wxVERTICAL );
|
AddCheckBox( iopSizer, _T("Memory"), IOP_MEM_LOG );
|
||||||
AddCheckBox( iopSizer, _T("IOP Log"), IOP_IOP_LOG );
|
AddCheckBox( iopSizer, _T("Bios"), IOP_BIOS_LOG );
|
||||||
AddCheckBox( iopSizer, _T("Mem Log"), IOP_MEM_LOG );
|
AddCheckBox( iopSizer, _T("Registers"), IOP_HW_LOG);
|
||||||
AddCheckBox( iopSizer, _T("Hw Log"), IOP_HW_LOG);
|
AddCheckBox( iopSizer, _T("Dma"), IOP_DMA_LOG );
|
||||||
AddCheckBox( iopSizer, _T("Bios Log"), IOP_BIOS_LOG );
|
AddCheckBox( iopSizer, _T("Pad"), IOP_PAD_LOG );
|
||||||
AddCheckBox( iopSizer, _T("Dma Log"), IOP_DMA_LOG );
|
AddCheckBox( iopSizer, _T("Cdrom"), IOP_CDR_LOG );
|
||||||
AddCheckBox( iopSizer, _T("Pad Log"), IOP_PAD_LOG );
|
AddCheckBox( iopSizer, _T("GPU (PSX)"), IOP_GPU_LOG );
|
||||||
AddCheckBox( iopSizer, _T("Gte Log"), IOP_GTE_LOG );
|
|
||||||
AddCheckBox( iopSizer, _T("Cdr Log"), IOP_CDR_LOG );
|
|
||||||
AddCheckBox( iopSizer, _T("GPU Log"), IOP_GPU_LOG );
|
|
||||||
|
|
||||||
wxStaticBox* miscbox = new wxStaticBox( this, -1, _T("Misc"));
|
wxStaticBoxSizer& miscSizer = *new wxStaticBoxSizer( wxHORIZONTAL, this, _T("Misc") );
|
||||||
wxStaticBoxSizer& miscSizer = *new wxStaticBoxSizer( miscbox, wxVERTICAL );
|
|
||||||
AddCheckBox( miscSizer, _T("Log to STDOUT"), STDOUT_LOG );
|
AddCheckBox( miscSizer, _T("Log to STDOUT"), STDOUT_LOG );
|
||||||
AddCheckBox( miscSizer, _T("SYMs Log"), SYMS_LOG );
|
AddCheckBox( miscSizer, _T("SYMs Log"), SYMS_LOG );
|
||||||
|
|
||||||
mainsizer->Add( &eeDisasm, stdSpacingFlags );
|
wxBoxSizer& mainsizer = *new wxBoxSizer( wxVERTICAL );
|
||||||
mainsizer->Add( &eeHw, stdSpacingFlags );
|
wxBoxSizer& topSizer = *new wxBoxSizer( wxHORIZONTAL );
|
||||||
mainsizer->Add( &iopSizer, stdSpacingFlags );
|
|
||||||
mainsizer->Add( &miscSizer, stdSpacingFlags );
|
|
||||||
|
|
||||||
SetSizerAndFit( mainsizer, true );
|
topSizer.Add( &eeBox, stdSpacingFlags );
|
||||||
|
topSizer.Add( &iopSizer, stdSpacingFlags );
|
||||||
|
|
||||||
|
mainsizer.Add( &topSizer ); // topsizer has it's own padding.
|
||||||
|
mainsizer.Add( &miscSizer, stdSpacingFlags );
|
||||||
|
|
||||||
|
AddOkCancel( mainsizer );
|
||||||
|
|
||||||
|
SetSizerAndFit( &mainsizer, true );
|
||||||
|
|
||||||
// Connect all the checkboxes to one function, and pass the checkbox id as user data.
|
// Connect all the checkboxes to one function, and pass the checkbox id as user data.
|
||||||
// (user data pointer isn't actually a pointer, but instead just the checkbox id)
|
// (user data pointer isn't actually a pointer, but instead just the checkbox id)
|
||||||
|
|
|
@ -30,7 +30,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// DECLARE_EVENT_TABLE();
|
|
||||||
enum {
|
enum {
|
||||||
EE_CPU_LOG = 100,
|
EE_CPU_LOG = 100,
|
||||||
EE_MEM_LOG,
|
EE_MEM_LOG,
|
||||||
|
@ -39,7 +38,6 @@ protected:
|
||||||
EE_BIOS_LOG,
|
EE_BIOS_LOG,
|
||||||
EE_ELF_LOG,
|
EE_ELF_LOG,
|
||||||
EE_FPU_LOG,
|
EE_FPU_LOG,
|
||||||
EE_MMI_LOG,
|
|
||||||
EE_VU0_LOG,
|
EE_VU0_LOG,
|
||||||
EE_COP0_LOG,
|
EE_COP0_LOG,
|
||||||
EE_VIF_LOG,
|
EE_VIF_LOG,
|
||||||
|
@ -56,7 +54,6 @@ protected:
|
||||||
IOP_BIOS_LOG,
|
IOP_BIOS_LOG,
|
||||||
IOP_DMA_LOG,
|
IOP_DMA_LOG,
|
||||||
IOP_PAD_LOG,
|
IOP_PAD_LOG,
|
||||||
IOP_GTE_LOG,
|
|
||||||
IOP_CDR_LOG,
|
IOP_CDR_LOG,
|
||||||
IOP_GPU_LOG,
|
IOP_GPU_LOG,
|
||||||
|
|
||||||
|
@ -64,6 +61,17 @@ protected:
|
||||||
SYMS_LOG
|
SYMS_LOG
|
||||||
} LogChecks;
|
} LogChecks;
|
||||||
|
|
||||||
|
class eeLogOptionsPanel : public CheckedStaticBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
eeLogOptionsPanel( wxWindow* parent );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void LogChecked(wxCommandEvent &event);
|
void LogChecked(wxCommandEvent &event);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,12 @@
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
#include "wxHelpers.h"
|
#include "wxHelpers.h"
|
||||||
|
|
||||||
|
#include <wx/cshelp.h>
|
||||||
|
|
||||||
|
#if wxUSE_TOOLTIPS
|
||||||
|
# include <wx/tooltip.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace wxHelpers
|
namespace wxHelpers
|
||||||
{
|
{
|
||||||
wxSizerFlags stdCenteredFlags( wxSizerFlags().Align(wxALIGN_CENTER).DoubleBorder() );
|
wxSizerFlags stdCenteredFlags( wxSizerFlags().Align(wxALIGN_CENTER).DoubleBorder() );
|
||||||
|
@ -11,19 +17,82 @@ namespace wxHelpers
|
||||||
wxSizerFlags stdButtonSizerFlags( wxSizerFlags().Align(wxALIGN_RIGHT).Border() );
|
wxSizerFlags stdButtonSizerFlags( wxSizerFlags().Align(wxALIGN_RIGHT).Border() );
|
||||||
wxSizerFlags CheckboxFlags( wxSizerFlags().Border( wxALL, 6 ).Expand() );
|
wxSizerFlags CheckboxFlags( wxSizerFlags().Border( wxALL, 6 ).Expand() );
|
||||||
|
|
||||||
void AddCheckBox( wxBoxSizer& sizer, wxWindow* parent, const wxString& label, wxWindowID id )
|
wxCheckBox& AddCheckBox( wxWindow* parent, wxBoxSizer& sizer, const wxString& label, wxWindowID id )
|
||||||
{
|
{
|
||||||
sizer.Add( new wxCheckBox( parent, id, label ), CheckboxFlags );
|
wxCheckBox* retval = new wxCheckBox( parent, id, label );
|
||||||
|
sizer.Add( retval, CheckboxFlags );
|
||||||
|
return *retval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDialogWithHelpers::AddCheckBox( wxBoxSizer& sizer, const wxString& label, wxWindowID id )
|
CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title=wxEmptyString ) :
|
||||||
|
wxPanel( parent ),
|
||||||
|
BoxSizer( *new wxStaticBoxSizer( orientation, this ) ),
|
||||||
|
MainToggle( *new wxCheckBox( this, wxID_ANY, title, wxPoint( 8, 1 ) ) )
|
||||||
{
|
{
|
||||||
wxHelpers::AddCheckBox( sizer, this, label, id );
|
MainToggle.SetSize( MainToggle.GetSize() + wxSize( 8, 0 ) );
|
||||||
|
|
||||||
|
//Connect( 100, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CheckedStaticBox::OnMainToggleEvent ), (wxObject*)this );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDialogWithHelpers::wxDialogWithHelpers( wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size ) :
|
BEGIN_EVENT_TABLE(CheckedStaticBox, wxPanel)
|
||||||
wxDialog( parent, id, title, pos, size )
|
EVT_CHECKBOX(wxID_ANY, MainToggle_Click)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
void CheckedStaticBox::MainToggle_Click( wxCommandEvent& evt )
|
||||||
{
|
{
|
||||||
|
SetValue( evt.IsChecked() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the main checkbox status, and enables/disables all child controls
|
||||||
|
// bound to the StaticBox accordingly.
|
||||||
|
void CheckedStaticBox::SetValue( bool val )
|
||||||
|
{
|
||||||
|
wxWindowList& list = GetChildren();
|
||||||
|
|
||||||
|
for( wxWindowList::iterator iter = list.begin(); iter != list.end(); ++iter)
|
||||||
|
{
|
||||||
|
wxWindow *current = *iter;
|
||||||
|
if( current != &MainToggle )
|
||||||
|
current->Enable( val );
|
||||||
|
}
|
||||||
|
//MainToggle.Enable();
|
||||||
|
MainToggle.SetValue( val );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CheckedStaticBox::GetValue() const
|
||||||
|
{
|
||||||
|
return MainToggle.GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxCheckBox& wxDialogWithHelpers::AddCheckBox( wxBoxSizer& sizer, const wxString& label, wxWindowID id )
|
||||||
|
{
|
||||||
|
return wxHelpers::AddCheckBox( this, sizer, label, id );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxDialogWithHelpers::wxDialogWithHelpers( wxWindow* parent, int id, const wxString& title, bool hasContextHelp, const wxPoint& pos, const wxSize& size ) :
|
||||||
|
wxDialog( parent, id, title, pos, size ),
|
||||||
|
m_hasContextHelp( hasContextHelp )
|
||||||
|
{
|
||||||
|
if( hasContextHelp )
|
||||||
|
wxHelpProvider::Set( new wxSimpleHelpProvider() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDialogWithHelpers::AddOkCancel( wxBoxSizer &sizer )
|
||||||
|
{
|
||||||
|
wxBoxSizer* buttonSizer = &sizer;
|
||||||
|
if( m_hasContextHelp )
|
||||||
|
{
|
||||||
|
// Add the context-sensitive help button on the caption for the platforms
|
||||||
|
// which support it (currently MSW only)
|
||||||
|
SetExtraStyle( wxDIALOG_EX_CONTEXTHELP );
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
// create a sizer to hold the help and ok/cancel buttons.
|
||||||
|
buttonSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
buttonSizer->Add( new wxContextHelpButton(this), stdButtonSizerFlags.Align( wxALIGN_LEFT ) );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
buttonSizer->Add( CreateStdDialogButtonSizer( wxOK | wxCANCEL ), wxHelpers::stdButtonSizerFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
namespace wxHelpers
|
namespace wxHelpers
|
||||||
{
|
{
|
||||||
// Creates a new checkbox and adds it to the specified sizer/parent combo.
|
// Creates a new checkbox and adds it to the specified sizer/parent combo.
|
||||||
// Uses the default psacer setting for adding checkboxes.
|
// Uses the default spacer setting for adding checkboxes.
|
||||||
extern void AddCheckBox( wxBoxSizer& sizer, wxWindow* parent, const wxString& label, wxWindowID id=wxID_ANY );
|
extern wxCheckBox& AddCheckBox( wxWindow* parent, wxBoxSizer& sizer, const wxString& label, wxWindowID id=wxID_ANY );
|
||||||
|
|
||||||
|
|
||||||
extern wxSizerFlags stdCenteredFlags;
|
extern wxSizerFlags stdCenteredFlags;
|
||||||
extern wxSizerFlags stdSpacingFlags;
|
extern wxSizerFlags stdSpacingFlags;
|
||||||
|
@ -18,10 +17,37 @@ namespace wxHelpers
|
||||||
extern wxSizerFlags CheckboxFlags;
|
extern wxSizerFlags CheckboxFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
class wxDialogWithHelpers : public wxDialog
|
class CheckedStaticBox : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxDialogWithHelpers(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize );
|
wxStaticBoxSizer& BoxSizer; // Boxsizer which olds all child items.
|
||||||
|
wxCheckBox& MainToggle; // toggle which can enable/disable all child controls
|
||||||
|
|
||||||
void AddCheckBox( wxBoxSizer& sizer, const wxString& label, wxWindowID id=wxID_ANY );
|
public:
|
||||||
|
CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title );
|
||||||
|
|
||||||
|
//virtual bool Layout();
|
||||||
|
void SetValue( bool val );
|
||||||
|
bool GetValue() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
DECLARE_EVENT_TABLE();
|
||||||
|
|
||||||
|
public:
|
||||||
|
void MainToggle_Click( wxCommandEvent& evt );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class wxDialogWithHelpers : public wxDialog
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
bool m_hasContextHelp;
|
||||||
|
|
||||||
|
public:
|
||||||
|
wxDialogWithHelpers(wxWindow* parent, int id, const wxString& title, bool hasContextHelp, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxCheckBox& AddCheckBox( wxBoxSizer& sizer, const wxString& label, wxWindowID id=wxID_ANY );
|
||||||
|
void AddOkCancel( wxBoxSizer& sizer );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue