Fix some more resizing and saving of such.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5985 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-07-27 22:12:19 +00:00
parent 67e6ae5fac
commit 9fea384ed3
8 changed files with 130 additions and 141 deletions

View File

@ -124,7 +124,7 @@ void Console_Submit(const char *cmd)
{
u32 data = Memory::ReadUnchecked_U32(addr);
DisassembleGekko(data, addr, disasm, 256);
printf("%08x: %08x: %s\n", addr, data, disasm);
DEBUG_LOG(CONSOLE, "%08x: %08x: %s\n", addr, data, disasm);
}
}
CASE("help")
@ -151,8 +151,5 @@ void Console_Submit(const char *cmd)
g_symbolDB.List();
}
else
{
printf("blach\n");
ERROR_LOG(CONSOLE, "Invalid command");
}
}

View File

@ -429,13 +429,9 @@ CFrame::CFrame(wxFrame* parent,
}
else
{
IniFile ini; int winpos;
ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
ini.Get("LogWindow", "pos", &winpos, wxAUI_DOCK_RIGHT);
m_Mgr->GetPane(wxT("Pane 0")).Show().PaneBorder(false).CaptionVisible(false).Layer(0).Center();
m_Mgr->GetPane(wxT("Pane 1")).Hide().PaneBorder(false).CaptionVisible(true).Layer(0)
.FloatingSize(wxSize(600, 350)).CloseButton(false).Direction(winpos);
.FloatingSize(wxSize(600, 350)).CloseButton(false);
AuiFullscreen = m_Mgr->SavePerspective();
}
@ -455,7 +451,6 @@ CFrame::CFrame(wxFrame* parent,
}
else
{
SetSimplePaneSize();
if (SConfig::GetInstance().m_InterfaceLogWindow)
ToggleLogWindow(true);
if (SConfig::GetInstance().m_InterfaceConsole)

View File

@ -147,9 +147,6 @@ class CFrame : public CRenderFrame
wxWindow * GetNotebookPageFromId(wxWindowID Id);
wxAuiNotebook * GetNotebookFromId(u32);
int GetNotebookCount();
int Limit(int,int,int);
int PercentageToPixels(int,int);
int PixelsToPercentage(int,int);
wxString GetMenuLabel(int Id);
// Perspectives
@ -168,7 +165,6 @@ class CFrame : public CRenderFrame
void DoAddPage(wxWindow *Win, int i, bool Float);
void DoRemovePage(wxWindow *, bool bHide = true);
void TogglePane();
void SetSimplePaneSize();
void SetPaneSize();
void ResetToolbarStyle();
void TogglePaneStyle(bool On, int EventId);

View File

@ -377,13 +377,24 @@ void CFrame::TogglePane()
if (NB)
{
if (NB->GetPageCount() == 0)
{
m_LogWindow->x = m_Mgr->GetPane(wxT("Pane 1")).rect.GetWidth();
m_LogWindow->y = m_Mgr->GetPane(wxT("Pane 1")).rect.GetHeight();
m_LogWindow->winpos = m_Mgr->GetPane(wxT("Pane 1")).dock_direction;
m_Mgr->GetPane(wxT("Pane 1")).Hide();
}
else
m_Mgr->GetPane(wxT("Pane 1")).Show();
{
m_Mgr->GetPane(wxT("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(wxT("Pane 1")).MinSize(-1, -1);
}
m_Mgr->Update();
}
SetSimplePaneSize();
}
void CFrame::DoRemovePage(wxWindow *Win, bool bHide)
@ -721,22 +732,11 @@ void CFrame::ResizeConsole()
#endif
}
void CFrame::SetSimplePaneSize()
static int Limit(int i, int Low, int High)
{
int x = 0, y = 0;
// Produce pixel width from percentage width
int Size = PercentageToPixels(50, GetSize().GetX());
IniFile ini;
ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
ini.Get("LogWindow", "x", &x, Size);
ini.Get("LogWindow", "y", &y, Size);
// Update size
m_Mgr->GetPane(wxT("Pane 0")).BestSize(x, y);
m_Mgr->GetPane(wxT("Pane 1")).BestSize(x, y);
m_Mgr->Update();
if (i < Low) return Low;
if (i > High) return High;
return i;
}
void CFrame::SetPaneSize()
@ -755,10 +755,12 @@ void CFrame::SetPaneSize()
u32 W = Perspectives[ActivePerspective].Width[j],
H = Perspectives[ActivePerspective].Height[j];
// Check limits
W = Limit(W, 5, 95); H = Limit(H, 5, 95);
// Produce pixel width from percentage width
W = PercentageToPixels(W, iClientX); H = PercentageToPixels(H, iClientY);
m_Mgr->GetAllPanes().Item(i).BestSize(W,H).MinSize(W,H).MaxSize(W,H);
W = Limit(W, 5, 95);
H = Limit(H, 5, 95);
// Convert percentages to pixel lengths
W = (W * iClientX) / 100;
H = (H * iClientY) / 100;
m_Mgr->GetAllPanes().Item(i).BestSize(W,H).MinSize(W,H);
j++;
}
@ -769,7 +771,7 @@ void CFrame::SetPaneSize()
{
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{
m_Mgr->GetAllPanes().Item(i).MinSize(-1,-1).MaxSize(-1,-1);
m_Mgr->GetAllPanes().Item(i).MinSize(-1,-1);
}
}
}
@ -882,12 +884,13 @@ void CFrame::UpdateCurrentPerspective()
if (!m_Mgr->GetAllPanes().Item(i).window->
IsKindOf(CLASSINFO(wxAuiToolBar)))
{
current->Width.push_back(PixelsToPercentage(
m_Mgr->GetAllPanes().Item(i).window->
GetClientSize().GetX(), iClientX));
current->Height.push_back(PixelsToPercentage(
m_Mgr->GetAllPanes().Item(i).window->
GetClientSize().GetY(), iClientY));
// Save width and height as a percentage of the client width and height
current->Width.push_back(
(m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetX() * 100) /
iClientX);
current->Height.push_back(
(m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetY() * 100) /
iClientY);
}
}
}
@ -956,28 +959,6 @@ void CFrame::AddPane()
m_Mgr->Update();
}
// Utility
// ---------------------
int CFrame::Limit(int i, int Low, int High)
{
if (i < Low) return Low;
if (i > High) return High;
return i;
}
int CFrame::PercentageToPixels(int Percentage, int Total)
{
int Pixels = (int)((float)Total * ((float)Percentage / 100.0));
return Pixels;
}
int CFrame::PixelsToPercentage(int Pixels, int Total)
{
int Percentage = (int)(((float)Pixels / (float)Total) * 100.0);
return Percentage;
}
wxWindow * CFrame::GetNotebookPageFromId(wxWindowID Id)
{
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)

