2008-10-17 11:30:14 +00:00
|
|
|
// Copyright (C) 2003-2008 Dolphin Project.
|
|
|
|
|
2008-10-09 18:47:53 +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.
|
2008-10-17 11:30:14 +00:00
|
|
|
|
2008-10-09 18:47:53 +00:00
|
|
|
// 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.
|
2008-10-17 11:30:14 +00:00
|
|
|
|
2008-10-09 18:47:53 +00:00
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
2008-10-17 11:30:14 +00:00
|
|
|
|
2008-10-09 18:47:53 +00:00
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
2008-10-10 16:20:13 +00:00
|
|
|
#include "../Globals.h"
|
2008-11-21 01:28:00 +00:00
|
|
|
|
|
|
|
#include "IniFile.h" // Common files
|
|
|
|
|
|
|
|
#include "Config.h" // Config settings
|
|
|
|
|
|
|
|
#include "PBView.h" // Debugger files
|
2008-10-09 18:47:53 +00:00
|
|
|
#include "Debugger.h"
|
|
|
|
#include "../Logging/Console.h" // open and close console
|
|
|
|
|
|
|
|
// externals
|
|
|
|
extern int gSaveFile; // make this an int to allow multiple save file options
|
|
|
|
extern int gPreset;
|
|
|
|
int A, B;
|
|
|
|
|
|
|
|
|
|
|
|
// =======================================================================================
|
|
|
|
// Declare events
|
|
|
|
BEGIN_EVENT_TABLE(CDebugger,wxDialog)
|
|
|
|
EVT_SHOW(CDebugger::OnShow)
|
|
|
|
EVT_CLOSE(CDebugger::OnClose)
|
|
|
|
EVT_BUTTON(ID_UPD,CDebugger::OnUpdate)
|
2008-11-21 01:28:00 +00:00
|
|
|
|
|
|
|
EVT_CHECKBOX(ID_SAVETOFILE,CDebugger::GeneralSettings) // General settings
|
|
|
|
EVT_CHECKBOX(ID_SHOWCONSOLE,CDebugger::GeneralSettings)
|
|
|
|
EVT_CHECKLISTBOX(ID_CHECKLIST1, CDebugger::LogSettings) // Check list box
|
|
|
|
EVT_RADIOBOX(IDC_RADIO1, CDebugger::ChangeFrequency) // Update freq.
|
2008-10-09 18:47:53 +00:00
|
|
|
|
|
|
|
EVT_BUTTON(ID_AP,CDebugger::Ap)
|
|
|
|
EVT_BUTTON(ID_AM,CDebugger::Am)
|
|
|
|
EVT_BUTTON(ID_BP,CDebugger::Bp)
|
|
|
|
EVT_BUTTON(ID_BM,CDebugger::Bm)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
// =======================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
CDebugger::CDebugger(wxWindow *parent, wxWindowID id, const wxString &title,
|
|
|
|
const wxPoint &position, const wxSize& size, long style)
|
|
|
|
: wxDialog(parent, id, title, position, size, style)
|
|
|
|
, m_GPRListView(NULL)
|
|
|
|
{
|
|
|
|
CreateGUIControls();
|
|
|
|
|
|
|
|
// load ini...
|
|
|
|
IniFile file;
|
2008-11-12 04:54:17 +00:00
|
|
|
file.Load(DEBUGGER_CONFIG_FILE);
|
2008-10-09 18:47:53 +00:00
|
|
|
this->Load(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
CDebugger::~CDebugger()
|
|
|
|
{
|
|
|
|
// empty
|
|
|
|
IniFile file;
|
2008-11-12 04:54:17 +00:00
|
|
|
file.Load(DEBUGGER_CONFIG_FILE);
|
2008-10-09 18:47:53 +00:00
|
|
|
this->Save(file);
|
2008-11-12 04:54:17 +00:00
|
|
|
file.Save(DEBUGGER_CONFIG_FILE);
|
2008-10-09 18:47:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDebugger::Save(IniFile& _IniFile) const
|
|
|
|
{
|
|
|
|
// TODO1: make this work when we close the entire program to, currently on total close we get
|
|
|
|
// weird values, perhaps because of some conflict with the rendering window
|
|
|
|
// TODO2: get the screen resolution and make limits from that
|
|
|
|
if(GetPosition().x < 1000 && GetPosition().y < 1000
|
|
|
|
&& GetSize().GetWidth() < 1000 && GetSize().GetHeight() < 1000
|
|
|
|
)
|
|
|
|
{
|
|
|
|
_IniFile.Set("VideoWindow", "x", GetPosition().x);
|
|
|
|
_IniFile.Set("VideoWindow", "y", GetPosition().y);
|
|
|
|
_IniFile.Set("VideoWindow", "w", GetSize().GetWidth());
|
|
|
|
_IniFile.Set("VideoWindow", "h", GetSize().GetHeight());
|
|
|
|
}
|
|
|
|
_IniFile.Set("VideoWindow", "Console", m_Check[2]->IsChecked()); // save settings
|
|
|
|
_IniFile.Set("VideoWindow", "UpdateFrequency", m_RadioBox[1]->GetSelection());
|
2008-11-21 01:28:00 +00:00
|
|
|
_IniFile.Set("VideoWindow", "LogLevel", g_Config.iLog);
|
2008-10-09 18:47:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDebugger::Load(IniFile& _IniFile)
|
|
|
|
{
|
|
|
|
int x,y,w,h;
|
|
|
|
_IniFile.Get("VideoWindow", "x", &x, GetPosition().x);
|
|
|
|
_IniFile.Get("VideoWindow", "y", &y, GetPosition().y);
|
|
|
|
_IniFile.Get("VideoWindow", "w", &w, GetSize().GetWidth());
|
|
|
|
_IniFile.Get("VideoWindow", "h", &h, GetSize().GetHeight());
|
|
|
|
SetSize(x, y, w, h);
|
|
|
|
|
|
|
|
// saved settings
|
|
|
|
bool Console;
|
|
|
|
_IniFile.Get("VideoWindow", "Console", &Console, m_Check[2]->IsChecked());
|
|
|
|
m_Check[2]->SetValue(Console);
|
|
|
|
DoShowHideConsole();
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
_IniFile.Get("VideoWindow", "UpdateFrequency", &gUpdFreq, m_RadioBox[1]->GetSelection());
|
|
|
|
m_RadioBox[1]->SetSelection(gUpdFreq);
|
2008-10-09 18:47:53 +00:00
|
|
|
DoChangeFrequency();
|
2008-11-21 01:28:00 +00:00
|
|
|
|
|
|
|
_IniFile.Get("VideoWindow", "LogLevel", &g_Config.iLog, 0);
|
|
|
|
m_settings->Check(g_Config.iLog - 1, true);
|
2008-10-09 18:47:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDebugger::CreateGUIControls()
|
|
|
|
{
|
2008-11-21 01:28:00 +00:00
|
|
|
// Basic settings
|
2008-10-09 18:47:53 +00:00
|
|
|
SetTitle(wxT("OpenGL Debugging"));
|
|
|
|
SetIcon(wxNullIcon);
|
|
|
|
SetSize(8, 8, 200, 100); // these will become the minimin sizes allowed by resizing
|
|
|
|
Center();
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
// Declarations
|
|
|
|
wxBoxSizer *sMain, *sGeneral;
|
2008-10-09 18:47:53 +00:00
|
|
|
wxButton* m_Upd;
|
|
|
|
wxButton* m_Ap; wxButton* m_Am;
|
|
|
|
wxButton* m_Bp; wxButton* m_Bm;
|
|
|
|
|
|
|
|
wxStaticBoxSizer* sLeft;
|
|
|
|
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
// Notebook -----------------------------------------------------
|
|
|
|
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_PageMain = new wxPanel(m_Notebook, ID_PAGEMAIN, wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_Notebook->AddPage(m_PageMain, wxT("Main"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ===================================================================
|
|
|
|
// Main Page
|
|
|
|
|
|
|
|
|
|
|
|
// Buttons -----------------------------------------------------
|
|
|
|
wxStaticBoxSizer * m_updSizer = new wxStaticBoxSizer (wxVERTICAL, m_PageMain, wxT("Update"));
|
|
|
|
m_Upd = new wxButton(m_PageMain, ID_UPD, wxT("Update"),
|
2008-10-09 18:47:53 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
2008-11-21 01:28:00 +00:00
|
|
|
m_updSizer->Add(m_Upd, 0, 0, 5);
|
|
|
|
// ------------------------
|
|
|
|
|
|
|
|
|
|
|
|
// Variables -----------------------------------------------------
|
|
|
|
wxStaticBoxSizer * m_buttonSizer = new wxStaticBoxSizer (wxVERTICAL, m_PageMain, wxT("Variables"));
|
|
|
|
m_Ap = new wxButton(m_PageMain, ID_AP, wxT("A +"),
|
2008-10-09 18:47:53 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
|
|
|
//m_SelC->Enable(false);
|
2008-11-21 01:28:00 +00:00
|
|
|
m_Am = new wxButton(m_PageMain, ID_AM, wxT("A -"),
|
2008-10-09 18:47:53 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
|
|
|
//m_Presets->Enable(false);
|
2008-11-21 01:28:00 +00:00
|
|
|
m_Bp = new wxButton(m_PageMain, ID_BP, wxT("B +"),
|
2008-10-09 18:47:53 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
2008-11-21 01:28:00 +00:00
|
|
|
m_Bm = new wxButton(m_PageMain, ID_BM, wxT("B -"),
|
2008-10-09 18:47:53 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
m_buttonSizer->Add(m_Ap, 0, 0, 5);
|
|
|
|
m_buttonSizer->Add(m_Am, 0, 0, 5);
|
|
|
|
m_buttonSizer->Add(m_Bp, 0, 0, 5);
|
|
|
|
m_buttonSizer->Add(m_Bm, 0, 0, 5);
|
|
|
|
// ------------------------
|
|
|
|
|
2008-10-09 18:47:53 +00:00
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// m_PageMain: Options
|
|
|
|
// -------------------------
|
|
|
|
wxStaticBoxSizer * m_optionsSizer = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Options"));
|
|
|
|
//m_Label[0] = new wxStaticBox(m_PageMain, IDG_LABEL1, wxT("Options"),
|
|
|
|
// wxDefaultPosition, wxDefaultSize, 0);
|
|
|
|
//wxStaticBoxSizer * m_checkSizer3 = new wxStaticBoxSizer (m_Label[0], wxVERTICAL);
|
2008-10-09 18:47:53 +00:00
|
|
|
|
|
|
|
// checkboxes
|
2008-11-21 01:28:00 +00:00
|
|
|
m_Check[0] = new wxCheckBox(m_PageMain, ID_SAVETOFILE, wxT("Save to file"),
|
2008-10-09 18:47:53 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
2008-11-21 01:28:00 +00:00
|
|
|
m_Check[2] = new wxCheckBox(m_PageMain, ID_SHOWCONSOLE, wxT("Show console"),
|
2008-10-09 18:47:53 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
m_optionsSizer->Add(m_Check[0], 0, 0, 5);
|
|
|
|
m_optionsSizer->Add(m_Check[2], 0, 0, 5);
|
2008-10-09 18:47:53 +00:00
|
|
|
// ------------------------
|
|
|
|
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// m_PageMain: Log settings checkboxes
|
|
|
|
// -------------------------
|
|
|
|
wxStaticBoxSizer * m_logSizer = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Log setting"));
|
|
|
|
m_settings = new wxCheckListBox(m_PageMain, ID_CHECKLIST1, wxDefaultPosition, wxDefaultSize,
|
|
|
|
0, NULL, wxNO_BORDER);
|
2008-10-09 18:47:53 +00:00
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
m_settings->Append(wxT("Info log"));
|
|
|
|
m_settings->Append(wxT("Primary log"));
|
|
|
|
|
|
|
|
m_settings->Check(0, bInfoLog);
|
|
|
|
m_settings->Check(1, bPrimLog);
|
|
|
|
|
|
|
|
// because the wxCheckListBox is a little underdeveloped we have to help it with this
|
|
|
|
// to bad there's no windows xp styles for the checkboxes
|
|
|
|
m_settings->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
|
|
|
m_settings->SetMinSize(wxSize(m_settings->GetSize().GetWidth() - 40,
|
|
|
|
m_settings->GetCount() * 15));
|
|
|
|
|
|
|
|
m_logSizer->Add(m_settings, 0, 0, 0);
|
2008-10-09 18:47:53 +00:00
|
|
|
// ------------------------
|
|
|
|
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// m_PageMain: Radio boxes
|
|
|
|
// -------------------------
|
2008-11-15 02:30:29 +00:00
|
|
|
int m_radioBoxNChoices[3];
|
2008-10-09 18:47:53 +00:00
|
|
|
|
|
|
|
wxString m_radioBoxChoices0[] = { wxT("Show base 10"), wxT("Show base 16") };
|
|
|
|
m_radioBoxNChoices[0] = sizeof( m_radioBoxChoices0 ) / sizeof( wxString );
|
2008-11-21 01:28:00 +00:00
|
|
|
m_RadioBox[0] = new wxRadioBox( m_PageMain, IDC_RADIO0, wxT("Show base"),
|
2008-10-09 18:47:53 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[0], m_radioBoxChoices0, 1, wxRA_SPECIFY_COLS);
|
|
|
|
m_RadioBox[0]->Enable(false);
|
|
|
|
|
|
|
|
wxString m_radioBoxChoices1[] = { wxT("Never"), wxT("5 times/s"), wxT("15 times/s"), wxT("30 times/s") };
|
|
|
|
m_radioBoxNChoices[1] = sizeof( m_radioBoxChoices1 ) / sizeof( wxString );
|
2008-11-21 01:28:00 +00:00
|
|
|
m_RadioBox[1] = new wxRadioBox( m_PageMain, IDC_RADIO1, wxT("Update freq."),
|
2008-10-09 18:47:53 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[1], m_radioBoxChoices1, 1, wxRA_SPECIFY_COLS);
|
|
|
|
|
|
|
|
wxString m_radioBoxChoices2[] = { wxT("Win stretch") };
|
|
|
|
m_radioBoxNChoices[2] = sizeof( m_radioBoxChoices2 ) / sizeof( wxString );
|
2008-11-21 01:28:00 +00:00
|
|
|
m_RadioBox[2] = new wxRadioBox( m_PageMain, IDC_RADIO2, wxT("Presets"),
|
2008-10-09 18:47:53 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[2], m_radioBoxChoices2, 1, wxRA_SPECIFY_COLS);
|
|
|
|
// ------------------------
|
|
|
|
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// Main: Left buttons and checkboxes
|
|
|
|
// ------------------------
|
|
|
|
wxBoxSizer* sButtons = new wxBoxSizer(wxVERTICAL);
|
2008-10-09 18:47:53 +00:00
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
//sButtons->AddStretchSpacer(1);
|
2008-10-09 18:47:53 +00:00
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
sButtons->Add(m_updSizer, 0, 0, 5); // update button
|
|
|
|
sButtons->Add(m_buttonSizer, 0, 0, 5); // variables buttons
|
|
|
|
sButtons->Add(m_logSizer, 0, 0, 5); // log settings
|
2008-10-09 18:47:53 +00:00
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
sButtons->Add(m_optionsSizer, 0, 2, 5); // Log options, show console etc.
|
2008-10-09 18:47:53 +00:00
|
|
|
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// Main: Right buttons and checkboxes
|
|
|
|
// ------------------------
|
|
|
|
wxBoxSizer* sButtons2 = new wxBoxSizer(wxVERTICAL);
|
2008-10-09 18:47:53 +00:00
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
sButtons2->Add(m_RadioBox[0], 0, 0, 5); // Show base
|
|
|
|
sButtons2->Add(m_RadioBox[1], 0, 0, 5); // Update frequency
|
|
|
|
sButtons2->Add(m_RadioBox[2], 0, 0, 5); // Preset views
|
|
|
|
//sButtons2->AddStretchSpacer(1);
|
|
|
|
//sButtons2->Add(m_checkSizer2, 0, 2, 5);
|
2008-10-09 18:47:53 +00:00
|
|
|
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// Main: Parameter tables view, the big window
|
|
|
|
sLeft = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Current Status"));
|
2008-10-09 18:47:53 +00:00
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
m_GPRListView = new CPBView(m_PageMain, ID_GPR, wxDefaultPosition, GetSize(),
|
|
|
|
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING);
|
2008-10-09 18:47:53 +00:00
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
sLeft->Add(m_GPRListView, 1, wxEXPAND|wxALL, 5);
|
2008-10-09 18:47:53 +00:00
|
|
|
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// General container
|
|
|
|
// -----------------------------
|
|
|
|
sGeneral = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
sGeneral->Add(sLeft, 1, wxEXPAND | wxALL, 5);
|
|
|
|
sGeneral->Add(sButtons, 0, wxEXPAND | (wxUP | wxDOWN), 5);
|
|
|
|
sGeneral->Add(sButtons2, 0, wxEXPAND | (wxUP | wxDOWN | wxRIGHT | wxLEFT), 5);
|
2008-10-09 18:47:53 +00:00
|
|
|
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
// --------------------------------------------------------------------
|
|
|
|
// Main container
|
|
|
|
// -----------------------------
|
|
|
|
sMain = new wxBoxSizer(wxVERTICAL);
|
|
|
|
sMain->Add(m_Notebook, 1, wxEXPAND | wxALL, 5);
|
2008-10-09 18:47:53 +00:00
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
m_PageMain->SetSizer(sGeneral);
|
2008-10-09 18:47:53 +00:00
|
|
|
this->SetSizer(sMain);
|
2008-11-21 01:28:00 +00:00
|
|
|
//sGeneral->SetSizeHints(this);
|
2008-10-09 18:47:53 +00:00
|
|
|
|
|
|
|
//NotifyUpdate();
|
2008-11-21 01:28:00 +00:00
|
|
|
//Freeze(); // unfreeze this if you want to use it
|
2008-10-09 18:47:53 +00:00
|
|
|
}
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
// System functions
|
|
|
|
// --------------
|
2008-10-09 18:47:53 +00:00
|
|
|
void CDebugger::OnShow(wxShowEvent& /*event*/)
|
|
|
|
{
|
|
|
|
// bring the console back to
|
|
|
|
if(m_Check[2]->IsChecked())
|
|
|
|
{
|
|
|
|
OpenConsole();
|
2008-10-10 16:20:13 +00:00
|
|
|
#ifdef _WIN32
|
2008-11-21 01:28:00 +00:00
|
|
|
MoveWindow(GetConsoleHwnd(), 0,400, 1280,500, true); // Move window TODO: make this
|
2008-10-09 18:47:53 +00:00
|
|
|
// adjustable from the debugging window
|
2008-10-10 16:20:13 +00:00
|
|
|
#endif
|
2008-10-09 18:47:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDebugger::OnClose(wxCloseEvent& /*event*/)
|
|
|
|
{
|
|
|
|
// save the window position when we hide the window to
|
|
|
|
IniFile file;
|
2008-11-12 04:54:17 +00:00
|
|
|
file.Load(DEBUGGER_CONFIG_FILE);
|
2008-10-09 18:47:53 +00:00
|
|
|
this->Save(file);
|
2008-11-12 04:54:17 +00:00
|
|
|
file.Save(DEBUGGER_CONFIG_FILE);
|
2008-10-09 18:47:53 +00:00
|
|
|
|
|
|
|
EndModal(0); // it seems like this works for Show() to, not just ShowModal();
|
2008-11-21 01:28:00 +00:00
|
|
|
CloseConsole(); // The console goes with the wx window
|
|
|
|
}
|
|
|
|
|
2008-10-09 18:47:53 +00:00
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
void CDebugger::DoHide()
|
|
|
|
{
|
|
|
|
Hide();
|
|
|
|
CloseConsole(); // The console goes with the wx window
|
2008-10-09 18:47:53 +00:00
|
|
|
}
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
void CDebugger::DoShow()
|
|
|
|
{
|
|
|
|
Show();
|
|
|
|
DoShowHideConsole(); // The console goes with the wx window
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-09 18:47:53 +00:00
|
|
|
void CDebugger::OnUpdate(wxCommandEvent& /*event*/)
|
|
|
|
{
|
|
|
|
this->NotifyUpdate();
|
|
|
|
}
|
2008-11-21 01:28:00 +00:00
|
|
|
// ===============
|
2008-10-09 18:47:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
// =======================================================================================
|
|
|
|
// Change preset
|
|
|
|
// --------------
|
|
|
|
void CDebugger::ChangePreset(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
DoChangePreset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDebugger::DoChangePreset()
|
|
|
|
{
|
|
|
|
if(m_RadioBox[2]->GetSelection() == 0)
|
|
|
|
gPreset = 0;
|
|
|
|
else if(m_RadioBox[2]->GetSelection() == 1)
|
|
|
|
gPreset = 1;
|
|
|
|
else if(m_RadioBox[2]->GetSelection() == 2)
|
|
|
|
gPreset = 2;
|
|
|
|
else if(m_RadioBox[2]->GetSelection() == 3)
|
|
|
|
gPreset = 3;
|
|
|
|
}
|
|
|
|
// ==============
|
|
|
|
|
|
|
|
|
|
|
|
// =======================================================================================
|
|
|
|
// Control variables
|
|
|
|
// --------------
|
|
|
|
void CDebugger::Ap(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
A += 50;
|
|
|
|
//MessageBox(0, "", "", 0);
|
|
|
|
__Log("%i", A);
|
|
|
|
}
|
|
|
|
void CDebugger::Am(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
A -= 50;
|
|
|
|
}
|
|
|
|
void CDebugger::Bp(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
B += 50;
|
|
|
|
}
|
|
|
|
void CDebugger::Bm(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
B -= 50;
|
|
|
|
}
|
|
|
|
// ==============
|
|
|
|
|
|
|
|
|
|
|
|
// =======================================================================================
|
|
|
|
// Change update frequency
|
|
|
|
// --------------
|
|
|
|
void CDebugger::ChangeFrequency(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
DoChangeFrequency();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDebugger::DoChangeFrequency()
|
|
|
|
{
|
|
|
|
if(m_RadioBox[1]->GetSelection() == 0)
|
|
|
|
gUpdFreq = 0;
|
|
|
|
else if(m_RadioBox[1]->GetSelection() == 1)
|
|
|
|
gUpdFreq = 5;
|
|
|
|
else if(m_RadioBox[1]->GetSelection() == 2)
|
|
|
|
gUpdFreq = 15;
|
2008-11-21 01:28:00 +00:00
|
|
|
else
|
2008-10-09 18:47:53 +00:00
|
|
|
gUpdFreq = 30;
|
|
|
|
}
|
|
|
|
// ==============
|
|
|
|
|
|
|
|
|
|
|
|
// =======================================================================================
|
2008-11-21 01:28:00 +00:00
|
|
|
// General settings
|
2008-10-09 18:47:53 +00:00
|
|
|
// --------------
|
2008-11-21 01:28:00 +00:00
|
|
|
void CDebugger::GeneralSettings(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
switch (event.GetId())
|
2008-10-09 18:47:53 +00:00
|
|
|
{
|
2008-11-21 01:28:00 +00:00
|
|
|
case ID_SAVETOFILE: // Save to file
|
|
|
|
gSaveFile = m_Check[0]->IsChecked();
|
|
|
|
break;
|
|
|
|
case ID_SHOWCONSOLE:
|
|
|
|
DoShowHideConsole();
|
|
|
|
break;
|
2008-10-09 18:47:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// ==============
|
|
|
|
|
|
|
|
|
|
|
|
// =======================================================================================
|
|
|
|
// Show or hide console window
|
|
|
|
// --------------
|
|
|
|
void CDebugger::DoShowHideConsole()
|
|
|
|
{
|
|
|
|
if(m_Check[2]->IsChecked())
|
|
|
|
{
|
|
|
|
OpenConsole();
|
2008-10-10 16:20:13 +00:00
|
|
|
#ifdef _WIN32
|
2008-10-09 18:47:53 +00:00
|
|
|
MoveWindow(GetConsoleHwnd(), 0,400, 1280,500, true); // move window, TODO: make this
|
|
|
|
// adjustable from the debugging window
|
2008-10-10 16:20:13 +00:00
|
|
|
#endif
|
2008-10-09 18:47:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CloseConsole();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ==============
|
|
|
|
|
|
|
|
|
2008-11-21 01:28:00 +00:00
|
|
|
// =======================================================================================
|
|
|
|
// Enable or disable logs
|
|
|
|
// --------------
|
|
|
|
void CDebugger::LogSettings(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
// Only allow one selected log at a time
|
|
|
|
for (int i = 0; i < m_settings->GetCount(); ++i)
|
|
|
|
if(i != event.GetInt()) m_settings->Check(i, false);
|
|
|
|
|
|
|
|
if(m_settings->IsChecked(0)) g_Config.iLog = CONF_LOG;
|
|
|
|
else if(m_settings->IsChecked(1)) g_Config.iLog = CONF_PRIMLOG;
|
|
|
|
else g_Config.iLog = 0;
|
|
|
|
}
|
|
|
|
// ==============
|
|
|
|
|
|
|
|
|
|
|
|
// =======================================================================================
|
|
|
|
// Update the wxListCtrl
|
|
|
|
// --------------
|
2008-10-09 18:47:53 +00:00
|
|
|
void CDebugger::NotifyUpdate()
|
|
|
|
{
|
|
|
|
if (m_GPRListView != NULL)
|
|
|
|
{
|
|
|
|
m_GPRListView->Update();
|
|
|
|
}
|
|
|
|
}
|
2008-11-21 01:28:00 +00:00
|
|
|
// ==============
|