GUI: Custom pane management, almost complete

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4109 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-08-30 19:44:42 +00:00
parent 44847c2ee3
commit 3548ca586b
9 changed files with 392 additions and 202 deletions

View File

@ -102,38 +102,29 @@ bool IniFile::DeleteSection(const char* sectionName)
void IniFile::ParseLine(const std::string& line, std::string* keyOut, std::string* valueOut, std::string* commentOut) const void IniFile::ParseLine(const std::string& line, std::string* keyOut, std::string* valueOut, std::string* commentOut) const
{ {
// allow many types of commenting //
// These MUST be signed! Do not change to size_t int FirstEquals = (int)line.find("=", 0);
int firstEquals = (int)line.find("=", 0); int FirstCommentChar = -1;
int firstCommentChar = (int)line.find(";", 0); // Comments
//if (FirstCommentChar < 0) {FirstCommentChar = (int)line.find(";", FirstEquals > 0 ? FirstEquals : 0);}
if (FirstCommentChar < 0) {FirstCommentChar = (int)line.find("#", FirstEquals > 0 ? FirstEquals : 0);}
if (FirstCommentChar < 0) {FirstCommentChar = (int)line.find("//", FirstEquals > 0 ? FirstEquals : 0);}
if (firstCommentChar < 0){firstCommentChar = (int)line.find("#", firstEquals > 0 ? firstEquals : 0);} // Allow preservation of spacing before comment
if (FirstCommentChar > 0)
if (firstCommentChar < 0){firstCommentChar = (int)line.find("//", firstEquals > 0 ? firstEquals : 0);}
// allow preserval of spacing before comment
if (firstCommentChar > 0)
{ {
while (line[firstCommentChar - 1] == ' ' || line[firstCommentChar - 1] == 9) // 9 == tab while (line[FirstCommentChar - 1] == ' ' || line[FirstCommentChar - 1] == 9) // 9 == tab
{ {
firstCommentChar--; FirstCommentChar--;
} }
} }
if ((firstEquals >= 0) && ((firstCommentChar < 0) || (firstEquals < firstCommentChar))) if ((FirstEquals >= 0) && ((FirstCommentChar < 0) || (FirstEquals < FirstCommentChar)))
{ {
// Yes, a valid line! // Yes, a valid line!
*keyOut = StripSpaces(line.substr(0, firstEquals)); *keyOut = StripSpaces(line.substr(0, FirstEquals));
if (commentOut) *commentOut = FirstCommentChar > 0 ? line.substr(FirstCommentChar) : std::string("");
if (commentOut) if (valueOut) *valueOut = StripQuotes(StripSpaces(line.substr(FirstEquals + 1, FirstCommentChar - FirstEquals - 1)));
{
*commentOut = firstCommentChar > 0 ? line.substr(firstCommentChar) : std::string("");
}
if (valueOut)
{
*valueOut = StripQuotes(StripSpaces(line.substr(firstEquals + 1, firstCommentChar - firstEquals - 1)));
}
} }
} }
@ -269,7 +260,7 @@ void IniFile::SortSections()
bool IniFile::Load(const char* filename) bool IniFile::Load(const char* filename)
{ {
// Maximum number of letters in a line // Maximum number of letters in a line
static const int MAX_BYTES = 1024*10; static const int MAX_BYTES = 1024*32;
sections.clear(); sections.clear();
sections.push_back(Section("")); sections.push_back(Section(""));
@ -279,10 +270,7 @@ bool IniFile::Load(const char* filename)
std::ifstream in; std::ifstream in;
in.open(filename, std::ios::in); in.open(filename, std::ios::in);
if (in.fail()) if (in.fail()) return false;
{
return false;
}
while (!in.eof()) while (!in.eof())
{ {
@ -298,10 +286,7 @@ bool IniFile::Load(const char* filename)
} }
#endif #endif
if (in.eof()) if (in.eof()) break;
{
break;
}
if (line.size() > 0) if (line.size() > 0)
{ {
@ -424,7 +409,6 @@ bool IniFile::Get(const char* sectionName, const char* key, std::string* value,
{ {
*value = defaultValue; *value = defaultValue;
} }
return false; return false;
} }
@ -436,7 +420,6 @@ bool IniFile::Get(const char* sectionName, const char* key, std::string* value,
{ {
*value = defaultValue; *value = defaultValue;
} }
return false; return false;
} }

View File

@ -161,9 +161,6 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
, m_MemoryWindow(NULL) , m_MemoryWindow(NULL)
, m_JitWindow(NULL) , m_JitWindow(NULL)
{ {
// Load ini settings
this->Load();
InitBitmaps(); InitBitmaps();
CreateGUIControls(_LocalCoreStartupParameter); CreateGUIControls(_LocalCoreStartupParameter);
@ -442,25 +439,22 @@ void CCodeWindow::Load()
ini.Get("ShowOnStart", "Sound", &bSoundWindow, false); ini.Get("ShowOnStart", "Sound", &bSoundWindow, false);
ini.Get("ShowOnStart", "Video", &bVideoWindow, false); ini.Get("ShowOnStart", "Video", &bVideoWindow, false);
// Get notebook affiliation // Get notebook affiliation
ini.Get("Notebook", "Log", &iLogWindow, 1); std::string _Section = StringFromFormat("P - %s",
ini.Get("Notebook", "Console", &iConsoleWindow, 1); (Parent->ActivePerspective < Parent->Perspectives.size())
ini.Get("Notebook", "Code", &iCodeWindow, 1); ? Parent->Perspectives.at(Parent->ActivePerspective).Name.c_str() : "");
ini.Get("Notebook", "Registers", &iRegisterWindow, 1); ini.Get(_Section.c_str(), "Log", &iLogWindow, 1);
ini.Get("Notebook", "Breakpoints", &iBreakpointWindow, 0); ini.Get(_Section.c_str(), "Console", &iConsoleWindow, 1);
ini.Get("Notebook", "Memory", &iMemoryWindow, 1); ini.Get(_Section.c_str(), "Code", &iCodeWindow, 1);
ini.Get("Notebook", "JIT", &iJitWindow, 1); ini.Get(_Section.c_str(), "Registers", &iRegisterWindow, 1);
ini.Get("Notebook", "Sound", &iSoundWindow, 0); ini.Get(_Section.c_str(), "Breakpoints", &iBreakpointWindow, 0);
ini.Get("Notebook", "Video", &iVideoWindow, 0); ini.Get(_Section.c_str(), "Memory", &iMemoryWindow, 1);
// Remove bad values ini.Get(_Section.c_str(), "JIT", &iJitWindow, 1);
iLogWindow = Limit(iLogWindow, 0, Parent->m_NB.size()-1); ini.Get(_Section.c_str(), "Sound", &iSoundWindow, 0);
iConsoleWindow = Limit(iConsoleWindow, 0, Parent->m_NB.size()-1); ini.Get(_Section.c_str(), "Video", &iVideoWindow, 0);
iCodeWindow = Limit(iCodeWindow, 0, Parent->m_NB.size()-1);
iRegisterWindow = Limit(iRegisterWindow, 0, Parent->m_NB.size()-1); ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
iBreakpointWindow = Limit(iBreakpointWindow, 0, Parent->m_NB.size()-1); Console->Log(LogTypes::LCUSTOM, StringFromFormat(
iMemoryWindow = Limit(iMemoryWindow, 0, Parent->m_NB.size()-1); "Load: %i\n", iRegisterWindow).c_str());
iJitWindow = Limit(iJitWindow, 0, Parent->m_NB.size()-1);
iSoundWindow = Limit(iSoundWindow, 0, Parent->m_NB.size()-1);
iVideoWindow = Limit(iVideoWindow, 0, Parent->m_NB.size()-1);
// Boot to pause or not // Boot to pause or not
ini.Get("ShowOnStart", "AutomaticStart", &bAutomaticStart, false); ini.Get("ShowOnStart", "AutomaticStart", &bAutomaticStart, false);
@ -485,16 +479,18 @@ void CCodeWindow::Save()
ini.Set("ShowOnStart", "JIT", GetMenuBar()->IsChecked(IDM_JITWINDOW)); ini.Set("ShowOnStart", "JIT", GetMenuBar()->IsChecked(IDM_JITWINDOW));
ini.Set("ShowOnStart", "Sound", GetMenuBar()->IsChecked(IDM_SOUNDWINDOW)); ini.Set("ShowOnStart", "Sound", GetMenuBar()->IsChecked(IDM_SOUNDWINDOW));
ini.Set("ShowOnStart", "Video", GetMenuBar()->IsChecked(IDM_VIDEOWINDOW)); ini.Set("ShowOnStart", "Video", GetMenuBar()->IsChecked(IDM_VIDEOWINDOW));
std::string _Section = StringFromFormat("P - %s",
ini.Set("Notebook", "Log", iLogWindow); (Parent->ActivePerspective < Parent->Perspectives.size())
ini.Set("Notebook", "Console", iConsoleWindow); ? Parent->Perspectives.at(Parent->ActivePerspective).Name.c_str() : "");
ini.Set("Notebook", "Code", iCodeWindow); ini.Set(_Section.c_str(), "Log", iLogWindow);
ini.Set("Notebook", "Registers", iRegisterWindow); ini.Set(_Section.c_str(), "Console", iConsoleWindow);
ini.Set("Notebook", "Breakpoints", iBreakpointWindow); ini.Set(_Section.c_str(), "Code", iCodeWindow);
ini.Set("Notebook", "Memory", iMemoryWindow); ini.Set(_Section.c_str(), "Registers", iRegisterWindow);
ini.Set("Notebook", "JIT", iJitWindow); ini.Set(_Section.c_str(), "Breakpoints", iBreakpointWindow);
ini.Set("Notebook", "Sound", iSoundWindow); ini.Set(_Section.c_str(), "Memory", iMemoryWindow);
ini.Set("Notebook", "Video", iVideoWindow); ini.Set(_Section.c_str(), "JIT", iJitWindow);
ini.Set(_Section.c_str(), "Sound", iSoundWindow);
ini.Set(_Section.c_str(), "Video", iVideoWindow);
// Save window settings // Save window settings
/* /*

View File

@ -85,6 +85,7 @@ class CCodeWindow
void UpdateManager(); void UpdateManager();
void OnToggleWindow(wxCommandEvent& event); void OnToggleWindow(wxCommandEvent& event);
void OnToggleCodeWindow(bool,int);
void OnToggleRegisterWindow(bool,int); void OnToggleRegisterWindow(bool,int);
void OnToggleBreakPointWindow(bool,int); void OnToggleBreakPointWindow(bool,int);
void OnToggleMemoryWindow(bool,int); void OnToggleMemoryWindow(bool,int);

View File

@ -333,6 +333,7 @@ int CCodeWindow::Limit(int i, int Low, int High)
} }
void CCodeWindow::OpenPages() void CCodeWindow::OpenPages()
{ {
Parent->DoToggleWindow(IDM_CODEWINDOW, true);
if (bRegisterWindow) Parent->DoToggleWindow(IDM_REGISTERWINDOW, true); if (bRegisterWindow) Parent->DoToggleWindow(IDM_REGISTERWINDOW, true);
if (bBreakpointWindow) Parent->DoToggleWindow(IDM_BREAKPOINTWINDOW, true); if (bBreakpointWindow) Parent->DoToggleWindow(IDM_BREAKPOINTWINDOW, true);
if (bMemoryWindow) Parent->DoToggleWindow(IDM_MEMORYWINDOW, true); if (bMemoryWindow) Parent->DoToggleWindow(IDM_MEMORYWINDOW, true);
@ -344,14 +345,21 @@ void CCodeWindow::OnToggleWindow(wxCommandEvent& event)
{ {
Parent->DoToggleWindow(event.GetId(), GetMenuBar()->IsChecked(event.GetId())); Parent->DoToggleWindow(event.GetId(), GetMenuBar()->IsChecked(event.GetId()));
} }
void CCodeWindow::OnToggleCodeWindow(bool Show, int i)
{
if (Show)
{
Parent->DoAddPage(this, i, "Code");
}
else // hide
Parent->DoRemovePage (this);
}
void CCodeWindow::OnToggleRegisterWindow(bool Show, int i) void CCodeWindow::OnToggleRegisterWindow(bool Show, int i)
{ {
if (Show) if (Show)
{ {
if (i < 0 || i > Parent->m_NB.size()-1) return;
if (m_RegisterWindow && Parent->m_NB[i]->GetPageIndex(m_RegisterWindow) != wxNOT_FOUND) return;
if (!m_RegisterWindow) m_RegisterWindow = new CRegisterWindow(Parent); if (!m_RegisterWindow) m_RegisterWindow = new CRegisterWindow(Parent);
Parent->m_NB[i]->AddPage(m_RegisterWindow, wxT("Registers"), true, Parent->aNormalFile ); Parent->DoAddPage(m_RegisterWindow, i, "Registers");
} }
else // hide else // hide
Parent->DoRemovePage (m_RegisterWindow); Parent->DoRemovePage (m_RegisterWindow);
@ -361,10 +369,8 @@ void CCodeWindow::OnToggleBreakPointWindow(bool Show, int i)
{ {
if (Show) if (Show)
{ {
if (i < 0 || i > Parent->m_NB.size()-1) return; if (!m_RegisterWindow) m_BreakpointWindow = new CBreakPointWindow(this, Parent);
if (m_BreakpointWindow && Parent->m_NB[i]->GetPageIndex(m_BreakpointWindow) != wxNOT_FOUND) return; Parent->DoAddPage(m_BreakpointWindow, i, "Breakpoints");
if (!m_BreakpointWindow) m_BreakpointWindow = new CBreakPointWindow(this, Parent);
Parent->m_NB[i]->AddPage(m_BreakpointWindow, wxT("Breakpoints"), true, Parent->aNormalFile );
} }
else // hide else // hide
Parent->DoRemovePage(m_BreakpointWindow); Parent->DoRemovePage(m_BreakpointWindow);
@ -374,10 +380,8 @@ void CCodeWindow::OnToggleJitWindow(bool Show, int i)
{ {
if (Show) if (Show)
{ {
if (i < 0 || i > Parent->m_NB.size()-1) return;
if (m_JitWindow && Parent->m_NB[i]->GetPageIndex(m_JitWindow) != wxNOT_FOUND) return;
if (!m_JitWindow) m_JitWindow = new CJitWindow(Parent); if (!m_JitWindow) m_JitWindow = new CJitWindow(Parent);
Parent->m_NB[i]->AddPage(m_JitWindow, wxT("JIT"), true, Parent->aNormalFile ); Parent->DoAddPage(m_JitWindow, i, "JIT");
} }
else // hide else // hide
Parent->DoRemovePage(m_JitWindow); Parent->DoRemovePage(m_JitWindow);
@ -388,10 +392,8 @@ void CCodeWindow::OnToggleMemoryWindow(bool Show, int i)
{ {
if (Show) if (Show)
{ {
if (i < 0 || i > Parent->m_NB.size()-1) return;
if (m_MemoryWindow && Parent->m_NB[i]->GetPageIndex(m_MemoryWindow) != wxNOT_FOUND) return;
if (!m_MemoryWindow) m_MemoryWindow = new CMemoryWindow(Parent); if (!m_MemoryWindow) m_MemoryWindow = new CMemoryWindow(Parent);
Parent->m_NB[i]->AddPage(m_MemoryWindow, wxT("Memory"), true, Parent->aNormalFile ); Parent->DoAddPage(m_MemoryWindow, i, "Memory");
} }
else // hide else // hide
Parent->DoRemovePage(m_MemoryWindow); Parent->DoRemovePage(m_MemoryWindow);
@ -404,7 +406,8 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, int i)
if (Show) if (Show)
{ {
if (i < 0 || i > Parent->m_NB.size()-1) return; if (Parent->m_NB.size() == 0) return;
if (i < 0 || i > Parent->m_NB.size()-1) i = 0;
#ifdef _WIN32 #ifdef _WIN32
wxWindow *Win = Parent->GetWxWindow(wxT("Sound")); wxWindow *Win = Parent->GetWxWindow(wxT("Sound"));
if (Win && Parent->m_NB[i]->GetPageIndex(Win) != wxNOT_FOUND) return; if (Win && Parent->m_NB[i]->GetPageIndex(Win) != wxNOT_FOUND) return;

View File

@ -245,9 +245,13 @@ EVT_MENU(IDM_CONFIG_DSP_PLUGIN, CFrame::OnPluginDSP)
EVT_MENU(IDM_CONFIG_PAD_PLUGIN, CFrame::OnPluginPAD) EVT_MENU(IDM_CONFIG_PAD_PLUGIN, CFrame::OnPluginPAD)
EVT_MENU(IDM_CONFIG_WIIMOTE_PLUGIN, CFrame::OnPluginWiimote) EVT_MENU(IDM_CONFIG_WIIMOTE_PLUGIN, CFrame::OnPluginWiimote)
EVT_MENU(IDM_PERSPECTIVE_0, CFrame::OnToolBar) EVT_AUITOOLBAR_TOOL_DROPDOWN(IDM_SAVE_PERSPECTIVE, CFrame::OnDropDownToolbarItem)
EVT_MENU(IDM_PERSPECTIVE_1, CFrame::OnToolBar) EVT_MENU(IDM_SAVE_PERSPECTIVE, CFrame::OnToolBar)
EVT_MENU(IDM_ADD_PERSPECTIVE, CFrame::OnCreatePerspective)
EVT_MENU(IDM_PERSPECTIVES_ADD_PANE, CFrame::OnToolBar)
EVT_MENU(IDM_EDIT_PERSPECTIVES, CFrame::OnToolBar)
EVT_MENU(IDM_TAB_SPLIT, CFrame::OnToolBar) EVT_MENU(IDM_TAB_SPLIT, CFrame::OnToolBar)
EVT_MENU_RANGE(IDM_PERSPECTIVES_0, IDM_PERSPECTIVES_100, CFrame::OnSelectPerspective)
#if defined(HAVE_SFML) && HAVE_SFML #if defined(HAVE_SFML) && HAVE_SFML
EVT_MENU(IDM_NETPLAY, CFrame::OnNetPlay) EVT_MENU(IDM_NETPLAY, CFrame::OnNetPlay)
@ -301,6 +305,7 @@ EVT_TEXT(wxID_ANY, CFrame::PostEvent)
//EVT_MENU_HIGHLIGHT_ALL(CFrame::PostMenuEvent) //EVT_MENU_HIGHLIGHT_ALL(CFrame::PostMenuEvent)
//EVT_UPDATE_UI(wxID_ANY, CFrame::PostUpdateUIEvent) //EVT_UPDATE_UI(wxID_ANY, CFrame::PostUpdateUIEvent)
EVT_AUI_PANE_CLOSE(CFrame::OnPaneClose)
EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, CFrame::OnNotebookPageClose) EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, CFrame::OnNotebookPageClose)
EVT_AUINOTEBOOK_ALLOW_DND(wxID_ANY, CFrame::OnAllowNotebookDnD) EVT_AUINOTEBOOK_ALLOW_DND(wxID_ANY, CFrame::OnAllowNotebookDnD)
EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, CFrame::OnNotebookPageChanged) EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, CFrame::OnNotebookPageChanged)
@ -335,14 +340,14 @@ CFrame::CFrame(bool showLogWindow,
ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener(); ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener();
if (SConfig::GetInstance().m_InterfaceConsole) Console->Open(); if (SConfig::GetInstance().m_InterfaceConsole) Console->Open();
// Default
m_NB.resize(3); for (int i = 0; i < m_NB.size(); i++) m_NB[i] = NULL;
// Start debugging mazimized // Start debugging mazimized
if (UseDebugger) this->Maximize(true); if (UseDebugger) this->Maximize(true);
// Debugger class // Debugger class
if (UseDebugger) if (UseDebugger)
{
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, this); g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, this);
g_pCodeWindow->Hide();
}
// Create timer // Create timer
#if wxUSE_TIMER #if wxUSE_TIMER
@ -367,27 +372,10 @@ CFrame::CFrame(bool showLogWindow,
CreateMenu(); CreateMenu();
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Panels // Main panel
// ¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯
// This panel is the parent for rendering and it holds the gamelistctrl // This panel is the parent for rendering and it holds the gamelistctrl
m_Panel = new CPanel(this, IDM_MPANEL); m_Panel = new CPanel(this, IDM_MPANEL);
//wxPanel * m_Panel2 = new wxPanel(this, wxID_ANY);
static int Style = wxAUI_NB_TOP | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
wxBitmap aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
if (UseDebugger)
{
m_NB[0] = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
m_NB[1] = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
m_NB[2] = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
m_NB[g_pCodeWindow->iCodeWindow]->AddPage(g_pCodeWindow, wxT("Code"), false, aNormalFile);
}
else
{
m_NB[0] = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
}
// -------------------------------------------------------------------------
m_GameListCtrl = new CGameListCtrl(m_Panel, LIST_CTRL, m_GameListCtrl = new CGameListCtrl(m_Panel, LIST_CTRL,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
@ -396,56 +384,43 @@ CFrame::CFrame(bool showLogWindow,
sizerPanel = new wxBoxSizer(wxHORIZONTAL); sizerPanel = new wxBoxSizer(wxHORIZONTAL);
sizerPanel->Add(m_GameListCtrl, 1, wxEXPAND | wxALL); sizerPanel->Add(m_GameListCtrl, 1, wxEXPAND | wxALL);
m_Panel->SetSizer(sizerPanel); m_Panel->SetSizer(sizerPanel);
// -------------------------------------------------------------------------
m_Mgr = new wxAuiManager(); m_Mgr = new wxAuiManager();
m_Mgr->SetManagedWindow(this); m_Mgr->SetManagedWindow(this);
// Normal perspectives DefaultNBStyle = wxAUI_NB_TOP | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
/* wxBitmap aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
----------
| Pane 0 |
----------
-------------------
| Pane 0 | Pane 1 |
-------------------
*/
// Debug perspectives
/*
-------------------
| Pane 0 | |
|--------| Pane 2 |
| Pane 1 | |
-------------------
----------------------------
| Pane 0 | | |
|--------| Pane 2 | Pane 3 |
| Pane 1 | | |
----------------------------
*/
if (UseDebugger) if (UseDebugger)
{ {
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane0")).Caption(wxT("Pane0")).Hide()); //m_NB[g_pCodeWindow->iCodeWindow]->AddPage(g_pCodeWindow, wxT("Code"), false, aNormalFile);
m_Mgr->AddPane(m_NB[0], wxAuiPaneInfo().Name(wxT("Pane1")).Caption(wxT("Pane1")).Hide());
m_Mgr->AddPane(m_NB[1], wxAuiPaneInfo().Name(wxT("Pane2")).Caption(wxT("Pane2")).Hide());
m_Mgr->AddPane(m_NB[2], wxAuiPaneInfo().Name(wxT("Pane3")).Caption(wxT("Pane3")).Hide());
} }
else else
{ {
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane0")).Caption(wxT("Pane0")).Hide()); m_NB.push_back(new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle));
}
if (UseDebugger)
{
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane 0")).Caption(wxT("Pane 0")).Show());
}
else
{
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane 0")).Caption(wxT("Pane 0")).Hide());
m_Mgr->AddPane(m_NB[0], wxAuiPaneInfo().Name(wxT("Pane1")).Caption(wxT("Pane1")).Hide()); m_Mgr->AddPane(m_NB[0], wxAuiPaneInfo().Name(wxT("Pane1")).Caption(wxT("Pane1")).Hide());
} }
// Setup perspectives // Setup perspectives
if (UseDebugger) if (UseDebugger)
{ {
m_Mgr->GetPane(wxT("Pane0")).CenterPane().PaneBorder(false); m_Mgr->GetPane(wxT("Pane 0")).CenterPane().PaneBorder(true);
AuiFullscreen = m_Mgr->SavePerspective(); AuiFullscreen = m_Mgr->SavePerspective();
} }
else else
{ {
m_Mgr->GetPane(wxT("Pane0")).Show().PaneBorder(false).CaptionVisible(false).Layer(0).Center(); m_Mgr->GetPane(wxT("Pane 0")).Show().PaneBorder(false).CaptionVisible(false).Layer(0).Center();
AuiFullscreen = m_Mgr->SavePerspective(); AuiFullscreen = m_Mgr->SavePerspective();
} }
@ -456,48 +431,95 @@ CFrame::CFrame(bool showLogWindow,
// Setup perspectives // Setup perspectives
if (UseDebugger) if (UseDebugger)
{ {
m_Mgr->GetPane(wxT("Pane0")).Show().PaneBorder(true).CaptionVisible(false).Layer(0).Center().Position(0);
m_Mgr->GetPane(wxT("Pane1")).Show().PaneBorder(true).CaptionVisible(false).Layer(0).Center().Position(1);
m_Mgr->GetPane(wxT("Pane2")).Show().PaneBorder(true).CaptionVisible(false).Layer(0).Right();
AuiPerspective.Add(m_Mgr->SavePerspective());
m_Mgr->GetPane(wxT("Pane0")).Left();
m_Mgr->GetPane(wxT("Pane1")).Left();
m_Mgr->GetPane(wxT("Pane2")).Center();
m_Mgr->GetPane(wxT("Pane3")).Show().PaneBorder(true).CaptionVisible(false).Right();
AuiPerspective.Add(m_Mgr->SavePerspective());
// Load perspective // Load perspective
int iPerspective; std::vector<std::string> VPerspectives;
std::string _Perspectives;
IniFile ini; IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE); ini.Load(DEBUGGER_CONFIG_FILE);
ini.Get("Perspectives", "Perspective", &iPerspective, 0); ini.Get("Perspectives", "Perspectives", &_Perspectives, "");
ini.Get("Perspective 0", "LeftWidth", &iLeftWidth[0], 50); ini.Get("Perspectives", "Active", &ActivePerspective, 0);
ini.Get("Perspective 0", "AutomaticStart", &iLeftWidth[1], 33); SplitString(_Perspectives, ",", VPerspectives);
ini.Get("Perspective 1", "BootToPause", &iMidWidth[1], 33);
DoLoadPerspective(iPerspective); //
for (int i = 0; i < VPerspectives.size(); i++)
{
SPerspectives Tmp;
std::string _Section, _Perspective, _Width, _Height;
std::vector<std::string> _SWidth, _SHeight;
Tmp.Name = VPerspectives.at(i);
_Section = StringFromFormat("P - %s", Tmp.Name.c_str());
if (!ini.Exists(_Section.c_str(), "Width")) continue;
ini.Get(_Section.c_str(), "Perspective", &_Perspective, "");
ini.Get(_Section.c_str(), "Width", &_Width, "");
ini.Get(_Section.c_str(), "Height", &_Height, "");
Tmp.Perspective = wxString::FromAscii(_Perspective.c_str());
SplitString(_Width, ",", _SWidth);
SplitString(_Height, ",", _SHeight);
for (int i = 0; i < _SWidth.size(); i++)
{
int _Tmp;
if (TryParseInt(_SWidth.at(0).c_str(), &_Tmp)) Tmp.Width.push_back(_Tmp);
}
for (int i = 0; i < _SHeight.size(); i++)
{
int _Tmp;
if (TryParseInt(_SHeight.at(0).c_str(), &_Tmp)) Tmp.Height.push_back(_Tmp);
}
Perspectives.push_back(Tmp);
//Console->Log(LogTypes::LCUSTOM, StringFromFormat("Read: %s %s\n", _Width.c_str(), _Height.c_str()).c_str());
}
if (Perspectives.size() > 0)
{
// Create new panes with notebooks
for (int j = 0; j < Perspectives.at(0).Width.size() - 1; j++)
{
m_NB.push_back(new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle));
m_Mgr->AddPane(m_NB.at(m_NB.size()-1));
}
NamePanes();
std::vector<std::string> FormatNames;
SplitString(StringFromFormat("%s", Perspectives.at(0).Perspective.mb_str()), "|", FormatNames);
//Console->Log(LogTypes::LCUSTOM, StringFromFormat("Perspective: %s\n", Perspectives.at(0).Perspective.mb_str()).c_str());
for (int i = 0; i < FormatNames.size(); i++)
{
Console->Log(LogTypes::LCUSTOM, StringFromFormat("Perspective: %s\n", FormatNames.at(i).c_str()).c_str());
}
if (ActivePerspective >= Perspectives.size()) ActivePerspective = 0;
DoLoadPerspective(Perspectives.at(ActivePerspective).Perspective);
}
// Create one pane by default
else
{
m_NB.push_back(new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle));
m_Mgr->AddPane(m_NB.at(m_NB.size()-1));
}
//Console->Log(LogTypes::LCUSTOM, StringFromFormat("Panes: %i\n", m_Mgr->GetAllPanes().GetCount()).c_str());
} }
else else
{ {
m_Mgr->GetPane(wxT("Pane1")).Hide().PaneBorder(false).CaptionVisible(false).Layer(0).Right(); m_Mgr->GetPane(wxT("Pane1")).Hide().PaneBorder(false).CaptionVisible(false).Layer(0).Right();
} }
// Show titles to position the panes
/*
m_Mgr->GetPane(wxT("Pane0")).CaptionVisible(true);
m_Mgr->GetPane(wxT("Pane1")).CaptionVisible(true);
m_Mgr->GetPane(wxT("Pane2")).CaptionVisible(true);
m_Mgr->GetPane(wxT("Pane3")).CaptionVisible(true);
*/
// Show window // Show window
Show(); Show();
// Create list of available plugins for the configuration window // Create list of available plugins for the configuration window
CPluginManager::GetInstance().ScanForPlugins(); CPluginManager::GetInstance().ScanForPlugins();
// Load GUI settings
if (UseDebugger) g_pCodeWindow->Load();
// Open notebook pages // Open notebook pages
//if (UseDebugger) AddBlankPage(); if (UseDebugger) AddRemoveBlankPage();
if (UseDebugger) g_pCodeWindow->OpenPages(); if (UseDebugger) g_pCodeWindow->OpenPages();
if (m_bLogWindow) DoToggleWindow(IDM_LOGWINDOW, true); if (m_bLogWindow) DoToggleWindow(IDM_LOGWINDOW, true);
if (SConfig::GetInstance().m_InterfaceConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true); if (SConfig::GetInstance().m_InterfaceConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true);
@ -629,10 +651,11 @@ void CFrame::SetPaneSize(wxArrayInt Pane, wxArrayInt Size)
m_Mgr->GetPane(wxString::Format(wxT("Pane%i"), Pane[i])).MinSize(-1, -1).MaxSize(-1, -1); m_Mgr->GetPane(wxString::Format(wxT("Pane%i"), Pane[i])).MinSize(-1, -1).MaxSize(-1, -1);
} }
} }
void CFrame::DoLoadPerspective(int Perspective) void CFrame::DoLoadPerspective(wxString Perspective)
{ {
Save(); m_Mgr->LoadPerspective(Perspective, true);
/*
m_Mgr->LoadPerspective(AuiPerspective[Perspective], true); m_Mgr->LoadPerspective(AuiPerspective[Perspective], true);
int _iRightWidth, iClientSize = this->GetSize().GetX(); int _iRightWidth, iClientSize = this->GetSize().GetX();
@ -654,35 +677,104 @@ void CFrame::DoLoadPerspective(int Perspective)
i.Add(2); j.Add(iMidWidth[1]); i.Add(2); j.Add(iMidWidth[1]);
i.Add(3); j.Add(_iRightWidth); i.Add(3); j.Add(_iRightWidth);
//m_Mgr->GetPane(wxT("Pane0")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1); //m_Mgr->GetPane(wxT("Pane 0")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
//m_Mgr->GetPane(wxT("Pane1")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1); //m_Mgr->GetPane(wxT("Pane1")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
//m_Mgr->GetPane(wxT("Pane2")).BestSize(_iMidWidth, -1).MinSize(_iMidWidth, -1).MaxSize(_iMidWidth, -1); //m_Mgr->GetPane(wxT("Pane2")).BestSize(_iMidWidth, -1).MinSize(_iMidWidth, -1).MaxSize(_iMidWidth, -1);
//m_Mgr->GetPane(wxT("Pane3")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1); //m_Mgr->GetPane(wxT("Pane3")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1);
} }
SetPaneSize(i, j); SetPaneSize(i, j);
*/
} }
int CFrame::PixelsToPercentage(int Pixels, int Total)
{
int Percentage = (int)(((float)Pixels / (float)Total) * 100.0);
return Percentage;
}
void CFrame::NamePanes()
{
for (int i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{
m_Mgr->GetAllPanes().Item(i).Name(wxString::Format(wxT("Pane %i"), j));
m_Mgr->GetAllPanes().Item(i).Caption(wxString::Format(wxT("Pane %i"), j));
j++;
}
}
}
void CFrame::AddPane()
{
m_Mgr->AddPane(new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle));
NamePanes();
m_Mgr->Update();
}
void CFrame::OnPaneClose(wxAuiManagerEvent& event)
{
wxAuiNotebook * nb = (wxAuiNotebook*)event.pane->window;
if (!nb->GetPageCount() == 0 && !(nb->GetPageCount() == 1 && nb->GetPageText(0).IsSameAs(wxT("<>"))))
{
wxMessageBox(wxT("You can't close panes that have pages in them."),
wxT("Notice"),
wxOK,
this);
event.Veto();
return;
}
event.Skip();
m_Mgr->DetachPane(event.pane->window);
event.pane->window->Hide();
}
void CFrame::Save() void CFrame::Save()
{ {
if (!m_Mgr->GetPane(wxT("Pane0")).IsOk() || !m_Mgr->GetPane(wxT("Pane2")).IsOk() ) return; // Turn off edit before saving
TogglePaneStyle(false);
/**/
// Get client size // Get client size
int _iLeftWidth, _iMidWidth, iClientSize = this->GetSize().GetX(); int iClientX = this->GetSize().GetX(), iClientY = this->GetSize().GetY();;
_iLeftWidth = (int)(((float)m_Mgr->GetPane(wxT("Pane0")).window->GetClientSize().GetX() / (float)iClientSize) * 100.0);
_iMidWidth = (int)(((float)m_Mgr->GetPane(wxT("Pane2")).window->GetClientSize().GetX() / (float)iClientSize) * 100.0);
IniFile ini; IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE); ini.Load(DEBUGGER_CONFIG_FILE);
ini.Set("Perspectives", "Perspective", m_Mgr->GetPane(wxT("Pane3")).IsShown() ? 1 : 0); std::string _Section = StringFromFormat("P - %s", Perspectives.at(ActivePerspective).Name.c_str());
if (!m_Mgr->GetPane(wxT("Pane3")).IsShown()) ini.Set(_Section.c_str(), "Perspective", m_Mgr->SavePerspective().mb_str());
std::string SWidth = "", SHeight = "";
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{ {
ini.Set("Perspective 0", "LeftWidth", _iLeftWidth); if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{
SWidth += StringFromFormat("%i", PixelsToPercentage(m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetX(), iClientX));
SHeight += StringFromFormat("%i", PixelsToPercentage(m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetY(), iClientY));
SWidth += ","; SHeight += ",";
}
} }
else // Remove the ending ","
SWidth = SWidth.substr(0, SWidth.length()-1); SHeight = SHeight.substr(0, SHeight.length()-1);
ini.Set(_Section.c_str(), "Width", SWidth.c_str());
ini.Set(_Section.c_str(), "Height", SHeight.c_str());
// Save perspective names
std::string STmp = "";
for (int i = 0; i < Perspectives.size(); i++)
{ {
ini.Set("Perspective 1", "LeftWidth", _iLeftWidth); STmp += Perspectives.at(i).Name + ",";
ini.Set("Perspective 1", "MidWidth", _iMidWidth);
} }
STmp = STmp.substr(0, STmp.length()-1);
ini.Set("Perspectives", "Perspectives", STmp.c_str());
ini.Set("Perspectives", "Active", ActivePerspective);
ini.Save(DEBUGGER_CONFIG_FILE); ini.Save(DEBUGGER_CONFIG_FILE);
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
Console->Log(LogTypes::LCUSTOM, StringFromFormat("Saved: %s\n", STmp.c_str()).c_str());
TogglePaneStyle(m_ToolBarAui->GetToolToggled(IDM_EDIT_PERSPECTIVES));
} }
///////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -101,10 +101,9 @@ class CFrame : public wxFrame
wxAuiManager *m_Mgr; wxAuiManager *m_Mgr;
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui; wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
std::vector<wxAuiNotebook*> m_NB; std::vector<wxAuiNotebook*> m_NB;
int DefaultNBStyle;
int iLeftWidth[2], iMidWidth[2]; int iLeftWidth[2], iMidWidth[2];
// Perspectives // Perspectives
wxString AuiFullscreen, AuiCurrent;
wxArrayString AuiPerspective;
wxWindow * GetWxWindow(wxString); wxWindow * GetWxWindow(wxString);
#ifdef _WIN32 #ifdef _WIN32
wxWindow * GetWxWindowHwnd(HWND); wxWindow * GetWxWindowHwnd(HWND);
@ -116,15 +115,35 @@ class CFrame : public wxFrame
void OnNotebookPageChanged(wxAuiNotebookEvent& event); void OnNotebookPageChanged(wxAuiNotebookEvent& event);
int GetNootebookAffiliation(wxString Name); int GetNootebookAffiliation(wxString Name);
void DoToggleWindow(int,bool); void DoToggleWindow(int,bool);
void DoAddPage(wxWindow *, int, std::string);
void DoRemovePage(wxWindow *, bool Hide = true); void DoRemovePage(wxWindow *, bool Hide = true);
void DoRemovePageString(wxString, bool Hide = true); void DoRemovePageString(wxString, bool Hide = true);
void DoLoadPerspective(int);
void HidePane(); void HidePane();
void SetSimplePaneSize(); void SetSimplePaneSize();
void SetPaneSize(wxArrayInt,wxArrayInt); void SetPaneSize(wxArrayInt,wxArrayInt);
void TogglePaneStyle(bool);
void ToggleNotebookStyle(long); void ToggleNotebookStyle(long);
void Save();
void ResizeConsole(); void ResizeConsole();
// User perspectives
struct SPerspectives
{
std::string Name;
wxString Perspective;
std::vector<int> Width, Height;
};
std::vector<SPerspectives> Perspectives;
wxString AuiFullscreen, AuiCurrent;
wxArrayString AuiPerspective;
int ActivePerspective;
int PixelsToPercentage(int,int);
void NamePanes();
void AddPane();
void Save();
void OnPaneClose(wxAuiManagerEvent& evt);
void DoLoadPerspective(wxString);
void OnCreatePerspective(wxCommandEvent& event);
void OnDropDownToolbarItem(wxAuiToolBarEvent& event);
void OnSelectPerspective(wxCommandEvent& event);
private: private:

