Fix a few issues with the size of the logger pane.

Also some other general clean up issues.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7401 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2011-03-23 02:06:40 +00:00
parent ae9de182f3
commit c39e3c17e1
8 changed files with 66 additions and 49 deletions

View File

@ -385,23 +385,14 @@ CFrame::CFrame(wxFrame* parent,
// Could just check for wxWidgets version if it becomes a problem.
m_Mgr = new wxAuiManager(this, wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE);
if (g_pCodeWindow)
{
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo()
.Name(_T("Pane 0")).Caption(_T("Pane 0"))
.CenterPane().PaneBorder(false).Show());
AuiFullscreen = m_Mgr->SavePerspective();
}
else
{
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo()
.Name(_T("Pane 0")).Caption(_T("Pane 0")).PaneBorder(false)
.CaptionVisible(false).Layer(0).Center().Show());
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo()
.Name(_T("Pane 0")).Caption(_T("Pane 0")).PaneBorder(false)
.CaptionVisible(false).Layer(0).Center().Show());
if (!g_pCodeWindow)
m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo()
.Name(_T("Pane 1")).Caption(_("Logging")).CaptionVisible(true)
.Layer(0).FloatingSize(wxSize(600, 350)).CloseButton(true).Hide());
AuiFullscreen = m_Mgr->SavePerspective();
}
AuiFullscreen = m_Mgr->SavePerspective();
// Create toolbar
RecreateToolbar();
@ -535,7 +526,12 @@ void CFrame::OnClose(wxCloseEvent& event)
// Save GUI settings
if (g_pCodeWindow) SaveIniPerspectives();
// Close the log window now so that its settings are saved
else m_LogWindow->Close();
else
{
m_LogWindow->Close();
m_LogWindow = NULL;
}
// Uninit
m_Mgr->UnInit();
@ -582,6 +578,13 @@ void CFrame::OnResize(wxSizeEvent& event)
SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth = GetSize().GetWidth();
SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight = GetSize().GetHeight();
}
// Make sure the logger pane is a sane size
if (!g_pCodeWindow && m_LogWindow && m_Mgr->GetPane(_T("Pane 1")).IsShown() &&
!m_Mgr->GetPane(_T("Pane 1")).IsFloating() &&
(m_LogWindow->x > GetClientRect().GetWidth() ||
m_LogWindow->y > GetClientRect().GetHeight()))
ShowResizePane();
}
// Host messages

View File

@ -238,6 +238,7 @@ private:
int GetNotebookAffiliation(wxWindowID Id);
void ClosePages();
void CloseAllNotebooks();
void ShowResizePane();
void TogglePane();
void SetPaneSize();
void ResetToolbarStyle();

View File