View File

@ -1451,13 +1451,21 @@ void CFrame::DoToggleToolbar(bool _show)
if (_show)
{
m_Mgr->GetPane(wxT("TBMain")).Show();
if (g_pCodeWindow) { m_Mgr->GetPane(wxT("TBDebug")).Show(); m_Mgr->GetPane(wxT("TBAui")).Show(); }
if (g_pCodeWindow)
{
m_Mgr->GetPane(wxT("TBDebug")).Show();
m_Mgr->GetPane(wxT("TBAui")).Show();
}
m_Mgr->Update();
}
else
{
m_Mgr->GetPane(wxT("TBMain")).Hide();
if (g_pCodeWindow) { m_Mgr->GetPane(wxT("TBDebug")).Hide(); m_Mgr->GetPane(wxT("TBAui")).Hide(); }
if (g_pCodeWindow)
{
m_Mgr->GetPane(wxT("TBDebug")).Hide();
m_Mgr->GetPane(wxT("TBAui")).Hide();
}
m_Mgr->Update();
}
}

View File

@ -1261,7 +1261,7 @@ void CGameListCtrl::OnSize(wxSizeEvent& event)
void CGameListCtrl::AutomaticColumnWidth()
{
wxRect rc(GetClientRect());
wxRect rc(GetParent()->GetRect());
if (GetColumnCount() == 1)
{

View File

@ -51,6 +51,7 @@ END_EVENT_TABLE()
CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, long style, const wxString& name)
: wxPanel(parent, id, pos, size, style, name)
, x(0), y(0), winpos(0)
, Parent(parent) , m_LogAccess(true)
, m_Log(NULL), m_cmdline(NULL), m_FontChoice(NULL)
, m_LogSection(1)
@ -80,8 +81,11 @@ void CLogWindow::CreateGUIControls()
wxLevels.Add(wxT("Warning"));
wxLevels.Add(wxT("Info"));
wxLevels.Add(wxT("Debug"));
for (int i = 0; i < MAX_LOGLEVEL; ++i) wxLevelsUse.Add(wxString::Format(wxT("%s"), wxLevels.Item(i).c_str()));
m_verbosity = new wxRadioBox(this, IDM_VERBOSITY, wxT("Verbosity"), wxDefaultPosition, wxDefaultSize, wxLevelsUse, 0, wxRA_SPECIFY_ROWS, wxDefaultValidator);
for (int i = 0; i < MAX_LOGLEVEL; ++i)
wxLevelsUse.Add(wxString::Format(wxT("%s"), wxLevels.Item(i).c_str()));
m_verbosity = new wxRadioBox(this, IDM_VERBOSITY, wxT("Verbosity"),
wxDefaultPosition, wxDefaultSize, wxLevelsUse, 0,
wxRA_SPECIFY_ROWS, wxDefaultValidator);
// Don't take up so much space
m_verbosity->SetFont(wxFont(7, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
@ -92,9 +96,7 @@ void CLogWindow::CreateGUIControls()
m_FontChoice->Append(wxT("Monospaced font"));
m_FontChoice->Append(wxT("Selected font"));
m_FontChoice->SetSelection(0);
// wxTextCtrl *Tmp = CreateTextCtrl(this);
// DefaultFont = Tmp->GetFont();
// Tmp->Destroy();
DefaultFont = GetFont();
MonoSpaceFont.SetNativeFontInfoUserDesc(wxString::FromAscii("lucida console windows-1252"));
Font.push_back(DefaultFont);
Font.push_back(MonoSpaceFont);
@ -171,9 +173,12 @@ void CLogWindow::OnClose(wxCloseEvent& event)
void CLogWindow::SaveSettings()
{
IniFile ini;
if (!Parent->g_pCodeWindow)
{
ini.Set("LogWindow", "x", Parent->m_Mgr->GetPane(wxT("Pane 1")).rect.GetWidth());
ini.Set("LogWindow", "y", Parent->m_Mgr->GetPane(wxT("Pane 1")).rect.GetHeight());
ini.Set("LogWindow", "pos", Parent->m_Mgr->GetPane(wxT("Pane 1")).dock_direction);
}
ini.Set("Options", "Verbosity", m_verbosity->GetSelection() + 1);
ini.Set("Options", "Font", m_FontChoice->GetSelection());
ini.Set("Options", "WriteToFile", m_writeFile);
@ -188,6 +193,11 @@ void CLogWindow::LoadSettings()
{
IniFile ini;
ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
ini.Get("LogWindow", "x", &x, Parent->GetSize().GetX() / 2);
ini.Get("LogWindow", "y", &y, Parent->GetSize().GetY());
ini.Get("LogWindow", "pos", &winpos, wxAUI_DOCK_RIGHT);
int verbosity,font;
ini.Get("Options", "Verbosity", &verbosity, 0);
if (verbosity < 1) verbosity = 1;
@ -196,7 +206,7 @@ void CLogWindow::LoadSettings()
ini.Get("Options", "Font", &font, 0);
m_FontChoice->SetSelection(font);
if (m_FontChoice->GetSelection() < (int)Font.size())
m_Log->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, Font.at(m_FontChoice->GetSelection())));
m_Log->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, Font[m_FontChoice->GetSelection()]));
ini.Get("Options", "WriteToFile", &m_writeFile, true);
m_writeFileCB->SetValue(m_writeFile);
ini.Get("Options", "WriteToConsole", &m_writeConsole, true);
@ -312,7 +322,7 @@ wxTextCtrl* CLogWindow::CreateTextCtrl(wxPanel* parent, wxWindowID id, long Styl
if (m_FontChoice)
{
if (m_FontChoice->GetSelection() < (int)Font.size())
TC->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, Font.at(m_FontChoice->GetSelection())));
TC->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, Font[m_FontChoice->GetSelection()]));
}
return TC;
}
@ -358,9 +368,9 @@ void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
case IDM_FONT:
// Update selected font
Font.at(Font.size()-1) = DebuggerFont;
m_Log->SetStyle(0, m_Log->GetLastPosition(), wxTextAttr(wxNullColour, wxNullColour, Font.at(event.GetSelection())));
m_Log->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, Font.at(event.GetSelection())));
Font[Font.size()-1] = DebuggerFont;
m_Log->SetStyle(0, m_Log->GetLastPosition(), wxTextAttr(wxNullColour, wxNullColour, Font[event.GetSelection()]));
m_Log->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, Font[event.GetSelection()]));
break;
case IDM_WRITEFILE:

View File

@ -66,6 +66,8 @@ public:
void LoadSettings();
void Log(LogTypes::LOG_LEVELS, const char *text);
int x, y, winpos;
private:
CFrame *Parent;
wxFont DefaultFont, MonoSpaceFont;