107 changes: 4 additions & 103 deletions Source/Core/DolphinWX/FrameAui.cpp
Expand Up @@ -57,7 +57,6 @@ void CFrame::OnManagerResize(wxAuiManagerEvent& event)
m_LogWindow->winpos = m_Mgr->GetPane(_T("Pane 1")).dock_direction;
}
event.Skip();
ResizeConsole();
}

void CFrame::OnPaneClose(wxAuiManagerEvent& event)
Expand All @@ -70,14 +69,11 @@ void CFrame::OnPaneClose(wxAuiManagerEvent& event)
if (!g_pCodeWindow)
{
if (nb->GetPage(0)->GetId() == IDM_LOGWINDOW ||
nb->GetPage(0)->GetId() == IDM_LOGCONFIGWINDOW ||
nb->GetPage(0)->GetId() == IDM_CONSOLEWINDOW)
nb->GetPage(0)->GetId() == IDM_LOGCONFIGWINDOW)
{
// Closing a pane containing the logwindow or a console closes both
SConfig::GetInstance().m_InterfaceConsole = false;

SConfig::GetInstance().m_InterfaceLogWindow = false;
SConfig::GetInstance().m_InterfaceLogConfigWindow = false;
ToggleConsole(false);
ToggleLogWindow(false);
ToggleLogConfigWindow(false);
}
Expand Down Expand Up @@ -163,59 +159,6 @@ void CFrame::ToggleLogConfigWindow(bool bShow)
TogglePane();
}

void CFrame::ToggleConsole(bool bShow)
{
#ifdef _WIN32
GetMenuBar()->FindItem(IDM_CONSOLEWINDOW)->Check(bShow);

if (bShow)
{
// If the console doesn't exist, we create it
if (!GetConsoleWindow())
{
ConsoleListener *Console = LogManager::GetInstance()->GetConsoleListener();
Console->Open();
}
else
{
ShowWindow(GetConsoleWindow(), SW_SHOW);
}

// Create the parent window if it doesn't exist
wxPanel *ConsoleParent = (wxPanel*)FindWindowById(IDM_CONSOLEWINDOW);
if (!ConsoleParent) ConsoleParent = new wxPanel(this, IDM_CONSOLEWINDOW,
wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _("Console"));

wxWindow *ConsoleWin = new wxWindow();
ConsoleWin->SetHWND((WXHWND)GetConsoleWindow());
ConsoleWin->AdoptAttributesFromHWND();
ConsoleWin->Reparent(ConsoleParent);

ConsoleParent->Enable();
const int nbIndex = IDM_CONSOLEWINDOW - IDM_LOGWINDOW;
DoAddPage(ConsoleParent,
g_pCodeWindow ? g_pCodeWindow->iNbAffiliation[nbIndex] : 0,
g_pCodeWindow ? bFloatWindow[nbIndex] : false);
}
else // Hide
{
if(GetConsoleWindow())
ShowWindow(GetConsoleWindow(), SW_HIDE); // WIN32

wxPanel *ConsoleParent = (wxPanel*)FindWindowById(IDM_CONSOLEWINDOW);
if (ConsoleParent)
ConsoleParent->Disable();

// Then close the page
DoRemovePage(ConsoleParent, true);
}

// Hide or Show the pane
if (!g_pCodeWindow)
TogglePane();
#endif
}

void CFrame::OnToggleWindow(wxCommandEvent& event)
{
bool bShow = GetMenuBar()->IsChecked(event.GetId());
Expand All @@ -232,11 +175,6 @@ void CFrame::OnToggleWindow(wxCommandEvent& event)
SConfig::GetInstance().m_InterfaceLogConfigWindow = bShow;
ToggleLogConfigWindow(bShow);
break;
case IDM_CONSOLEWINDOW:
if (!g_pCodeWindow)
SConfig::GetInstance().m_InterfaceConsole = bShow;
ToggleConsole(bShow);
break;
case IDM_REGISTERWINDOW:
g_pCodeWindow->ToggleRegisterWindow(bShow);
break;
Expand Down Expand Up @@ -264,7 +202,7 @@ void CFrame::ClosePages()
{
ToggleLogWindow(false);
ToggleLogConfigWindow(false);
ToggleConsole(false);

if (g_pCodeWindow)
{
g_pCodeWindow->ToggleCodeWindow(false);
Expand Down Expand Up @@ -306,8 +244,6 @@ void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event)
ToggleLogWindow(false);
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_LOGCONFIGWINDOW)
ToggleLogConfigWindow(false);
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_CONSOLEWINDOW)
ToggleConsole(false);
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_REGISTERWINDOW)
g_pCodeWindow->ToggleRegisterWindow(false);
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_BREAKPOINTWINDOW)
Expand All @@ -330,7 +266,6 @@ void CFrame::OnFloatingPageClosed(wxCloseEvent& event)
void CFrame::OnFloatingPageSize(wxSizeEvent& event)
{
event.Skip();
ResizeConsole();
}

