mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
GUI: Fixed saving of m_InterfaceLogWindow and m_InterfaceConsole, one crashfix
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4140 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -44,20 +44,22 @@ ConsoleListener::~ConsoleListener()
|
|||||||
// 100, 100, "Dolphin Log Console"
|
// 100, 100, "Dolphin Log Console"
|
||||||
// Open console window - width and height is the size of console window
|
// Open console window - width and height is the size of console window
|
||||||
// Name is the window title
|
// Name is the window title
|
||||||
void ConsoleListener::Open(int Width, int Height, const char *Title)
|
void ConsoleListener::Open(bool Hidden, int Width, int Height, const char *Title)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (!GetConsoleWindow())
|
if (!GetConsoleWindow())
|
||||||
{
|
{
|
||||||
// Open the console window and create the window handle for GetStdHandle()
|
// Open the console window and create the window handle for GetStdHandle()
|
||||||
AllocConsole();
|
AllocConsole();
|
||||||
|
// Hide
|
||||||
|
if (Hidden) ShowWindow(GetConsoleWindow(), SW_HIDE);
|
||||||
// Save the window handle that AllocConsole() created
|
// Save the window handle that AllocConsole() created
|
||||||
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
// Set the console window title
|
// Set the console window title
|
||||||
SetConsoleTitle(Title);
|
SetConsoleTitle(Title);
|
||||||
// Set letter space
|
// Set letter space
|
||||||
LetterSpace(80, 1000);
|
LetterSpace(80, 1000);
|
||||||
MoveWindow(GetConsoleWindow(), 200,200, 800,800, true);
|
//MoveWindow(GetConsoleWindow(), 200,200, 800,800, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -73,7 +73,7 @@ public:
|
|||||||
ConsoleListener();
|
ConsoleListener();
|
||||||
~ConsoleListener();
|
~ConsoleListener();
|
||||||
|
|
||||||
void Open(int Width = 100, int Height = 100, const char * Name = "Console");
|
void Open(bool Hidden = false, int Width = 100, int Height = 100, const char * Name = "Console");
|
||||||
void UpdateHandle();
|
void UpdateHandle();
|
||||||
void Close();
|
void Close();
|
||||||
bool IsOpen();
|
bool IsOpen();
|
||||||
|
@ -91,7 +91,10 @@ struct SConfig
|
|||||||
|
|
||||||
/* Return the permanent and somewhat globally used instance of this struct
|
/* Return the permanent and somewhat globally used instance of this struct
|
||||||
there is also a Core::GetStartupParameter() instance of it with almost
|
there is also a Core::GetStartupParameter() instance of it with almost
|
||||||
the same values */
|
the same values
|
||||||
|
|
||||||
|
Is this still true or do we only have one now?
|
||||||
|
*/
|
||||||
static SConfig& GetInstance() {return(m_Instance);}
|
static SConfig& GetInstance() {return(m_Instance);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -299,8 +299,7 @@ END_EVENT_TABLE()
|
|||||||
//---------------
|
//---------------
|
||||||
// Creation and close, quit functions
|
// Creation and close, quit functions
|
||||||
|
|
||||||
CFrame::CFrame(bool showLogWindow,
|
CFrame::CFrame(wxFrame* parent,
|
||||||
wxFrame* parent,
|
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
@ -311,16 +310,15 @@ CFrame::CFrame(bool showLogWindow,
|
|||||||
, UseDebugger(_UseDebugger), m_LogWindow(NULL)
|
, UseDebugger(_UseDebugger), m_LogWindow(NULL)
|
||||||
, m_GameListCtrl(NULL), m_pStatusBar(NULL), bRenderToMain(true), HaveLeds(false)
|
, m_GameListCtrl(NULL), m_pStatusBar(NULL), bRenderToMain(true), HaveLeds(false)
|
||||||
, HaveSpeakers(false), m_Panel(NULL), m_ToolBar(NULL), m_ToolBarDebug(NULL)
|
, HaveSpeakers(false), m_Panel(NULL), m_ToolBar(NULL), m_ToolBarDebug(NULL)
|
||||||
, m_bLogWindow(showLogWindow || SConfig::GetInstance().m_InterfaceLogWindow)
|
|
||||||
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
|
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
|
||||||
#if wxUSE_TIMER
|
#if wxUSE_TIMER
|
||||||
, m_timer(this)
|
, m_timer(this)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
// Give it a console
|
// Give it a console early to show potential messages from this onward
|
||||||
ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener();
|
ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener();
|
||||||
if (SConfig::GetInstance().m_InterfaceConsole) Console->Open();
|
if (SConfig::GetInstance().m_InterfaceConsole) Console->Open(true);
|
||||||
|
|
||||||
// Start debugging mazimized
|
// Start debugging mazimized
|
||||||
if (UseDebugger) this->Maximize(true);
|
if (UseDebugger) this->Maximize(true);
|
||||||
@ -423,7 +421,7 @@ CFrame::CFrame(bool showLogWindow,
|
|||||||
if (!UseDebugger)
|
if (!UseDebugger)
|
||||||
{
|
{
|
||||||
SetSimplePaneSize();
|
SetSimplePaneSize();
|
||||||
if (m_bLogWindow) DoToggleWindow(IDM_LOGWINDOW, true);
|
if (SConfig::GetInstance().m_InterfaceLogWindow) DoToggleWindow(IDM_LOGWINDOW, true);
|
||||||
if (SConfig::GetInstance().m_InterfaceConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true);
|
if (SConfig::GetInstance().m_InterfaceConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -718,7 +716,7 @@ void CFrame::ReloadPanes()
|
|||||||
// Open notebook pages
|
// Open notebook pages
|
||||||
AddRemoveBlankPage();
|
AddRemoveBlankPage();
|
||||||
g_pCodeWindow->OpenPages();
|
g_pCodeWindow->OpenPages();
|
||||||
if (m_bLogWindow) DoToggleWindow(IDM_LOGWINDOW, true);
|
if (SConfig::GetInstance().m_InterfaceLogWindow) DoToggleWindow(IDM_LOGWINDOW, true);
|
||||||
if (SConfig::GetInstance().m_InterfaceConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true);
|
if (SConfig::GetInstance().m_InterfaceConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true);
|
||||||
|
|
||||||
//Console->Log(LogTypes::LNOTICE, StringFromFormat("ReloadPanes end: Sound %i\n", FindWindowByName(wxT("Sound"))).c_str());
|
//Console->Log(LogTypes::LNOTICE, StringFromFormat("ReloadPanes end: Sound %i\n", FindWindowByName(wxT("Sound"))).c_str());
|
||||||
@ -733,11 +731,12 @@ void CFrame::DoLoadPerspective()
|
|||||||
// Show
|
// Show
|
||||||
ShowAllNotebooks(true);
|
ShowAllNotebooks(true);
|
||||||
|
|
||||||
|
/*
|
||||||
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||||
Console->Log(LogTypes::LCUSTOM, StringFromFormat(
|
Console->Log(LogTypes::LCUSTOM, StringFromFormat(
|
||||||
"Loaded: %s (%i panes, %i NBs)\n",
|
"Loaded: %s (%i panes, %i NBs)\n",
|
||||||
Perspectives.at(ActivePerspective).Name.c_str(), m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str());
|
Perspectives.at(ActivePerspective).Name.c_str(), m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str());
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the local perspectives array
|
// Update the local perspectives array
|
||||||
@ -786,11 +785,7 @@ void CFrame::SaveLocal()
|
|||||||
}
|
}
|
||||||
void CFrame::Save()
|
void CFrame::Save()
|
||||||
{
|
{
|
||||||
if (Perspectives.size() == 0)
|
if (Perspectives.size() == 0) return;
|
||||||
{
|
|
||||||
wxMessageBox(wxT("Please create a perspective before saving"), wxT("Notice"), wxOK, this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ActivePerspective >= Perspectives.size()) ActivePerspective = 0;
|
if (ActivePerspective >= Perspectives.size()) ActivePerspective = 0;
|
||||||
|
|
||||||
// Turn off edit before saving
|
// Turn off edit before saving
|
||||||
@ -837,12 +832,12 @@ void CFrame::Save()
|
|||||||
// Update the local vector
|
// Update the local vector
|
||||||
SaveLocal();
|
SaveLocal();
|
||||||
|
|
||||||
/**/
|
/*
|
||||||
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||||
Console->Log(LogTypes::LCUSTOM, StringFromFormat(
|
Console->Log(LogTypes::LCUSTOM, StringFromFormat(
|
||||||
"Saved: %s (%i panes, %i NBs)\n",
|
"Saved: %s (%i panes, %i NBs)\n",
|
||||||
Perspectives.at(ActivePerspective).Name.c_str(), m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str());
|
Perspectives.at(ActivePerspective).Name.c_str(), m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str());
|
||||||
|
*/
|
||||||
|
|
||||||
TogglePaneStyle(m_ToolBarAui->GetToolToggled(IDM_EDIT_PERSPECTIVES));
|
TogglePaneStyle(m_ToolBarAui->GetToolToggled(IDM_EDIT_PERSPECTIVES));
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,7 @@ class CFrame : public wxFrame
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CFrame(bool showLogWindow,
|
CFrame(wxFrame* parent,
|
||||||
wxFrame* parent,
|
|
||||||
wxWindowID id = wxID_ANY,
|
wxWindowID id = wxID_ANY,
|
||||||
const wxString& title = wxT("Dolphin"),
|
const wxString& title = wxT("Dolphin"),
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
@ -163,7 +162,6 @@ class CFrame : public wxFrame
|
|||||||
CGameListCtrl* m_GameListCtrl;
|
CGameListCtrl* m_GameListCtrl;
|
||||||
wxPanel* m_Panel;
|
wxPanel* m_Panel;
|
||||||
wxToolBarToolBase* m_ToolPlay;
|
wxToolBarToolBase* m_ToolPlay;
|
||||||
bool m_bLogWindow;
|
|
||||||
CLogWindow* m_LogWindow;
|
CLogWindow* m_LogWindow;
|
||||||
|
|
||||||
char **drives;
|
char **drives;
|
||||||
|
@ -199,7 +199,7 @@ void CFrame::CreateMenu()
|
|||||||
viewMenu->AppendCheckItem(IDM_TOGGLE_STATUSBAR, _T("Show &Statusbar"));
|
viewMenu->AppendCheckItem(IDM_TOGGLE_STATUSBAR, _T("Show &Statusbar"));
|
||||||
viewMenu->Check(IDM_TOGGLE_STATUSBAR, SConfig::GetInstance().m_InterfaceStatusbar);
|
viewMenu->Check(IDM_TOGGLE_STATUSBAR, SConfig::GetInstance().m_InterfaceStatusbar);
|
||||||
viewMenu->AppendCheckItem(IDM_LOGWINDOW, _T("Show &Logwindow"));
|
viewMenu->AppendCheckItem(IDM_LOGWINDOW, _T("Show &Logwindow"));
|
||||||
viewMenu->Check(IDM_LOGWINDOW, m_bLogWindow);
|
viewMenu->Check(IDM_LOGWINDOW, SConfig::GetInstance().m_InterfaceLogWindow);
|
||||||
viewMenu->AppendCheckItem(IDM_CONSOLEWINDOW, _T("Show &Console"));
|
viewMenu->AppendCheckItem(IDM_CONSOLEWINDOW, _T("Show &Console"));
|
||||||
viewMenu->Check(IDM_CONSOLEWINDOW, SConfig::GetInstance().m_InterfaceConsole);
|
viewMenu->Check(IDM_CONSOLEWINDOW, SConfig::GetInstance().m_InterfaceConsole);
|
||||||
viewMenu->AppendSeparator();
|
viewMenu->AppendSeparator();
|
||||||
@ -703,6 +703,11 @@ void CFrame::OnToolBar(wxCommandEvent& event)
|
|||||||
switch (event.GetId())
|
switch (event.GetId())
|
||||||
{
|
{
|
||||||
case IDM_SAVE_PERSPECTIVE:
|
case IDM_SAVE_PERSPECTIVE:
|
||||||
|
if (Perspectives.size() == 0)
|
||||||
|
{
|
||||||
|
wxMessageBox(wxT("Please create a perspective before saving"), wxT("Notice"), wxOK, this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Save();
|
Save();
|
||||||
break;
|
break;
|
||||||
case IDM_PERSPECTIVES_ADD_PANE:
|
case IDM_PERSPECTIVES_ADD_PANE:
|
||||||
@ -1329,11 +1334,11 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event)
|
|||||||
// Enable and disable the log window
|
// Enable and disable the log window
|
||||||
void CFrame::OnToggleLogWindow(wxCommandEvent& event)
|
void CFrame::OnToggleLogWindow(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
|
SConfig::GetInstance().m_InterfaceLogWindow = event.IsChecked();
|
||||||
DoToggleWindow(event.GetId(), event.IsChecked());
|
DoToggleWindow(event.GetId(), event.IsChecked());
|
||||||
}
|
}
|
||||||
void CFrame::ToggleLogWindow(bool Show, int i)
|
void CFrame::ToggleLogWindow(bool Show, int i)
|
||||||
{
|
{
|
||||||
SConfig::GetInstance().m_InterfaceLogWindow = Show;
|
|
||||||
if (Show)
|
if (Show)
|
||||||
{
|
{
|
||||||
if (!m_LogWindow) m_LogWindow = new CLogWindow(this);
|
if (!m_LogWindow) m_LogWindow = new CLogWindow(this);
|
||||||
@ -1361,12 +1366,12 @@ void CFrame::ToggleLogWindow(bool Show, int i)
|
|||||||
// Enable and disable the console
|
// Enable and disable the console
|
||||||
void CFrame::OnToggleConsole(wxCommandEvent& event)
|
void CFrame::OnToggleConsole(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
|
SConfig::GetInstance().m_InterfaceConsole = event.IsChecked();
|
||||||
DoToggleWindow(event.GetId(), event.IsChecked());
|
DoToggleWindow(event.GetId(), event.IsChecked());
|
||||||
}
|
}
|
||||||
void CFrame::ToggleConsole(bool Show, int i)
|
void CFrame::ToggleConsole(bool Show, int i)
|
||||||
{
|
{
|
||||||
ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener();
|
ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener();
|
||||||
SConfig::GetInstance().m_InterfaceConsole = Show;
|
|
||||||
|
|
||||||
if (Show)
|
if (Show)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,6 @@ bool DolphinApp::OnInit()
|
|||||||
NOTICE_LOG(BOOT, "Starting application");
|
NOTICE_LOG(BOOT, "Starting application");
|
||||||
// Declarations and definitions
|
// Declarations and definitions
|
||||||
bool UseDebugger = false;
|
bool UseDebugger = false;
|
||||||
bool UseLogger = false;
|
|
||||||
bool LoadElf = false;
|
bool LoadElf = false;
|
||||||
wxString ElfFile;
|
wxString ElfFile;
|
||||||
|
|
||||||
@ -198,9 +197,6 @@ bool DolphinApp::OnInit()
|
|||||||
{
|
{
|
||||||
wxCMD_LINE_SWITCH, _T("d"), _T("debugger"), _T("Opens the debugger")
|
wxCMD_LINE_SWITCH, _T("d"), _T("debugger"), _T("Opens the debugger")
|
||||||
},
|
},
|
||||||
{
|
|
||||||
wxCMD_LINE_SWITCH, _T("l"), _T("logger"), _T("Opens The Logger")
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
wxCMD_LINE_OPTION, _T("e"), _T("elf"), _T("Loads an elf file"),
|
wxCMD_LINE_OPTION, _T("e"), _T("elf"), _T("Loads an elf file"),
|
||||||
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
|
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
|
||||||
@ -262,7 +258,6 @@ bool DolphinApp::OnInit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
UseDebugger = parser.Found(_T("debugger"));
|
UseDebugger = parser.Found(_T("debugger"));
|
||||||
UseLogger = parser.Found(_T("logger"));
|
|
||||||
LoadElf = parser.Found(_T("elf"), &ElfFile);
|
LoadElf = parser.Found(_T("elf"), &ElfFile);
|
||||||
|
|
||||||
if( LoadElf && ElfFile == wxEmptyString )
|
if( LoadElf && ElfFile == wxEmptyString )
|
||||||
@ -297,12 +292,12 @@ bool DolphinApp::OnInit()
|
|||||||
|
|
||||||
if (UseDebugger)
|
if (UseDebugger)
|
||||||
{
|
{
|
||||||
main_frame = new CFrame(UseLogger, (wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
|
main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
|
||||||
wxPoint(x, y), wxSize(w, h), true);
|
wxPoint(x, y), wxSize(w, h), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
main_frame = new CFrame(UseLogger, (wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
|
main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
|
||||||
wxPoint(100, 100), wxSize(800, 600));
|
wxPoint(100, 100), wxSize(800, 600));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user