More FrameAui work. Some more segmentation faults resolved. And a little more code clean up.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5959 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice
2010-07-24 02:36:22 +00:00
parent 949b873dc8
commit 43cbff64b5
8 changed files with 311 additions and 319 deletions

View File

@ -473,7 +473,7 @@ void CCodeWindow::ToggleCodeWindow(bool bShow)
if (bShow)
Parent->DoAddPage(this, iCodeWindow,
Parent->bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW]);
else // hide
else // Hide
Parent->DoRemovePage(this);
}
@ -487,8 +487,8 @@ void CCodeWindow::ToggleRegisterWindow(bool bShow)
Parent->DoAddPage(m_RegisterWindow, iRegisterWindow,
Parent->bFloatWindow[IDM_REGISTERWINDOW - IDM_LOGWINDOW]);
}
else // hide
Parent->DoRemovePage(m_RegisterWindow);
else // Close
Parent->DoRemovePage(m_RegisterWindow, false);
}
void CCodeWindow::ToggleBreakPointWindow(bool bShow)
@ -501,8 +501,8 @@ void CCodeWindow::ToggleBreakPointWindow(bool bShow)
Parent->DoAddPage(m_BreakpointWindow, iBreakpointWindow,
Parent->bFloatWindow[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW]);
}
else // hide
Parent->DoRemovePage(m_BreakpointWindow);
else // Close
Parent->DoRemovePage(m_BreakpointWindow, false);
}
void CCodeWindow::ToggleMemoryWindow(bool bShow)
@ -515,8 +515,8 @@ void CCodeWindow::ToggleMemoryWindow(bool bShow)
Parent->DoAddPage(m_MemoryWindow, iMemoryWindow,
Parent->bFloatWindow[IDM_MEMORYWINDOW - IDM_LOGWINDOW]);
}
else // hide
Parent->DoRemovePage(m_MemoryWindow);
else // Close
Parent->DoRemovePage(m_MemoryWindow, false);
}
void CCodeWindow::ToggleJitWindow(bool bShow)
@ -529,8 +529,8 @@ void CCodeWindow::ToggleJitWindow(bool bShow)
Parent->DoAddPage(m_JitWindow, iJitWindow,
Parent->bFloatWindow[IDM_JITWINDOW - IDM_LOGWINDOW]);
}
else // hide
Parent->DoRemovePage(m_JitWindow);
else // Close
Parent->DoRemovePage(m_JitWindow, false);
}
// Notice: This windows docking will produce several wx debugging messages for plugin
@ -582,7 +582,7 @@ void CCodeWindow::ToggleDLLWindow(int Id, bool bShow)
Win = (wxPanel *)FindWindowById(Id);
if (Win)
{
Parent->DoRemovePageId(Id, false, false);
Parent->DoRemovePage(Win, false);
Win->Close();
Win->Destroy();
}

View File

