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:
parent
a7c643e146
commit
334d11bf07
|
@ -44,20 +44,22 @@ ConsoleListener::~ConsoleListener()
|
|||
// 100, 100, "Dolphin Log Console"
|
||||
// Open console window - width and height is the size of console window
|
||||
// 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
|
||||
if (!GetConsoleWindow())
|
||||
{
|
||||
// Open the console window and create the window handle for GetStdHandle()
|
||||
AllocConsole();
|
||||
// Hide
|
||||
if (Hidden) ShowWindow(GetConsoleWindow(), SW_HIDE);
|
||||
// Save the window handle that AllocConsole() created
|
||||
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
// Set the console window title
|
||||
SetConsoleTitle(Title);
|
||||
// Set letter space
|
||||
LetterSpace(80, 1000);
|
||||
MoveWindow(GetConsoleWindow(), 200,200, 800,800, true);
|
||||
//MoveWindow(GetConsoleWindow(), 200,200, 800,800, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
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 Close();
|
||||
bool IsOpen();
|
||||
|
|
|
@ -91,7 +91,10 @@ struct SConfig
|
|||
|
||||
/* Return the permanent and somewhat globally used instance of this struct
|
||||
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);}
|
||||
|
||||
private:
|
||||
|
|
|
@ -299,8 +299,7 @@ END_EVENT_TABLE()
|
|||
//---------------
|
||||
// Creation and close, quit functions
|
||||
|
||||
CFrame::CFrame(bool showLogWindow,
|
||||
wxFrame* parent,
|
||||
CFrame::CFrame(wxFrame* parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
|
@ -311,16 +310,15 @@ CFrame::CFrame(bool showLogWindow,
|
|||
, UseDebugger(_UseDebugger), m_LogWindow(NULL)
|
||||
, m_GameListCtrl(NULL), m_pStatusBar(NULL), bRenderToMain(true), HaveLeds(false)
|
||||
, 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)
|
||||
#if wxUSE_TIMER
|
||||
, m_timer(this)
|
||||
#endif
|
||||
|
||||
{
|
||||
// Give it a console
|
||||
// Give it a console early to show potential messages from this onward
|
||||
ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener();
|
||||
if (SConfig::GetInstance().m_InterfaceConsole) Console->Open();
|
||||
if (SConfig::GetInstance().m_InterfaceConsole) Console->Open(true);
|
||||
|
||||
// Start debugging mazimized
|
||||
if (UseDebugger) this->Maximize(true);
|
||||
|
@ -423,7 +421,7 @@ CFrame::CFrame(bool showLogWindow,
|
|||
if (!UseDebugger)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -718,7 +716,7 @@ void CFrame::ReloadPanes()
|
|||
// Open notebook pages
|
||||
AddRemoveBlankPage();
|
||||
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);
|
||||
|
||||
//Console->Log(LogTypes::LNOTICE, StringFromFormat("ReloadPanes end: Sound %i\n", FindWindowByName(wxT("Sound"))).c_str());
|
||||
|
@ -733,11 +731,12 @@ void CFrame::DoLoadPerspective()
|
|||
// Show
|
||||
ShowAllNotebooks(true);
|
||||
|
||||
/*
|
||||
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||
Console->Log(LogTypes::LCUSTOM, StringFromFormat(
|
||||
"Loaded: %s (%i panes, %i NBs)\n",
|
||||
Perspectives.at(ActivePerspective).Name.c_str(), m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str());
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
// Update the local perspectives array
|
||||
|
@ -786,11 +785,7 @@ void CFrame::SaveLocal()
|
|||
}
|
||||
void CFrame::Save()
|
||||
{
|
||||
if (Perspectives.size() == 0)
|
||||
{
|
||||
wxMessageBox(wxT("Please create a perspective before saving"), wxT("Notice"), wxOK, this);
|
||||
return;
|
||||
}
|
||||
if (Perspectives.size() == 0) return;
|
||||
if (ActivePerspective >= Perspectives.size()) ActivePerspective = 0;
|
||||
|
||||
// Turn off edit before saving
|
||||
|
@ -837,12 +832,12 @@ void CFrame::Save()
|
|||
// Update the local vector
|
||||
SaveLocal();
|
||||
|
||||
/**/
|
||||
/*
|
||||
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||
Console->Log(LogTypes::LCUSTOM, StringFromFormat(
|
||||
"Saved: %s (%i panes, %i NBs)\n",
|
||||
Perspectives.at(ActivePerspective).Name.c_str(), m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str());
|
||||
|
||||
*/
|
||||
|
||||
TogglePaneStyle(m_ToolBarAui->GetToolToggled(IDM_EDIT_PERSPECTIVES));
|
||||
}
|
||||
|
|
|
@ -46,8 +46,7 @@ class CFrame : public wxFrame
|
|||
{
|
||||
public:
|
||||
|
||||
CFrame(bool showLogWindow,
|
||||
wxFrame* parent,
|
||||
CFrame(wxFrame* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& title = wxT("Dolphin"),
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
|
@ -163,7 +162,6 @@ class CFrame : public wxFrame
|
|||
CGameListCtrl* m_GameListCtrl;
|
||||
wxPanel* m_Panel;
|
||||
wxToolBarToolBase* m_ToolPlay;
|
||||
bool m_bLogWindow;
|
||||
CLogWindow* m_LogWindow;
|
||||
|
||||
char **drives;
|
||||
|
|
|
@ -199,7 +199,7 @@ void CFrame::CreateMenu()
|
|||
viewMenu->AppendCheckItem(IDM_TOGGLE_STATUSBAR, _T("Show &Statusbar"));
|
||||
viewMenu->Check(IDM_TOGGLE_STATUSBAR, SConfig::GetInstance().m_InterfaceStatusbar);
|
||||
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->Check(IDM_CONSOLEWINDOW, SConfig::GetInstance().m_InterfaceConsole);
|
||||
viewMenu->AppendSeparator();
|
||||
|
@ -703,6 +703,11 @@ void CFrame::OnToolBar(wxCommandEvent& event)
|
|||
switch (event.GetId())
|
||||
{
|
||||
case IDM_SAVE_PERSPECTIVE:
|
||||
if (Perspectives.size() == 0)
|
||||
{
|
||||
wxMessageBox(wxT("Please create a perspective before saving"), wxT("Notice"), wxOK, this);
|
||||
return;
|
||||
}
|
||||
Save();
|
||||
break;
|
||||
case IDM_PERSPECTIVES_ADD_PANE:
|
||||
|
@ -1329,11 +1334,11 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event)
|
|||
// 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)
|
||||
{
|
||||
SConfig::GetInstance().m_InterfaceLogWindow = Show;
|
||||
if (Show)
|
||||
{
|
||||
if (!m_LogWindow) m_LogWindow = new CLogWindow(this);
|
||||
|
@ -1361,12 +1366,12 @@ void CFrame::ToggleLogWindow(bool Show, int i)
|
|||
// 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();
|
||||
SConfig::GetInstance().m_InterfaceConsole = Show;
|
||||
|
||||
if (Show)
|
||||
{
|
||||
|
|
|
@ -89,7 +89,6 @@ bool DolphinApp::OnInit()
|
|||
NOTICE_LOG(BOOT, "Starting application");
|
||||
// Declarations and definitions
|
||||
bool UseDebugger = false;
|
||||
bool UseLogger = false;
|
||||
bool LoadElf = false;
|
||||
wxString ElfFile;
|
||||
|
||||
|
@ -198,9 +197,6 @@ bool DolphinApp::OnInit()
|
|||
{
|
||||
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_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
|
||||
|
@ -262,7 +258,6 @@ bool DolphinApp::OnInit()
|
|||
}
|
||||
|
||||
UseDebugger = parser.Found(_T("debugger"));
|
||||
UseLogger = parser.Found(_T("logger"));
|
||||
LoadElf = parser.Found(_T("elf"), &ElfFile);
|
||||
|
||||
if( LoadElf && ElfFile == wxEmptyString )
|
||||
|
@ -297,12 +292,12 @@ bool DolphinApp::OnInit()
|
|||
|
||||
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);
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue