mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
GUI: File split
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4142 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -721,147 +721,6 @@ void CFrame::OnToolBar(wxCommandEvent& event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
void CFrame::OnSelectPerspective(wxCommandEvent& event)
|
||||
{
|
||||
int _Selection = event.GetId() - IDM_PERSPECTIVES_0;
|
||||
if (Perspectives.size() <= _Selection) _Selection = 0;
|
||||
ActivePerspective = _Selection;
|
||||
DoLoadPerspective();
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes();
|
||||
for (int i = 0, Count = AllPanes.GetCount(); i < Count; ++i)
|
||||
{
|
||||
wxAuiPaneInfo& Pane = AllPanes.Item(i);
|
||||
if (Pane.window->IsKindOf(CLASSINFO(wxAuiNotebook)))
|
||||
{
|
||||
wxAuiNotebook* NB = (wxAuiNotebook*)Pane.window;
|
||||
NB->SetWindowStyleFlag(NB->GetWindowStyleFlag() ^ Style);
|
||||
NB->Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
void CFrame::ResizeConsole()
|
||||
{
|
||||
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
|
||||
for(u32 j = 0; j <= wxDynamicCast(m_Mgr->GetAllPanes().Item(i).window, wxAuiNotebook)->GetPageCount(); j++)
|
||||
{
|
||||
if (wxDynamicCast(m_Mgr->GetAllPanes().Item(i).window, wxAuiNotebook)->GetPageText(j).IsSameAs(wxT("Console")))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// ----------------------------------------------------------
|
||||
// Get OS version
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int wxBorder, Border, LowerBorder, MenuBar, ScrollBar, WidthReduction;
|
||||
OSVERSIONINFO osvi;
|
||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
GetVersionEx(&osvi);
|
||||
if (osvi.dwMajorVersion == 6) // Vista (same as 7?)
|
||||
{
|
||||
wxBorder = 2;
|
||||
Border = 4;
|
||||
LowerBorder = 6;
|
||||
MenuBar = 30; // Including upper border
|
||||
ScrollBar = 19;
|
||||
}
|
||||
else // XP
|
||||
{
|
||||
wxBorder = 2;
|
||||
Border = 4;
|
||||
LowerBorder = 6;
|
||||
MenuBar = 30;
|
||||
ScrollBar = 19;
|
||||
}
|
||||
WidthReduction = 30 - Border;
|
||||
// --------------------------------
|
||||
// Get the client size
|
||||
int X = m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetX();
|
||||
int Y = m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetY();
|
||||
int InternalWidth = X - wxBorder*2 - ScrollBar;
|
||||
int InternalHeight = Y - wxBorder*2;
|
||||
int WindowWidth = InternalWidth + Border*2;
|
||||
int WindowHeight = InternalHeight;
|
||||
// Resize buffer
|
||||
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||
//Console->Log(LogTypes::LNOTICE, StringFromFormat("Window WxH:%i %i\n", X, Y).c_str());
|
||||
Console->PixelSpace(0,0, InternalWidth,InternalHeight, false);
|
||||
// Move the window to hide the border
|
||||
MoveWindow(GetConsoleWindow(), -Border-wxBorder,-MenuBar-wxBorder, WindowWidth + 100,WindowHeight, true);
|
||||
// Move it to the bottom of the view order so that it doesn't hide the notebook tabs
|
||||
// ...
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -992,465 +851,13 @@ void CFrame::OnFrameSkip(wxCommandEvent& event)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Notebooks
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef _WIN32
|
||||
wxWindow * CFrame::GetWxWindowHwnd(HWND hWnd)
|
||||
{
|
||||
wxWindow * Win = new wxWindow();
|
||||
Win->SetHWND((WXHWND)hWnd);
|
||||
Win->AdoptAttributesFromHWND();
|
||||
return Win;
|
||||
}
|
||||
#endif
|
||||
wxWindow * CFrame::GetWxWindow(wxString Name)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HWND hWnd = ::FindWindow(NULL, Name.c_str());
|
||||
if (hWnd)
|
||||
{
|
||||
wxWindow * Win = new wxWindow();
|
||||
Win->SetHWND((WXHWND)hWnd);
|
||||
Win->AdoptAttributesFromHWND();
|
||||
return Win;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (FindWindowByName(Name))
|
||||
{
|
||||
return FindWindowByName(Name);
|
||||
}
|
||||
else if (FindWindowByLabel(Name))
|
||||
{
|
||||
return FindWindowByLabel(Name);
|
||||
}
|
||||
else if (GetNootebookPage(Name))
|
||||
{
|
||||
return GetNootebookPage(Name);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
wxWindow * CFrame::GetNootebookPage(wxString Name)
|
||||
{
|
||||
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
|
||||
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
|
||||
for(u32 j = 0; j < NB->GetPageCount(); j++)
|
||||
{
|
||||
if (NB->GetPageText(j).IsSameAs(Name)) return NB->GetPage(j);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
void CFrame::AddRemoveBlankPage()
|
||||
{
|
||||
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
|
||||
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
|
||||
for(u32 j = 0; j < NB->GetPageCount(); j++)
|
||||
{
|
||||
if (NB->GetPageText(j).IsSameAs(wxT("<>")) && NB->GetPageCount() > 1) NB->DeletePage(j);
|
||||
}
|
||||
if (NB->GetPageCount() == 0) NB->AddPage(CreateEmptyPanel(), wxT("<>"), true);
|
||||
}
|
||||
}
|
||||
int CFrame::GetNootebookAffiliation(wxString Name)
|
||||
{
|
||||
for (int i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
|
||||
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
|
||||
for(u32 k = 0; k < NB->GetPageCount(); k++)
|
||||
{
|
||||
if (NB->GetPageText(k).IsSameAs(Name)) return j;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
void CFrame::ClosePages()
|
||||
{
|
||||
DoToggleWindow(IDM_LOGWINDOW, false);
|
||||
DoToggleWindow(IDM_CONSOLEWINDOW, false);
|
||||
DoToggleWindow(IDM_CODEWINDOW, false);
|
||||
DoToggleWindow(IDM_REGISTERWINDOW, false);
|
||||
DoToggleWindow(IDM_BREAKPOINTWINDOW, false);
|
||||
DoToggleWindow(IDM_MEMORYWINDOW, false);
|
||||
DoToggleWindow(IDM_JITWINDOW, false);
|
||||
DoToggleWindow(IDM_SOUNDWINDOW, false);
|
||||
DoToggleWindow(IDM_VIDEOWINDOW, false);
|
||||
}
|
||||
void CFrame::DoToggleWindow(int Id, bool Show)
|
||||
{
|
||||
switch (Id)
|
||||
{
|
||||
case IDM_LOGWINDOW: ToggleLogWindow(Show, UseDebugger ? g_pCodeWindow->iLogWindow : 0); break;
|
||||
case IDM_CONSOLEWINDOW: ToggleConsole(Show, UseDebugger ? g_pCodeWindow->iConsoleWindow : 0); break;
|
||||
}
|
||||
|
||||
if (!UseDebugger) return;
|
||||
|
||||
switch (Id)
|
||||
{
|
||||
case IDM_CODEWINDOW: g_pCodeWindow->OnToggleCodeWindow(Show, g_pCodeWindow->iCodeWindow); 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_MEMORYWINDOW: g_pCodeWindow->OnToggleMemoryWindow(Show, g_pCodeWindow->iMemoryWindow); break;
|
||||
case IDM_JITWINDOW: g_pCodeWindow->OnToggleJitWindow(Show, g_pCodeWindow->iJitWindow); break;
|
||||
case IDM_SOUNDWINDOW: g_pCodeWindow->OnToggleSoundWindow(Show, g_pCodeWindow->iSoundWindow); break;
|
||||
case IDM_VIDEOWINDOW: g_pCodeWindow->OnToggleVideoWindow(Show, g_pCodeWindow->iVideoWindow); break;
|
||||
}
|
||||
}
|
||||
void CFrame::OnNotebookPageChanged(wxAuiNotebookEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
if (!UseDebugger) return;
|
||||
|
||||
// Remove the blank page if any
|
||||
AddRemoveBlankPage();
|
||||
|
||||
// Update the notebook affiliation
|
||||
if(GetNootebookAffiliation(wxT("Log")) >= 0) g_pCodeWindow->iLogWindow = GetNootebookAffiliation(wxT("Log"));
|
||||
if(GetNootebookAffiliation(wxT("Console")) >= 0) g_pCodeWindow->iConsoleWindow = GetNootebookAffiliation(wxT("Console"));
|
||||
if(GetNootebookAffiliation(wxT("Code")) >= 0) g_pCodeWindow->iCodeWindow = GetNootebookAffiliation(wxT("Code"));
|
||||
if(GetNootebookAffiliation(wxT("Registers")) >= 0) g_pCodeWindow->iRegisterWindow = GetNootebookAffiliation(wxT("Registers"));
|
||||
if(GetNootebookAffiliation(wxT("Breakpoints")) >= 0) g_pCodeWindow->iBreakpointWindow = GetNootebookAffiliation(wxT("Breakpoints"));
|
||||
if(GetNootebookAffiliation(wxT("JIT")) >= 0) g_pCodeWindow->iJitWindow = GetNootebookAffiliation(wxT("JIT"));
|
||||
if(GetNootebookAffiliation(wxT("Memory")) >= 0) g_pCodeWindow->iMemoryWindow = GetNootebookAffiliation(wxT("Memory"));
|
||||
if(GetNootebookAffiliation(wxT("Sound")) >= 0) g_pCodeWindow->iSoundWindow = GetNootebookAffiliation(wxT("Sound"));
|
||||
if(GetNootebookAffiliation(wxT("Video")) >= 0) g_pCodeWindow->iVideoWindow = GetNootebookAffiliation(wxT("Video"));
|
||||
}
|
||||
void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event)
|
||||
{
|
||||
// Override event
|
||||
event.Veto();
|
||||
|
||||
wxAuiNotebook* Ctrl = (wxAuiNotebook*)event.GetEventObject();
|
||||
|
||||
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Log"))) { GetMenuBar()->FindItem(IDM_LOGWINDOW)->Check(false); DoToggleWindow(IDM_LOGWINDOW, false); }
|
||||
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Console"))) { GetMenuBar()->FindItem(IDM_CONSOLEWINDOW)->Check(false); DoToggleWindow(IDM_CONSOLEWINDOW, false); }
|
||||
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Registers"))) { GetMenuBar()->FindItem(IDM_REGISTERWINDOW)->Check(false); DoToggleWindow(IDM_REGISTERWINDOW, false); }
|
||||
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Breakpoints"))) { GetMenuBar()->FindItem(IDM_BREAKPOINTWINDOW)->Check(false); DoToggleWindow(IDM_BREAKPOINTWINDOW, false); }
|
||||
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("JIT"))) { GetMenuBar()->FindItem(IDM_JITWINDOW)->Check(false); DoToggleWindow(IDM_JITWINDOW, false); }
|
||||
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Memory"))) { GetMenuBar()->FindItem(IDM_MEMORYWINDOW)->Check(false); DoToggleWindow(IDM_MEMORYWINDOW, false); }
|
||||
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Sound"))) { GetMenuBar()->FindItem(IDM_SOUNDWINDOW)->Check(false); DoToggleWindow(IDM_SOUNDWINDOW, false); }
|
||||
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Video"))) { GetMenuBar()->FindItem(IDM_VIDEOWINDOW)->Check(false); DoToggleWindow(IDM_VIDEOWINDOW, false); }
|
||||
}
|
||||
void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
event.Allow();
|
||||
wxAuiNotebook* Ctrl = (wxAuiNotebook*)event.GetEventObject();
|
||||
// If we drag away the last one the tab bar goes away and we can't add any panes to it
|
||||
//if (Ctrl->GetPageCount() == 1) Ctrl->AddPage(CreateEmptyPanel(), wxT("<>"), true);
|
||||
}
|
||||
void CFrame::HidePane()
|
||||
{
|
||||
// Get the first notebook
|
||||
wxAuiNotebook * NB;
|
||||
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook)))
|
||||
NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
|
||||
}
|
||||
if (NB->GetPageCount() == 0)
|
||||
m_Mgr->GetPane(wxT("Pane 1")).Hide();
|
||||
else
|
||||
m_Mgr->GetPane(wxT("Pane 1")).Show();
|
||||
m_Mgr->Update();
|
||||
|
||||
SetSimplePaneSize();
|
||||
}
|
||||
void CFrame::DoRemovePageString(wxString Str, bool Hide, bool Destroy)
|
||||
{
|
||||
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
|
||||
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
|
||||
for (int j = 0; j < NB->GetPageCount(); j++)
|
||||
{
|
||||
if (NB->GetPageText(j).IsSameAs(Str))
|
||||
{
|
||||
if (!Destroy)
|
||||
{
|
||||
// Reparent to avoid destruction if the notebook is closed and destroyed
|
||||
wxWindow * Win = NB->GetPage(j);
|
||||
NB->RemovePage(j);
|
||||
Win->Reparent(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
NB->DeletePage(j);
|
||||
}
|
||||
//if (Hide) Win->Hide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
wxAuiNotebook * CFrame::GetNotebook(int NBId)
|
||||
{
|
||||
int Ret = 0;
|
||||
for (int i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
|
||||
if (j == NBId) return (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
|
||||
j++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
void CFrame::ShowAllNotebooks(bool Window)
|
||||
{
|
||||
for (int i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook)))
|
||||
{
|
||||
if (Window)
|
||||
m_Mgr->GetAllPanes().Item(i).Show();
|
||||
else
|
||||
m_Mgr->GetAllPanes().Item(i).window->Hide();
|
||||
}
|
||||
}
|
||||
m_Mgr->Update();
|
||||
}
|
||||
void CFrame::HideAllNotebooks(bool Window)
|
||||
{
|
||||
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook)))
|
||||
{
|
||||
if (Window)
|
||||
m_Mgr->GetAllPanes().Item(i).Hide();
|
||||
else
|
||||
m_Mgr->GetAllPanes().Item(i).window->Hide();
|
||||
}
|
||||
}
|
||||
m_Mgr->Update();
|
||||
}
|
||||
// Close all panes with notebooks
|
||||
void CFrame::CloseAllNotebooks()
|
||||
{
|
||||
int i = 0;
|
||||
while(GetNotebookCount() > 0)
|
||||
{
|
||||
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook)))
|
||||
{
|
||||
m_Mgr->GetAllPanes().Item(i).DestroyOnClose(true);
|
||||
m_Mgr->ClosePane(m_Mgr->GetAllPanes().Item(i));
|
||||
//m_Mgr->GetAllPanes().Item(i).window->Hide();
|
||||
//m_Mgr->DetachPane(m_Mgr->GetAllPanes().Item(i).window);
|
||||
|
||||
i = 0;
|
||||
//Console->Log(LogTypes::LCUSTOM, StringFromFormat(" %i Pane\n", i).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
//Console->Log(LogTypes::LCUSTOM, StringFromFormat(" %i No pane\n", i).c_str());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
int CFrame::GetNotebookCount()
|
||||
{
|
||||
int Ret = 0;
|
||||
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) Ret++;
|
||||
}
|
||||
return Ret;
|
||||
}
|
||||
void CFrame::DoAddPage(wxWindow * Win, int i, std::string Name)
|
||||
{
|
||||
if (!Win) return;
|
||||
if (GetNotebookCount() == 0) return;
|
||||
if (i < 0 || i > GetNotebookCount()-1) i = 0;
|
||||
if (Win && GetNotebook(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
|
||||
GetNotebook(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)
|
||||
{
|
||||
// If m_dialog is NULL, then possibly the system 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.
|
||||
//wxASSERT(Win != NULL);
|
||||
|
||||
if (Win)
|
||||
{
|
||||
for (int i = 0; i < GetNotebookCount(); i++)
|
||||
{
|
||||
if (GetNotebook(i)->GetPageIndex(Win) != wxNOT_FOUND) GetNotebook(i)->RemovePage(GetNotebook(i)->GetPageIndex(Win));
|
||||
}
|
||||
// Reparent to avoid destruction if the notebook is closed and destroyed
|
||||
Win->Reparent(this);
|
||||
|
||||
if (Hide) Win->Hide();
|
||||
}
|
||||
}
|
||||
|
||||
// Enable and disable the toolbar
|
||||
void CFrame::OnToggleToolbar(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_InterfaceToolbar = event.IsChecked();
|
||||
DoToggleToolbar(event.IsChecked());
|
||||
}
|
||||
void CFrame::DoToggleToolbar(bool Show)
|
||||
{
|
||||
if (Show)
|
||||
{
|
||||
m_Mgr->GetPane(wxT("TBMain")).Show();
|
||||
if (UseDebugger) { m_Mgr->GetPane(wxT("TBDebug")).Show(); m_Mgr->GetPane(wxT("TBAui")).Show(); }
|
||||
m_Mgr->Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mgr->GetPane(wxT("TBMain")).Hide();
|
||||
if (UseDebugger) { m_Mgr->GetPane(wxT("TBDebug")).Hide(); m_Mgr->GetPane(wxT("TBAui")).Hide(); }
|
||||
m_Mgr->Update();
|
||||
}
|
||||
}
|
||||
|
||||
// Enable and disable the status bar
|
||||
void CFrame::OnToggleStatusbar(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_InterfaceStatusbar = event.IsChecked();
|
||||
if (SConfig::GetInstance().m_InterfaceStatusbar == true)
|
||||
m_pStatusBar->Show();
|
||||
else
|
||||
m_pStatusBar->Hide();
|
||||
|
||||
this->SendSizeEvent();
|
||||
}
|
||||
|
||||
// Enable and disable the log window
|
||||
void CFrame::OnToggleLogWindow(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_InterfaceLogWindow = event.IsChecked();
|
||||
DoToggleWindow(event.GetId(), event.IsChecked());
|
||||
}
|
||||
void CFrame::ToggleLogWindow(bool Show, int i)
|
||||
{
|
||||
if (Show)
|
||||
{
|
||||
if (!m_LogWindow) m_LogWindow = new CLogWindow(this);
|
||||
#ifdef _WIN32
|
||||
DoAddPage(m_LogWindow, i, "Log");
|
||||
#else
|
||||
m_LogWindow->Show();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _WIN32
|
||||
DoRemovePage(m_LogWindow);
|
||||
#else
|
||||
if (m_LogWindow) m_LogWindow->Show();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Hide pane
|
||||
if (!UseDebugger) HidePane();
|
||||
|
||||
// Make sure the check is updated (if wxw isn't calling this func)
|
||||
//GetMenuBar()->FindItem(IDM_LOGWINDOW)->Check(Show);
|
||||
}
|
||||
// Enable and disable the console
|
||||
void CFrame::OnToggleConsole(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_InterfaceConsole = event.IsChecked();
|
||||
DoToggleWindow(event.GetId(), event.IsChecked());
|
||||
}
|
||||
void CFrame::ToggleConsole(bool Show, int i)
|
||||
{
|
||||
ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener();
|
||||
|
||||
if (Show)
|
||||
{
|
||||
//Console->Log(LogTypes::LCUSTOM, StringFromFormat(" >>> Show\n").c_str());
|
||||
|
||||
if (GetNotebookCount() == 0) return;
|
||||
if (i < 0 || i > GetNotebookCount()-1) i = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
wxWindow *Win = GetWxWindowHwnd(GetConsoleWindow());
|
||||
if (Win && GetNotebook(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
|
||||
{
|
||||
#else
|
||||
Console->Open();
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
if(!GetConsoleWindow()) Console->Open(); else ShowWindow(GetConsoleWindow(),SW_SHOW);
|
||||
}
|
||||
Win = GetWxWindowHwnd(GetConsoleWindow());
|
||||
// Can we remove the border?
|
||||
//Win->SetWindowStyleFlag(wxNO_BORDER);
|
||||
//SetWindowLong(GetConsoleWindow(), GWL_STYLE, WS_VISIBLE);
|
||||
// Create parent window
|
||||
wxPanel * ConsoleParent = CreateEmptyPanel();
|
||||
::SetParent(GetConsoleWindow(), (HWND)ConsoleParent->GetHWND());
|
||||
//Win->SetParent(ConsoleParent);
|
||||
//if (Win) m_Mgr->GetAllPanes().Item(i)->AddPage(Win, wxT("Console"), true, aNormalFile );
|
||||
if (Win) GetNotebook(i)->AddPage(ConsoleParent, wxT("Console"), true, aNormalFile );
|
||||
#endif
|
||||
}
|
||||
else // hide
|
||||
{
|
||||
//Console->Log(LogTypes::LCUSTOM, StringFromFormat(" >>> Show\n").c_str());
|
||||
|
||||
#ifdef _WIN32
|
||||
// Hide
|
||||
if(GetConsoleWindow()) ShowWindow(GetConsoleWindow(),SW_HIDE);
|
||||
// Release the console to Windows
|
||||
::SetParent(GetConsoleWindow(), NULL);
|
||||
// Destroy the empty parent of the console
|
||||
DoRemovePageString(wxT("Console"), true, true);
|
||||
|
||||
#else
|
||||
Console->Close();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Hide pane
|
||||
if (!UseDebugger) HidePane();
|
||||
|
||||
// Make sure the check is updated (if wxw isn't calling this func)
|
||||
//GetMenuBar()->FindItem(IDM_CONSOLEWINDOW)->Check(Show);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// GUI
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void CFrame::OnManagerResize(wxAuiManagerEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
ResizeConsole();
|
||||
}
|
||||
void CFrame::OnResize(wxSizeEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
// fit frame content, not needed right now
|
||||
//FitInside();
|
||||
DoMoveIcons(); // In FrameWiimote.cpp
|
||||
}
|
||||
|
||||
// Update the enabled/disabled status
|
||||
void CFrame::UpdateGUI()
|
||||
{
|
||||
return;
|
||||
|
||||
// Save status
|
||||
bool initialized = Core::isRunning();
|
||||
bool running = Core::GetState() == Core::CORE_RUN;
|
||||
|
Reference in New Issue
Block a user