@ -17,7 +17,6 @@
#include "Debugger.h"
#include <wx/button.h>
#include <wx/textctrl.h>
#include <wx/listctrl.h>
@ -38,7 +37,6 @@
#include "HW/Memmap.h"
#include "HW/DSP.h"
// ugly that this lib included code from the main
#include "../../DolphinWX/Src/Globals.h"
enum
@ -48,7 +46,7 @@ enum
IDM_SETVALBUTTON,
IDM_DUMP_MEMORY,
IDM_VALBOX,
IDM_U8,//Feel free to rename these
IDM_U8,
IDM_U16,
IDM_U32,
IDM_SEARCH,
@ -76,12 +74,14 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
{
wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizerRight = new wxBoxSizer(wxVERTICAL);
// didn't see anything usefull in the left part
// Didn't see anything usefull in the left part
//wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
DebugInterface* di = &PowerPC::debug_interface;
//sizerLeft->Add(symbols = new wxListBox(this, IDM_SYMBOLLIST, wxDefaultPosition, wxSize(20, 100), 0, NULL, wxLB_SORT), 1, wxEXPAND);
//symbols = new wxListBox(this, IDM_SYMBOLLIST, wxDefaultPosition,
// wxSize(20, 100), 0, NULL, wxLB_SORT);
//sizerLeft->Add(symbols, 1, wxEXPAND);
memview = new CMemoryView(di, this, wxID_ANY);
memview->dataType = 0;
//sizerBig->Add(sizerLeft, 1, wxEXPAND);
@ -102,7 +102,8 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
sizerRight->Add(sizerSearchType);
wxStaticBoxSizer* sizerDataTypes = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Data Type"));
sizerDataTypes->Add(chk8=new wxCheckBox(this,IDM_U8,_T("&U8 ")));//Excesss spaces are to get the DataType to show properly
sizerDataTypes->SetMinSize(74, 40);
sizerDataTypes->Add(chk8 = new wxCheckBox(this, IDM_U8, _T("&U8")));
sizerDataTypes->Add(chk16 = new wxCheckBox(this, IDM_U16, _T("&U16")));
sizerDataTypes->Add(chk32 = new wxCheckBox(this, IDM_U32, _T("&U32")));
sizerRight->Add(sizerDataTypes);
@ -118,12 +119,10 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
sizerBig->Fit(this);
}
CMemoryWindow::~CMemoryWindow()
{
}
void CMemoryWindow::Save(IniFile& _IniFile) const
{
// Prevent these bad values that can happen after a crash or hanging
@ -136,7 +135,6 @@ void CMemoryWindow::Save(IniFile& _IniFile) const
}
}
void CMemoryWindow::Load(IniFile& _IniFile)
{
int x, y, w, h;
@ -147,13 +145,11 @@ void CMemoryWindow::Load(IniFile& _IniFile)
SetSize(x, y, w, h);
}
void CMemoryWindow::JumpToAddress(u32 _Address)
{
memview->Center(_Address);
}
void CMemoryWindow::SetMemoryValue(wxCommandEvent& event)
{
std::string str_addr = std::string(addrbox->GetValue().mb_str());
@ -161,12 +157,14 @@ void CMemoryWindow::SetMemoryValue(wxCommandEvent& event)
u32 addr;
u32 val;
if (!TryParseUInt(std::string("0x") + str_addr, &addr)) {
if (!TryParseUInt(std::string("0x") + str_addr, &addr))
{
PanicAlert("Invalid Address: %s", str_addr.c_str());
return;
}
if (!TryParseUInt(std::string("0x") + str_val, &val)) {
if (!TryParseUInt(std::string("0x") + str_val, &val))
{
PanicAlert("Invalid Value: %s", str_val.c_str());
return;
}
@ -198,7 +196,7 @@ void CMemoryWindow::NotifyMapLoaded()
{
symbols->Show(false); // hide it for faster filling
symbols->Clear();
/*
#if 0
#ifdef _WIN32
const FunctionDB::XFuncMap &syms = g_symbolDB.Symbols();
for (FuntionDB::XFuncMap::iterator iter = syms.begin(); iter != syms.end(); ++iter)
@ -206,10 +204,8 @@ void CMemoryWindow::NotifyMapLoaded()
int idx = symbols->Append(iter->second.name.c_str());
symbols->SetClientData(idx, (void*)&iter->second);
}
//
#endif
*/
#endif
symbols->Show(true);
Update();
}
@ -217,7 +213,8 @@ void CMemoryWindow::NotifyMapLoaded()
void CMemoryWindow::OnSymbolListChange(wxCommandEvent& event)
{
int index = symbols->GetSelection();
if (index >= 0) {
if (index >= 0)
{
Symbol* pSymbol = static_cast<Symbol *>(symbols->GetClientData(index));
if (pSymbol != NULL)
{
@ -236,7 +233,7 @@ void CMemoryWindow::OnHostMessage(wxCommandEvent& event)
}
}
// so we can view memory in a tile/hex viewer for data analysis
// So we can view memory in a tile/hex viewer for data analysis
void CMemoryWindow::OnDumpMemory( wxCommandEvent& event )
{
switch (memview->GetMemoryType())
@ -273,27 +270,32 @@ void CMemoryWindow::OnDumpMemory( wxCommandEvent& event )
}
}
void CMemoryWindow::U8(wxCommandEvent& event) {
void CMemoryWindow::U8(wxCommandEvent& event)
{
chk16->SetValue(0);
chk32->SetValue(0);
memview->dataType = 0;
memview->Refresh();
}
void CMemoryWindow::U16(wxCommandEvent& event) {
void CMemoryWindow::U16(wxCommandEvent& event)
{
chk8->SetValue(0);
chk32->SetValue(0);
memview->dataType = 1;
memview->Refresh();
}
void CMemoryWindow::U32(wxCommandEvent& event) {
void CMemoryWindow::U32(wxCommandEvent& event)
{
chk16->SetValue(0);
chk8->SetValue(0);
memview->dataType = 2;
memview->Refresh();
}
void CMemoryWindow::onSearch(wxCommandEvent& event) {
void CMemoryWindow::onSearch(wxCommandEvent& event)
{
u8* TheRAM = 0;
u32 szRAM = 0;
switch (memview->GetMemoryType())
@ -330,18 +332,22 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) {
long newsize = 0;
unsigned char *tmp2 = 0;
char* tmpstr = 0;
switch (chkHex->GetValue()){
switch (chkHex->GetValue())
{
case 1://We are looking for hex
//If it's uneven
size = (rawData.size()/2) + pad;
Dest.resize(size+32);
newsize = rawData.size();
if (pad) {
if (pad)
{
tmpstr = new char[newsize + 2];
memset(tmpstr, 0, newsize + 2);
tmpstr[0] = '0';
} else {
}
else
{
tmpstr = new char[newsize + 1];
memset(tmpstr, 0, newsize + 1);
}
@ -351,15 +357,18 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) {
sprintf(tmpstr, "%s%s", tmpstr, (const char *)rawData.mb_str());
tmp2 = &Dest.front();
count = 0;
for(i=0;i<strlen(tmpstr);i++){
for(i = 0; i < strlen(tmpstr); i++)
{
copy[0] = tmpstr[i];
copy[1] = tmpstr[i+1];
copy[2] = 0;
int tmpint;
sscanf(copy, "%02x", &tmpint);
tmp2[count++] = tmpint;
//sscanf(copy,"%02x",&tmp2[count++]);//Dest[count] should now be the hex of what the two chars were! Also should add a check to make sure it's A-F only
i+=1;//
// Dest[count] should now be the hex of what the two chars were!
// Also should add a check to make sure it's A-F only
//sscanf(copy, "%02x", &tmp2[count++]);
i += 1;
}
delete[] tmpstr;
break;
@ -368,16 +377,17 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) {
Dest.resize(size+1);
tmpstr = new char[size+1];
tmp2 = &Dest.front();
sprintf(tmpstr, "%s", (const char *)rawData.mb_str());
for(i=0;i<size;i++){
for(i = 0; i < size; i++)
tmp2[i] = tmpstr[i];
}
delete[] tmpstr;
break;
}
if(size){
if(size)
{
unsigned char* pnt = &Dest.front();
unsigned int k = 0;
//grab
@ -388,16 +398,20 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) {
sscanf(txt.mb_str(), "%08x", &addr);
}
i = addr+4;
for(;i<szRAM;i++){
for(k=0;k<size;k++){
for( ; i < szRAM; i++)
{
for(k = 0; k < size; k++)
{
if(i + k > szRAM) break;
if(k > size) break;
if(pnt[k]!=TheRAM[i+k]){
if(pnt[k] != TheRAM[i+k])
{
k = 0;
break;
}
}
if(k==size){
if(k == size)
{
//Match was found
wxMessageBox(_T("A match was found. Placing viewer at the offset."));
wxChar tmpwxstr[128] = {0};
@ -414,10 +428,12 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) {
}
}
void CMemoryWindow::onAscii(wxCommandEvent& event) {
void CMemoryWindow::onAscii(wxCommandEvent& event)
{
chkHex->SetValue(0);
}
void CMemoryWindow::onHex(wxCommandEvent& event) {
void CMemoryWindow::onHex(wxCommandEvent& event)
{
chkAscii->SetValue(0);
}

View File

@ -337,7 +337,6 @@ CFrame::CFrame(wxFrame* parent,
long style)
: CRenderFrame(parent, id, title, pos, size, style)
, g_pCodeWindow(NULL)
, m_MenuBar(NULL)
, bRenderToMain(false), bNoWiimoteMsg(false)
, m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
, m_pStatusBar(NULL), m_GameListCtrl(NULL), m_Panel(NULL)
@ -402,7 +401,7 @@ CFrame::CFrame(wxFrame* parent,
wxDefaultPosition, wxDefaultSize,
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT);
sizerPanel = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *sizerPanel = new wxBoxSizer(wxHORIZONTAL);
sizerPanel->Add(m_GameListCtrl, 1, wxEXPAND | wxALL);
m_Panel->SetSizer(sizerPanel);
// ---------------
@ -411,9 +410,6 @@ CFrame::CFrame(wxFrame* parent,
// 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.
m_Mgr = new wxAuiManager(this, wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE);
NOTEBOOK_STYLE = wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON | wxNO_BORDER;
TOOLBAR_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_TEXT /*wxAUI_TB_OVERFLOW overflow visible*/;
aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
if (g_pCodeWindow)
{
@ -518,6 +514,9 @@ CFrame::~CFrame()
delete m_XRRConfig;
#endif
// Close the log window now so that its settings are saved
m_LogWindow->Close();
ClosePages();
delete m_Mgr;
@ -864,42 +863,6 @@ void CFrame::OnKeyUp(wxKeyEvent& event)
}
}
wxFrame * CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title, wxWindow * Child)
{
wxFrame * Frame = new wxFrame(this, Id, Title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE);
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;
}
wxAuiNotebook* CFrame::CreateEmptyNotebook()
{
wxAuiNotebook* NB = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, NOTEBOOK_STYLE);
return NB;
}
void CFrame::DoFullscreen(bool bF)
{
ToggleDisplayMode(bF);

View File

@ -114,8 +114,6 @@ class CFrame : public CRenderFrame
// These have to be public
CCodeWindow* g_pCodeWindow;
wxMenuBar* m_MenuBar;
wxBitmap aNormalFile;
void InitBitmaps();
void DoPause();
void DoStop();
@ -143,8 +141,6 @@ class CFrame : public CRenderFrame
// AUI
wxAuiManager *m_Mgr;
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
long NOTEBOOK_STYLE, TOOLBAR_STYLE;
int iLeftWidth[2], iMidWidth[2];
bool bFloatWindow[IDM_VIDEOWINDOW - IDM_LOGWINDOW + 1];
// Utility
@ -169,9 +165,8 @@ class CFrame : public CRenderFrame
void ShowAllNotebooks(bool Window = false);
void HideAllNotebooks(bool Window = false);
void CloseAllNotebooks();
void DoAddPage(wxWindow *, int, bool);
void DoRemovePage(wxWindow *, bool Hide = true);
void DoRemovePageId(wxWindowID Id, bool bHide, bool bDestroy);
void DoAddPage(wxWindow *Win, int i, bool Float);
void DoRemovePage(wxWindow *, bool bHide = true);
void TogglePane();
void SetSimplePaneSize();
void SetPaneSize();
@ -210,7 +205,6 @@ class CFrame : public CRenderFrame
private:
wxStatusBar* m_pStatusBar;
wxBoxSizer* sizerPanel;
wxBoxSizer* sizerFrame;
CGameListCtrl* m_GameListCtrl;
wxPanel* m_Panel;

View File

@ -63,7 +63,10 @@ void CFrame::OnPaneClose(wxAuiManagerEvent& event)
wxAuiNotebook * nb = (wxAuiNotebook*)event.pane->window;
if (!nb) return;
if ((nb->GetPageText(0).IsSameAs(wxT("Log")) || nb->GetPageText(0).IsSameAs(wxT("Console"))))
if (!g_pCodeWindow)
{
if ((nb->GetPage(0)->GetId() == IDM_LOGWINDOW ||
nb->GetPage(0)->GetId() == IDM_CONSOLEWINDOW))
{
// Closing a pane containing the logwindow or a console closes both
SConfig::GetInstance().m_InterfaceConsole = false;
@ -71,16 +74,22 @@ void CFrame::OnPaneClose(wxAuiManagerEvent& event)
ToggleConsole(false);
ToggleLogWindow(false);
}
else if (nb->GetPageCount() != 0 && !nb->GetPageText(0).IsSameAs(wxT("<>")))
{
wxMessageBox(wxT("You can't close panes that have pages in them."), wxT("Notice"), wxOK, this);
}
else
{
if (GetNotebookCount() == 1)
wxMessageBox(wxT("At least one pane must remain open."),
wxT("Notice"), wxOK, this);
else if (nb->GetPageCount() != 0 && !nb->GetPageText(0).IsSameAs(wxT("<>")))
wxMessageBox(wxT("You can't close panes that have pages in them."),
wxT("Notice"), wxOK, this);
else
{
// Detach and delete the empty notebook
event.pane->DestroyOnClose(true);
m_Mgr->ClosePane(*event.pane);
}
}
m_Mgr->Update();
}
@ -105,7 +114,7 @@ void CFrame::ToggleLogWindow(bool bShow, int i)
else
{
m_LogWindow->Disable();
DoRemovePage(m_LogWindow, bShow);
DoRemovePage(m_LogWindow, true);
}
// Hide or Show the pane
@ -159,7 +168,7 @@ void CFrame::ToggleConsole(bool bShow, int i)
ConsoleParent->Disable();
// Then close the page
DoRemovePageId(IDM_CONSOLEWINDOW, true, true);
DoRemovePage(ConsoleParent, true);
}
// Hide or Show the pane
@ -320,51 +329,21 @@ void CFrame::TogglePane()
SetSimplePaneSize();
}
void CFrame::DoRemovePage(wxWindow * Win, bool _Hide)
void CFrame::DoRemovePage(wxWindow *Win, bool bHide)
{
if (!Win) return;
if (Win->GetId() > 0 && FindWindowById(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW))
wxWindow *Parent = FindWindowById(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW);
if (Parent)
{
Win->Reparent(this);
Win->Hide();
FindWindowById(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW)->Destroy();
WARN_LOG(CONSOLE, "Floating window %i closed", Win->GetId());
}
else
{
for (int i = 0; i < GetNotebookCount(); i++)
{
if (GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND)
{
GetNotebookFromId(i)->RemovePage(GetNotebookFromId(i)->GetPageIndex(Win));
if (_Hide)
if (bHide)
{
Win->Hide();
Win->Reparent(this);
}
else
Win->Close();
}
}
}
}
void CFrame::DoRemovePageId(wxWindowID Id, bool bHide, bool bDestroy)
{
wxWindow *Win = FindWindowById(Id);
if (!Win)
return;
wxWindow *Parent = FindWindowById(Id + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW);
if (Parent)
{
Win->Reparent(this);
if (bDestroy)
Win->Destroy();
else
Win->Hide();
Parent->Destroy();
}
else
@ -377,10 +356,11 @@ void CFrame::DoRemovePageId(wxWindowID Id, bool bHide, bool bDestroy)
GetNotebookFromId(i)->RemovePage(PageIndex);
if (bHide)
{
// Reparent to avoid destruction if the notebook is closed and destroyed
Win->Reparent(this);
Win->Hide();
Win->Reparent(this);
}
else
Win->Close();
}
}
}
@ -393,7 +373,7 @@ void CFrame::DoAddPage(wxWindow * Win, int i, bool Float)
if (i < 0 || i > GetNotebookCount()-1) i = 0;
if (Win && GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
if (!Float)
GetNotebookFromId(i)->AddPage(Win, Win->GetName(), true, aNormalFile );
GetNotebookFromId(i)->AddPage(Win, Win->GetName(), true);
else
CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW, Win->GetName(), Win);
}
@ -422,16 +402,19 @@ void CFrame::OnFloatingPageSize(wxSizeEvent& event)
void CFrame::DoFloatNotebookPage(wxWindowID Id)
{
wxPanel * Win = (wxPanel*)this->FindWindowById(Id);
wxPanel *Win = (wxPanel*)FindWindowById(Id);
if (!Win) return;
for (int i = 0; i < GetNotebookCount(); i++)
{
if (GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND)
wxAuiNotebook *nb = GetNotebookFromId(i);
if (nb->GetPageIndex(Win) != wxNOT_FOUND)
{
GetNotebookFromId(i)->RemovePage(GetNotebookFromId(i)->GetPageIndex(Win));
// Reparent to avoid destruction if the notebook is closed and destroyed
nb->RemovePage(nb->GetPageIndex(Win));
// Create the parent frame and reparent the window
CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW, Win->GetName(), Win);
if (nb->GetPageCount() == 0)
AddRemoveBlankPage();
}
}
}
@ -491,7 +474,8 @@ void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event)
menuPopup->Append(new wxMenuItem(menuPopup));
for (u32 i = 0; i < Perspectives.size(); i++)
{
wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i, wxString::FromAscii(Perspectives.at(i).Name.c_str()), wxT(""), wxITEM_CHECK);
wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i,
wxString::FromAscii(Perspectives.at(i).Name.c_str()), wxT(""), wxITEM_CHECK);
menuPopup->Append(mItem);
if (i == ActivePerspective) mItem->Check(true);
}
@ -522,7 +506,7 @@ void CFrame::OnToolBar(wxCommandEvent& event)
}
Save();
if (Perspectives.size() > 0 && ActivePerspective < Perspectives.size())
this->GetStatusBar()->SetStatusText(wxString::FromAscii(StringFromFormat(
GetStatusBar()->SetStatusText(wxString::FromAscii(StringFromFormat(
"Saved %s", Perspectives.at(ActivePerspective).Name.c_str()).c_str()), 0);
break;
case IDM_PERSPECTIVES_ADD_PANE:
@ -544,10 +528,11 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
{
case IDM_ADD_PERSPECTIVE:
{
wxTextEntryDialog dlg(this, wxT("Enter a name for the new perspective:"), wxT("Create new perspective"));
wxString DefaultValue = wxString::Format(wxT("Perspective %u"), unsigned(Perspectives.size() + 1));
wxTextEntryDialog dlg(this, wxT("Enter a name for the new perspective:"),
wxT("Create new perspective"));
wxString DefaultValue = wxString::Format(wxT("Perspective %u"),
unsigned(Perspectives.size() + 1));
dlg.SetValue(DefaultValue);
//if (dlg.ShowModal() != wxID_OK) return;
bool DlgOk = false; int Return = 0;
while (!DlgOk)
{
@ -556,14 +541,16 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
return;
else if (dlg.GetValue().Find(wxT(",")) != -1)
{
wxMessageBox(wxT("The name can not have the letter ',' in it"), wxT("Notice"), wxOK, this);
wxMessageBox(wxT("The name can not contain the character ','"),
wxT("Notice"), wxOK, this);
wxString Str = dlg.GetValue();
Str.Replace(wxT(","), wxT(""), true);
dlg.SetValue(Str);
}
else if (dlg.GetValue().IsSameAs(wxT("")))
{
wxMessageBox(wxT("The name can not be empty"), wxT("Notice"), wxOK, this);
wxMessageBox(wxT("The name can not be empty"),
wxT("Notice"), wxOK, this);
dlg.SetValue(DefaultValue);
}
else
@ -594,11 +581,10 @@ void CFrame::ResetToolbarStyle()
wxAuiPaneInfo& Pane = AllPanes.Item(i);
if (Pane.window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{
//Pane.BestSize(-1, -1);
Pane.Show();
// Show all of it
if (Pane.rect.GetLeft() > this->GetClientSize().GetX() - 50)
Pane.Position(this->GetClientSize().GetX() - Pane.window->GetClientSize().GetX());
if (Pane.rect.GetLeft() > GetClientSize().GetX() - 50)
Pane.Position(GetClientSize().GetX() - Pane.window->GetClientSize().GetX());
}
}
m_Mgr->Update();
@ -717,7 +703,7 @@ void CFrame::SetSimplePaneSize()
int x = 0, y = 0;
// Produce pixel width from percentage width
int Size = PercentageToPixels(50, this->GetSize().GetX());
int Size = PercentageToPixels(50, GetSize().GetX());
IniFile ini;
ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
@ -737,15 +723,18 @@ void CFrame::SetSimplePaneSize()
void CFrame::SetPaneSize()
{
if (Perspectives.size() <= ActivePerspective) return;
int iClientX = this->GetSize().GetX(), iClientY = this->GetSize().GetY();
int iClientX = GetSize().GetX(), iClientY = GetSize().GetY();
for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{
if (!m_Mgr->GetAllPanes().Item(i).IsOk()) return;
if (Perspectives.at(ActivePerspective).Width.size() <= j || Perspectives.at(ActivePerspective).Height.size() <= j) continue;
u32 W = Perspectives.at(ActivePerspective).Width.at(j), H = Perspectives.at(ActivePerspective).Height.at(j);
if (Perspectives.at(ActivePerspective).Width.size() <= j ||
Perspectives.at(ActivePerspective).Height.size() <= j)
continue;
u32 W = Perspectives.at(ActivePerspective).Width.at(j),
H = Perspectives.at(ActivePerspective).Height.at(j);
// Check limits
W = Limit(W, 5, 95); H = Limit(H, 5, 95);
// Produce pixel width from percentage width
@ -820,8 +809,6 @@ void CFrame::ReloadPanes()
if (g_pCodeWindow) g_pCodeWindow->OpenPages();
if (SConfig::GetInstance().m_InterfaceLogWindow) ToggleLogWindow(true);
if (SConfig::GetInstance().m_InterfaceConsole) ToggleConsole(true);
//Console->Log(LogTypes::LNOTICE, StringFromFormat("ReloadPanes end: Sound %i\n", FindWindowByName(wxT("Sound"))).c_str());
}
void CFrame::DoLoadPerspective()
@ -853,7 +840,7 @@ void CFrame::SaveLocal()
std::vector<std::string> _SWidth, _SHeight;
Tmp.Name = VPerspectives.at(i);
// Don't save a blank perspective
if (Tmp.Name == "") continue;
if (Tmp.Name.empty()) continue;
//if (!ini.Exists(_Section.c_str(), "Width")) continue;
_Section = StringFromFormat("P - %s", Tmp.Name.c_str());
@ -890,7 +877,7 @@ void CFrame::Save()
NamePanes();
// Get client size
int iClientX = this->GetSize().GetX(), iClientY = this->GetSize().GetY();
int iClientX = GetSize().GetX(), iClientY = GetSize().GetY();
IniFile ini;
ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
@ -931,7 +918,6 @@ void CFrame::Save()
// Update the local vector
SaveLocal();
TogglePaneStyle(m_bEdit, IDM_EDIT_PERSPECTIVES);
}
@ -994,6 +980,44 @@ wxWindow * CFrame::GetNotebookPageFromId(wxWindowID Id)
return NULL;
}
wxFrame * CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title, wxWindow * Child)
{
wxFrame * Frame = new wxFrame(this, Id, Title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE);
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;
}
wxAuiNotebook* CFrame::CreateEmptyNotebook()
{
long NOTEBOOK_STYLE = wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE
| wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON | wxNO_BORDER;
wxAuiNotebook* NB = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, NOTEBOOK_STYLE);
return NB;
}
void CFrame::AddRemoveBlankPage()
{
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
@ -1093,4 +1117,3 @@ void CFrame::HideAllNotebooks(bool Window)
}
m_Mgr->Update();
}

View File

@ -100,7 +100,7 @@ void CFrame::CreateMenu()
{
if (GetMenuBar()) GetMenuBar()->Destroy();
m_MenuBar = new wxMenuBar(wxMB_DOCKABLE);
wxMenuBar *m_MenuBar = new wxMenuBar();
// file menu
wxMenu* fileMenu = new wxMenu;
@ -367,6 +367,7 @@ void CFrame::RecreateToolbar()
m_ToolBar->Destroy();
}
long TOOLBAR_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_TEXT /*wxAUI_TB_OVERFLOW overflow visible*/;
m_ToolBar = new wxAuiToolBar(this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize, TOOLBAR_STYLE);
PopulateToolbar(m_ToolBar);
@ -495,8 +496,6 @@ void CFrame::InitBitmaps()
// Update in case the bitmap has been updated
if (m_ToolBar != NULL) RecreateToolbar();
aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
}
// Menu items
@ -1325,10 +1324,8 @@ void CFrame::UpdateGUI()
// Game has not started, show game list
if (!m_GameListCtrl->IsShown())
{
m_GameListCtrl->Reparent(m_Panel);
m_GameListCtrl->Enable();
m_GameListCtrl->Show();
sizerPanel->FitInside(m_Panel);
}
// Game has been selected but not started, enable play button
if (m_GameListCtrl->GetSelectedISO() != NULL && m_GameListCtrl->IsEnabled() && !m_bGameLoading)

View File

@ -165,7 +165,6 @@ CLogWindow::~CLogWindow()
void CLogWindow::OnClose(wxCloseEvent& event)
{
SaveSettings();
wxGetApp().GetCFrame()->ToggleLogWindow(false);
event.Skip();
}