@ -29,6 +29,14 @@
void CFrame::OnManagerResize(wxAuiManagerEvent& event)
{
if (!g_pCodeWindow && m_LogWindow &&
m_Mgr->GetPane(_T("Pane 1")).IsShown() &&
!m_Mgr->GetPane(_T("Pane 1")).IsFloating())
{
m_LogWindow->x = m_Mgr->GetPane(_T("Pane 1")).rect.GetWidth();
m_LogWindow->y = m_Mgr->GetPane(_T("Pane 1")).rect.GetHeight();
m_LogWindow->winpos = m_Mgr->GetPane(_T("Pane 1")).dock_direction;
}
event.Skip();
ResizeConsole();
}
@ -76,6 +84,9 @@ void CFrame::OnPaneClose(wxAuiManagerEvent& event)
void CFrame::ToggleLogWindow(bool bShow)
{
if (!m_LogWindow)
return;
GetMenuBar()->FindItem(IDM_LOGWINDOW)->Check(bShow);
if (bShow)
@ -378,6 +389,32 @@ void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event)
ResizeConsole();
}
void CFrame::ShowResizePane()
{
if (!m_LogWindow) return;
// Make sure the size is sane
if (m_LogWindow->x > GetClientRect().GetWidth())
m_LogWindow->x = GetClientRect().GetWidth() / 2;
if (m_LogWindow->y > GetClientRect().GetHeight())
m_LogWindow->y = GetClientRect().GetHeight() / 2;
wxAuiPaneInfo &pane = m_Mgr->GetPane(wxT("Pane 1"));
// Hide first otherwise a resize doesn't work
pane.Hide();
m_Mgr->Update();
pane.BestSize(m_LogWindow->x, m_LogWindow->y)
.MinSize(m_LogWindow->x, m_LogWindow->y)
.Direction(m_LogWindow->winpos).Show();
m_Mgr->Update();
// Reset the minimum size of the pane
pane.MinSize(-1, -1);
m_Mgr->Update();
}
void CFrame::TogglePane()
{
// Get the first notebook
@ -391,22 +428,11 @@ void CFrame::TogglePane()
{
if (NB->GetPageCount() == 0)
{
m_LogWindow->x = m_Mgr->GetPane(_T("Pane 1")).rect.GetWidth();
m_LogWindow->y = m_Mgr->GetPane(_T("Pane 1")).rect.GetHeight();
m_LogWindow->winpos = m_Mgr->GetPane(_T("Pane 1")).dock_direction;
m_Mgr->GetPane(_T("Pane 1")).Hide();
m_Mgr->Update();
}
else
{
m_Mgr->GetPane(_T("Pane 1")).BestSize(m_LogWindow->x, m_LogWindow->y)
.MinSize(m_LogWindow->x, m_LogWindow->y)
.Direction(m_LogWindow->winpos).Show();
m_Mgr->Update();
// Reset the minimum size of the pane
m_Mgr->GetPane(_T("Pane 1")).MinSize(-1, -1);
}
m_Mgr->Update();
ShowResizePane();
}
}

View File

@ -33,7 +33,6 @@ BEGIN_EVENT_TABLE(CLogWindow, wxPanel)
EVT_CHOICE(IDM_FONT, CLogWindow::OnFontChange)
EVT_CHECKBOX(IDM_WRAPLINE, CLogWindow::OnWrapLineCheck)
EVT_TIMER(IDTM_UPDATELOG, CLogWindow::OnLogTimer)
EVT_SIZE(CLogWindow::OnSize)
END_EVENT_TABLE()
CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos,
@ -172,18 +171,6 @@ void CLogWindow::OnClose(wxCloseEvent& event)
event.Skip();
}
void CLogWindow::OnSize(wxSizeEvent& event)
{
if (!Parent->g_pCodeWindow &&
Parent->m_Mgr->GetPane(wxT("Pane 1")).IsShown())
{
x = Parent->m_Mgr->GetPane(wxT("Pane 1")).rect.GetWidth();
y = Parent->m_Mgr->GetPane(wxT("Pane 1")).rect.GetHeight();
winpos = Parent->m_Mgr->GetPane(wxT("Pane 1")).dock_direction;
}
event.Skip();
}
void CLogWindow::SaveSettings()
{
IniFile ini;

View File

@ -83,7 +83,6 @@ private:
void PopulateBottom();
void UnPopulateBottom();
void OnClose(wxCloseEvent& event);
void OnSize(wxSizeEvent& event);
void OnSubmit(wxCommandEvent& event);
void OnFontChange(wxCommandEvent& event);
void OnWrapLineCheck(wxCommandEvent& event);

View File

@ -513,7 +513,7 @@ bool CWiiSaveCrypted::getPaths(bool forExport)
return false;
}
if (strlen(pathData_bin) == 0)
strcpy(pathData_bin, ".");// If no path was passed, use current dir
strcpy(pathData_bin, "."); // If no path was passed, use current dir
sprintf(pathData_bin, "%s/private/wii/title/%s/data.bin", pathData_bin, _saveGameString);
File::CreateFullPath(pathData_bin);
}

View File