void CFrame::OnFloatWindow(wxCommandEvent& event)
Expand Down Expand Up @@ -393,8 +328,7 @@ void CFrame::OnTab(wxAuiNotebookEvent& event)
// Create the popup menu
wxMenu* MenuPopup = new wxMenu;

wxMenuItem* Item = new wxMenuItem(MenuPopup, wxID_ANY,
_("Select floating windows"));
wxMenuItem* Item = new wxMenuItem(MenuPopup, wxID_ANY, _("Select floating windows"));
MenuPopup->Append(Item);
Item->Enable(false);
MenuPopup->Append(new wxMenuItem(MenuPopup));
Expand Down Expand Up @@ -423,7 +357,6 @@ void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event)
{
event.Skip();
event.Allow();
ResizeConsole();
}

void CFrame::ShowResizePane()
Expand Down Expand Up @@ -803,33 +736,6 @@ void CFrame::OnSelectPerspective(wxCommandEvent& event)
DoLoadPerspective();
}

void CFrame::ResizeConsole()
{
#ifdef _WIN32
// Get the console parent window
wxWindow * Win = FindWindowById(IDM_CONSOLEWINDOW);
if (!Win) return;

const int wxBorder = 2, Border = 4,
MenuBar = 30, ScrollBar = 19;

// Get the client size
int X = Win->GetSize().GetX();
int Y = Win->GetSize().GetY();
int InternalWidth = X - wxBorder*2 - ScrollBar;
int InternalHeight = Y - wxBorder*2;
int WindowWidth = InternalWidth + Border*2 +
/*max out the width in the word wrap mode*/ 100;
int WindowHeight = InternalHeight + MenuBar;
// Resize buffer
ConsoleListener* Console = LogManager::GetInstance()->GetConsoleListener();
Console->PixelSpace(0,0, InternalWidth, InternalHeight, false);
// Move the window to hide the border
MoveWindow(GetConsoleWindow(), -Border-wxBorder, -MenuBar-wxBorder,
WindowWidth + 100, WindowHeight, true);
#endif
}