View File

@ -282,9 +282,12 @@ void CFrame::PopulateToolbarAui(wxAuiToolBar* ToolBar)
h = m_Bitmaps[Toolbar_FileOpen].GetHeight(); h = m_Bitmaps[Toolbar_FileOpen].GetHeight();
ToolBar->SetToolBitmapSize(wxSize(w, h)); ToolBar->SetToolBitmapSize(wxSize(w, h));
ToolBar->AddTool(IDM_PERSPECTIVE_0, wxT("View 1"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], wxT("View 1"), wxITEM_CHECK); ToolBar->AddTool(IDM_SAVE_PERSPECTIVE, wxT("Save"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], wxT("Save current perspective"));
ToolBar->AddTool(IDM_PERSPECTIVE_1, wxT("View 2"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], wxT("View 2"), wxITEM_CHECK); ToolBar->AddTool(IDM_PERSPECTIVES_ADD_PANE, wxT("Add"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], wxT("Add new pane"));
ToolBar->AddTool(IDM_TAB_SPLIT, wxT("Split"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], wxT("Tab Split"), wxITEM_CHECK); ToolBar->AddTool(IDM_EDIT_PERSPECTIVES, wxT("Edit"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], wxT("Edit current perspective"), wxITEM_CHECK);
ToolBar->AddTool(IDM_TAB_SPLIT, wxT("Split"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], wxT("Tab split"), wxITEM_CHECK);
ToolBar->SetToolDropDown(IDM_SAVE_PERSPECTIVE, true);
ToolBar->Realize(); ToolBar->Realize();
} }
@ -719,19 +722,103 @@ void CFrame::OnToolBar(wxCommandEvent& event)
{ {
switch (event.GetId()) switch (event.GetId())
{ {
case IDM_PERSPECTIVE_0: case IDM_SAVE_PERSPECTIVE:
m_ToolBarAui->ToggleTool(IDM_PERSPECTIVE_1, false); Save();
DoLoadPerspective(0);
break; break;
case IDM_PERSPECTIVES_ADD_PANE:
AddPane();
break;
/*
case IDM_PERSPECTIVE_1: case IDM_PERSPECTIVE_1:
m_ToolBarAui->ToggleTool(IDM_PERSPECTIVE_0, false); m_ToolBarAui->ToggleTool(IDM_PERSPECTIVE_0, false);
DoLoadPerspective(1); DoLoadPerspective(1);
break; break;
*/
case IDM_EDIT_PERSPECTIVES:
TogglePaneStyle(m_ToolBarAui->GetToolToggled(IDM_EDIT_PERSPECTIVES));
break;
case IDM_TAB_SPLIT: case IDM_TAB_SPLIT:
ToggleNotebookStyle(wxAUI_NB_TAB_SPLIT); ToggleNotebookStyle(wxAUI_NB_TAB_SPLIT);
break; break;
} }
} }
void CFrame::OnSelectPerspective(wxCommandEvent& event)
{
int _Selection = event.GetId() - IDM_PERSPECTIVES_0;
if (Perspectives.size() <= _Selection) return;
ActivePerspective = _Selection;
DoLoadPerspective(Perspectives.at(ActivePerspective).Perspective);
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
Console->Log(LogTypes::LCUSTOM, StringFromFormat("OnSelectPerspective: %i %s\n", _Selection, Perspectives.at(ActivePerspective).Name.c_str()).c_str());
}
void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event)
{
event.Skip();
if (event.IsDropDownClicked())
{
wxAuiToolBar* tb = static_cast<wxAuiToolBar*>(event.GetEventObject());
tb->SetToolSticky(event.GetId(), true);
// create the popup menu
wxMenu menuPopup;
wxMenuItem* m1 = new wxMenuItem(&menuPopup, IDM_ADD_PERSPECTIVE, wxT("Create new perspective"));
menuPopup.Append(m1);
if (Perspectives.size() > 0)
{
menuPopup.Append(new wxMenuItem(&menuPopup));
for (int i = 0; i < Perspectives.size(); i++)
{
wxMenuItem* Item = new wxMenuItem(&menuPopup, IDM_PERSPECTIVES_0 + i, wxString::FromAscii(Perspectives.at(i).Name.c_str()), wxT(""), wxITEM_CHECK);
menuPopup.Append(Item);
if (i == ActivePerspective) Item->Check(true);
}
}
// line up our menu with the button
wxRect rect = tb->GetToolRect(event.GetId());
wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft());
pt = ScreenToClient(pt);
PopupMenu(&menuPopup, pt);
// make sure the button is "un-stuck"
tb->SetToolSticky(event.GetId(), false);
}
}
void CFrame::OnCreatePerspective(wxCommandEvent& event)
{
wxTextEntryDialog dlg(this, wxT("Enter a name for the new perspective:"), wxT("Create new perspective"));
dlg.SetValue(wxString::Format(wxT("Perspective %u"), unsigned(Perspectives.size() + 1)));
if (dlg.ShowModal() != wxID_OK) return;
SPerspectives Tmp;
Tmp.Name = dlg.GetValue().mb_str();
Perspectives.push_back(Tmp);
//if (m_perspectives.GetCount() == 0) m_perspectives_menu->AppendSeparator();
// m_perspectives_menu->Append(ID_FirstPerspective + m_perspectives.GetCount(), dlg.GetValue());
//m_perspectives.Add(m_mgr.SavePerspective());
}
void CFrame::TogglePaneStyle(bool On)
{
wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes();
for (int i = 0; i < AllPanes.GetCount(); ++i)
{
wxAuiPaneInfo& Pane = AllPanes.Item(i);
if (Pane.window->IsKindOf(CLASSINFO(wxAuiNotebook)))
{
Pane.CaptionVisible(On);
Pane.Show();
}
}
m_Mgr->Update();
}
void CFrame::ToggleNotebookStyle(long Style) void CFrame::ToggleNotebookStyle(long Style)
{ {
wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes(); wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes();
@ -978,7 +1065,7 @@ wxWindow * CFrame::GetNootebookPage(wxString Name)
for (int i = 0; i < m_NB.size(); i++) for (int i = 0; i < m_NB.size(); i++)
{ {
if (!m_NB[i]) continue; if (!m_NB[i]) continue;
for(u32 j = 0; j < m_NB[j]->GetPageCount(); j++) for(u32 j = 0; j < m_NB[i]->GetPageCount(); j++)
{ {
if (m_NB[i]->GetPageText(j).IsSameAs(Name)) return m_NB[i]->GetPage(j); if (m_NB[i]->GetPageText(j).IsSameAs(Name)) return m_NB[i]->GetPage(j);
} }
@ -1011,11 +1098,11 @@ int CFrame::GetNootebookAffiliation(wxString Name)
} }
void CFrame::DoToggleWindow(int Id, bool Show) void CFrame::DoToggleWindow(int Id, bool Show)
{ {
switch (Id) switch (Id)
{ {
case IDM_LOGWINDOW: ToggleLogWindow(Show, UseDebugger ? g_pCodeWindow->iLogWindow : 0); break; case IDM_LOGWINDOW: ToggleLogWindow(Show, UseDebugger ? g_pCodeWindow->iLogWindow : 0); break;
case IDM_CONSOLEWINDOW: ToggleConsole(Show, UseDebugger ? g_pCodeWindow->iConsoleWindow : 0); break; case IDM_CONSOLEWINDOW: ToggleConsole(Show, UseDebugger ? g_pCodeWindow->iConsoleWindow : 0); break;
case IDM_CODEWINDOW: g_pCodeWindow->OnToggleCodeWindow(Show, g_pCodeWindow->iCodeWindow); break;
case IDM_REGISTERWINDOW: g_pCodeWindow->OnToggleRegisterWindow(Show, g_pCodeWindow->iRegisterWindow); break; case IDM_REGISTERWINDOW: g_pCodeWindow->OnToggleRegisterWindow(Show, g_pCodeWindow->iRegisterWindow); break;
case IDM_BREAKPOINTWINDOW: g_pCodeWindow->OnToggleBreakPointWindow(Show, g_pCodeWindow->iBreakpointWindow); break; case IDM_BREAKPOINTWINDOW: g_pCodeWindow->OnToggleBreakPointWindow(Show, g_pCodeWindow->iBreakpointWindow); break;
case IDM_MEMORYWINDOW: g_pCodeWindow->OnToggleMemoryWindow(Show, g_pCodeWindow->iMemoryWindow); break; case IDM_MEMORYWINDOW: g_pCodeWindow->OnToggleMemoryWindow(Show, g_pCodeWindow->iMemoryWindow); break;
@ -1092,12 +1179,21 @@ void CFrame::DoRemovePageString(wxString Str, bool Hide)
} }
//if (Hide) Win->Hide(); //if (Hide) Win->Hide();
} }
void CFrame::DoAddPage(wxWindow * Win, int i, std::string Name)
{
if (!Win) return;
if (m_NB.size() == 0) return;
if (i < 0 || i > m_NB.size()-1) i = 0;
if (Win && m_NB[i]->GetPageIndex(Win) != wxNOT_FOUND) return;
m_NB[i]->AddPage(Win, wxString::FromAscii(Name.c_str()), true, aNormalFile );
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
Console->Log(LogTypes::LCUSTOM, StringFromFormat("Add: %s\n", Name.c_str()).c_str());
}
void CFrame::DoRemovePage(wxWindow * Win, bool Hide) void CFrame::DoRemovePage(wxWindow * Win, bool Hide)
{ {
// If m_dialog is NULL, then possibly the system // If m_dialog is NULL, then possibly the system didn't report the checked menu item status correctly.
// didn't report the checked menu item status correctly. // It should be true just after the menu item was selected, if there was no modeless dialog yet.
// It should be true just after the menu item was selected,
// if there was no modeless dialog yet.
wxASSERT(Win != NULL); wxASSERT(Win != NULL);
if (Win) if (Win)
@ -1157,11 +1253,8 @@ void CFrame::ToggleLogWindow(bool Show, int i)
SConfig::GetInstance().m_InterfaceLogWindow = Show; SConfig::GetInstance().m_InterfaceLogWindow = Show;
if (Show) if (Show)
{ {
if (!m_NB[i]) return;
if (m_LogWindow && m_NB[i]->GetPageIndex(m_LogWindow) != wxNOT_FOUND) return;
if (!m_LogWindow) m_LogWindow = new CLogWindow(this); if (!m_LogWindow) m_LogWindow = new CLogWindow(this);
m_NB[i]->AddPage(m_LogWindow, wxT("Log"), true, aNormalFile); DoAddPage(m_LogWindow, i, "Log");
} }
else else
{ {
@ -1186,7 +1279,8 @@ void CFrame::ToggleConsole(bool Show, int i)
if (Show) if (Show)
{ {
if (i < 0 || i > m_NB.size()-1) return; if (m_NB.size() == 0) return;
if (i < 0 || i > m_NB.size()-1) i = 0;
#ifdef _WIN32 #ifdef _WIN32
wxWindow *Win = GetWxWindowHwnd(GetConsoleWindow()); wxWindow *Win = GetWxWindowHwnd(GetConsoleWindow());
if (Win && m_NB[i]->GetPageIndex(Win) != wxNOT_FOUND) return; if (Win && m_NB[i]->GetPageIndex(Win) != wxNOT_FOUND) return;

View File

@ -177,9 +177,13 @@ enum
IDM_ADDRBOX, IDM_ADDRBOX,
ID_TOOLBAR_AUI, ID_TOOLBAR_AUI,
IDM_PERSPECTIVE_0, IDM_SAVE_PERSPECTIVE,
IDM_PERSPECTIVE_1, IDM_ADD_PERSPECTIVE,
IDM_PERSPECTIVES_ADD_PANE,
IDM_EDIT_PERSPECTIVES,
IDM_TAB_SPLIT, IDM_TAB_SPLIT,
IDM_PERSPECTIVES_0,
IDM_PERSPECTIVES_100 = IDM_PERSPECTIVES_0 + 100,
// -------------------------------------------------------------- // --------------------------------------------------------------
IDM_TOGGLE_DUALCORE, // Other IDM_TOGGLE_DUALCORE, // Other

View File

@ -286,9 +286,7 @@ bool DolphinApp::OnInit()
// If we are debugging let use save the main window position and size // If we are debugging let use save the main window position and size
IniFile ini; IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE); ini.Load(DEBUGGER_CONFIG_FILE);
int x, y, w, h; int x, y, w, h;
ini.Get("MainWindow", "x", &x, 100); ini.Get("MainWindow", "x", &x, 100);
ini.Get("MainWindow", "y", &y, 100); ini.Get("MainWindow", "y", &y, 100);
ini.Get("MainWindow", "w", &w, 800); ini.Get("MainWindow", "w", &w, 800);