@ -80,7 +80,7 @@ void VideoConfig::Load(const char *main_ini_file, bool filecheck_passed, const c
SET_STATE(iniFile.Get("Settings", "AnaglyphStereo", &bAnaglyphStereo, false), bAnaglyphStereo);
SET_STATE(iniFile.Get("Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation, 200), iAnaglyphStereoSeparation);
SET_STATE(iniFile.Get("Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle, 0), iAnaglyphFocalAngle);
SET_STATE(iniFile.Get("Settings", "EnablePixelLigting", &bEnablePixelLighting, false), bEnablePixelLighting);
SET_STATE(iniFile.Get("Settings", "EnablePixelLighting", &bEnablePixelLighting, false), bEnablePixelLighting);
SET_STATE(iniFile.Get("Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth, false), bEnablePerPixelDepth);
SET_STATE(iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, false), bShowShaderErrors);
@ -170,7 +170,7 @@ void VideoConfig::GameIniLoad(const char *ini_file)
SET_UISTATE(iniFile.GetIfExists("Video_Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation), iAnaglyphStereoSeparation);
SET_UISTATE(iniFile.GetIfExists("Video_Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle), iAnaglyphFocalAngle);
SET_UISTATE(iniFile.GetIfExists("Video_Settings", "EnablePixelLigting", &bEnablePixelLighting), bEnablePixelLighting);
SET_UISTATE(iniFile.GetIfExists("Video_Settings", "EnablePixelLighting", &bEnablePixelLighting), bEnablePixelLighting);
SET_UISTATE(iniFile.GetIfExists("Video_Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth), bEnablePerPixelDepth);
SET_UISTATE(iniFile.GetIfExists("Video_Settings", "ShowShaderErrors", &bShowShaderErrors), bShowShaderErrors);
@ -263,7 +263,7 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Settings", "AnaglyphStereo", bAnaglyphStereo);
iniFile.Set("Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation);
iniFile.Set("Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle);
iniFile.Set("Settings", "EnablePixelLigting", bEnablePixelLighting);
iniFile.Set("Settings", "EnablePixelLighting", bEnablePixelLighting);
iniFile.Set("Settings", "EnablePerPixelDepth", bEnablePerPixelDepth);
@ -338,7 +338,7 @@ void VideoConfig::GameIniSave(const char* default_ini, const char* game_ini)
CHECK_UISTATE("Video_Settings", "AnaglyphStereo", bAnaglyphStereo);
CHECK_UISTATE("Video_Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation);
CHECK_UISTATE("Video_Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle);
CHECK_UISTATE("Video_Settings", "EnablePixelLigting", bEnablePixelLighting);
CHECK_UISTATE("Video_Settings", "EnablePixelLighting", bEnablePixelLighting);
CHECK_UISTATE("Video_Settings", "EnablePerPixelDepth", bEnablePerPixelDepth);
CHECK_UISTATE("Video_Settings", "ShowShaderErrors", bShowShaderErrors);

View File

@ -1571,7 +1571,7 @@ bool Renderer::SaveScreenshot(const std::string &filename, const TargetRectangle
{
u32 W = back_rc.GetWidth();
u32 H = back_rc.GetHeight();
u8 *data = new u8[3 * W * H]; // TODO: possible memleak, and new'd data is given to wxImage which requires malloc
u8 *data = (u8 *)malloc((sizeof(u8) * 3 * W * H));
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(back_rc.left, back_rc.bottom, W, H, GL_RGB, GL_UNSIGNED_BYTE, data);
@ -1579,6 +1579,7 @@ bool Renderer::SaveScreenshot(const std::string &filename, const TargetRectangle
// Show failure message
if (GL_REPORT_ERROR() != GL_NO_ERROR)
{
free(data);
OSD::AddMessage("Error capturing or saving screenshot.", 2000);
return false;
}
@ -1608,7 +1609,7 @@ bool Renderer::SaveScreenshot(const std::string &filename, const TargetRectangle
#else
bool result = SaveTGA(filename.c_str(), W, H, data);
delete[] data;
free(data);
#endif
return result;