static int Limit(int i, int Low, int High)
{
if (i < Low) return Low;
Expand Down Expand Up @@ -1092,11 +998,6 @@ wxFrame* CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title, wxWindo

Frame->Bind(wxEVT_CLOSE_WINDOW, &CFrame::OnFloatingPageClosed, this);

if (Id == IDM_CONSOLEWINDOW_PARENT)
{
Frame->Bind(wxEVT_SIZE, &CFrame::OnFloatingPageSize, this);
}

// Main sizer
Frame->SetSizer(m_MainSizer);
// Minimum frame size
Expand Down
7 changes: 0 additions & 7 deletions Source/Core/DolphinWX/FrameTools.cpp
Expand Up @@ -258,17 +258,11 @@ void CFrame::CreateMenu()
viewMenu->AppendSeparator();
viewMenu->AppendCheckItem(IDM_LOGWINDOW, _("Show &Log"));
viewMenu->AppendCheckItem(IDM_LOGCONFIGWINDOW, _("Show Log &Configuration"));
viewMenu->AppendCheckItem(IDM_CONSOLEWINDOW, _("Show &Console"));
viewMenu->AppendSeparator();

#ifndef _WIN32
viewMenu->Enable(IDM_CONSOLEWINDOW, false);
#endif

if (g_pCodeWindow)
{
viewMenu->Check(IDM_LOGWINDOW, g_pCodeWindow->bShowOnStart[0]);
viewMenu->Check(IDM_CONSOLEWINDOW, g_pCodeWindow->bShowOnStart[1]);

const wxString MenuText[] = {
wxTRANSLATE("&Registers"),
Expand All @@ -291,7 +285,6 @@ void CFrame::CreateMenu()
{
viewMenu->Check(IDM_LOGWINDOW, SConfig::GetInstance().m_InterfaceLogWindow);
viewMenu->Check(IDM_LOGCONFIGWINDOW, SConfig::GetInstance().m_InterfaceLogConfigWindow);
viewMenu->Check(IDM_CONSOLEWINDOW, SConfig::GetInstance().m_InterfaceConsole);
}

wxMenu *platformMenu = new wxMenu;
Expand Down
3 changes: 0 additions & 3 deletions Source/Core/DolphinWX/Globals.h
Expand Up @@ -130,7 +130,6 @@ enum
// Views
IDM_LOGWINDOW,
IDM_LOGCONFIGWINDOW,
IDM_CONSOLEWINDOW,
IDM_REGISTERWINDOW,
IDM_BREAKPOINTWINDOW,
IDM_MEMORYWINDOW,
Expand All @@ -142,7 +141,6 @@ enum
// Float Window IDs
IDM_LOGWINDOW_PARENT,
IDM_LOGCONFIGWINDOW_PARENT,
IDM_CONSOLEWINDOW_PARENT,
IDM_REGISTERWINDOW_PARENT,
IDM_BREAKPOINTWINDOW_PARENT,
IDM_MEMORYWINDOW_PARENT,
Expand All @@ -154,7 +152,6 @@ enum
// Float popup menu IDs
IDM_FLOAT_LOGWINDOW,
IDM_FLOAT_LOGCONFIGWINDOW,
IDM_FLOAT_CONSOLEWINDOW,
IDM_FLOAT_REGISTERWINDOW,
IDM_FLOAT_BREAKPOINTWINDOW,
IDM_FLOAT_MEMORYWINDOW,
Expand Down
15 changes: 0 additions & 15 deletions Source/Core/DolphinWX/LogWindow.cpp
Expand Up @@ -33,7 +33,6 @@
#include "Common/FileUtil.h"
#include "Common/IniFile.h"
#include "Common/LogManager.h"
#include "Core/Console.h"
#include "DolphinWX/Frame.h"
#include "DolphinWX/LogWindow.h"
#include "DolphinWX/WxUtils.h"
Expand All @@ -44,7 +43,6 @@

BEGIN_EVENT_TABLE(CLogWindow, wxPanel)
EVT_CLOSE(CLogWindow::OnClose)
EVT_TEXT_ENTER(IDM_SUBMITCMD, CLogWindow::OnSubmit)
EVT_BUTTON(IDM_CLEARLOG, CLogWindow::OnClear)
EVT_CHOICE(IDM_FONT, CLogWindow::OnFontChange)
EVT_CHECKBOX(IDM_WRAPLINE, CLogWindow::OnWrapLineCheck)
Expand Down Expand Up @@ -87,7 +85,6 @@ void CLogWindow::CreateGUIControls()

// Get the logger output settings from the config ini file.
ini.Get("Options", "WriteToFile", &m_writeFile, false);
ini.Get("Options", "WriteToConsole", &m_writeConsole, true);
ini.Get("Options", "WriteToWindow", &m_writeWindow, true);
#ifdef _MSC_VER
if (IsDebuggerPresent())
Expand Down Expand Up @@ -115,11 +112,6 @@ void CLogWindow::CreateGUIControls()
else
m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, m_LogManager->GetFileListener());

if (m_writeConsole && enable)
m_LogManager->AddListener((LogTypes::LOG_TYPE)i, m_LogManager->GetConsoleListener());
else
m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, m_LogManager->GetConsoleListener());

if (m_writeDebugger && enable)
m_LogManager->AddListener((LogTypes::LOG_TYPE)i, m_LogManager->GetDebuggerListener());
else
Expand Down Expand Up @@ -207,13 +199,6 @@ void CLogWindow::SaveSettings()
ini.Save(File::GetUserPath(F_LOGGERCONFIG_IDX));
}

void CLogWindow::OnSubmit(wxCommandEvent& WXUNUSED (event))
{
if (!m_cmdline) return;
Console_Submit(WxStrToStr(m_cmdline->GetValue()).c_str());
m_cmdline->SetValue(wxEmptyString);
}

void CLogWindow::OnClear(wxCommandEvent& WXUNUSED (event))
{
m_Log->Clear();
Expand Down
3 changes: 1 addition & 2 deletions Source/Core/DolphinWX/LogWindow.h
Expand Up @@ -65,7 +65,7 @@ class CLogWindow : public wxPanel, LogListener
bool m_ignoreLogTimer;
LogManager *m_LogManager;
std::queue<std::pair<u8, wxString> > msgQueue;
bool m_writeFile, m_writeConsole, m_writeWindow, m_writeDebugger, m_LogAccess;
bool m_writeFile, m_writeWindow, m_writeDebugger, m_LogAccess;

// Controls
wxBoxSizer *sBottom;
Expand All @@ -82,7 +82,6 @@ class CLogWindow : public wxPanel, LogListener
void PopulateBottom();
void UnPopulateBottom();
void OnClose(wxCloseEvent& event);
void OnSubmit(wxCommandEvent& event);
void OnFontChange(wxCommandEvent& event);
void OnWrapLineCheck(wxCommandEvent& event);
void OnClear(wxCommandEvent& event);
Expand Down