mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
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:
@ -38,19 +38,19 @@ void Console_Submit(const char *cmd)
|
|||||||
CASE1("r")
|
CASE1("r")
|
||||||
{
|
{
|
||||||
Core::StartTrace(false);
|
Core::StartTrace(false);
|
||||||
INFO_LOG(CONSOLE, "read tracing started.");
|
INFO_LOG(CONSOLE, "read tracing started.");
|
||||||
}
|
}
|
||||||
CASE1("w")
|
CASE1("w")
|
||||||
{
|
{
|
||||||
Core::StartTrace(true);
|
Core::StartTrace(true);
|
||||||
INFO_LOG(CONSOLE, "write tracing started.");
|
INFO_LOG(CONSOLE, "write tracing started.");
|
||||||
}
|
}
|
||||||
CASE("trans")
|
CASE("trans")
|
||||||
{
|
{
|
||||||
TCHAR temp[256];
|
TCHAR temp[256];
|
||||||
u32 addr;
|
u32 addr;
|
||||||
sscanf(cmd, "%s %08x", temp, &addr);
|
sscanf(cmd, "%s %08x", temp, &addr);
|
||||||
|
|
||||||
if (addr)
|
if (addr)
|
||||||
{
|
{
|
||||||
#if MAX_LOGLEVEL >= INFO_LEVEL
|
#if MAX_LOGLEVEL >= INFO_LEVEL
|
||||||
@ -124,7 +124,7 @@ void Console_Submit(const char *cmd)
|
|||||||
{
|
{
|
||||||
u32 data = Memory::ReadUnchecked_U32(addr);
|
u32 data = Memory::ReadUnchecked_U32(addr);
|
||||||
DisassembleGekko(data, addr, disasm, 256);
|
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")
|
CASE("help")
|
||||||
@ -151,8 +151,5 @@ void Console_Submit(const char *cmd)
|
|||||||
g_symbolDB.List();
|
g_symbolDB.List();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
ERROR_LOG(CONSOLE, "Invalid command");
|
||||||
printf("blach\n");
|
|
||||||
ERROR_LOG(CONSOLE, "Invalid command");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -429,13 +429,9 @@ CFrame::CFrame(wxFrame* parent,
|
|||||||
}
|
}
|
||||||
else
|
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 0")).Show().PaneBorder(false).CaptionVisible(false).Layer(0).Center();
|
||||||
m_Mgr->GetPane(wxT("Pane 1")).Hide().PaneBorder(false).CaptionVisible(true).Layer(0)
|
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();
|
AuiFullscreen = m_Mgr->SavePerspective();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,7 +451,6 @@ CFrame::CFrame(wxFrame* parent,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetSimplePaneSize();
|
|
||||||
if (SConfig::GetInstance().m_InterfaceLogWindow)
|
if (SConfig::GetInstance().m_InterfaceLogWindow)
|
||||||
ToggleLogWindow(true);
|
ToggleLogWindow(true);
|
||||||
if (SConfig::GetInstance().m_InterfaceConsole)
|
if (SConfig::GetInstance().m_InterfaceConsole)
|
||||||
|
@ -147,9 +147,6 @@ class CFrame : public CRenderFrame
|
|||||||
wxWindow * GetNotebookPageFromId(wxWindowID Id);
|
wxWindow * GetNotebookPageFromId(wxWindowID Id);
|
||||||
wxAuiNotebook * GetNotebookFromId(u32);
|
wxAuiNotebook * GetNotebookFromId(u32);
|
||||||
int GetNotebookCount();
|
int GetNotebookCount();
|
||||||
int Limit(int,int,int);
|
|
||||||
int PercentageToPixels(int,int);
|
|
||||||
int PixelsToPercentage(int,int);
|
|
||||||
wxString GetMenuLabel(int Id);
|
wxString GetMenuLabel(int Id);
|
||||||
|
|
||||||
// Perspectives
|
// Perspectives
|
||||||
@ -168,7 +165,6 @@ class CFrame : public CRenderFrame
|
|||||||
void DoAddPage(wxWindow *Win, int i, bool Float);
|
void DoAddPage(wxWindow *Win, int i, bool Float);
|
||||||
void DoRemovePage(wxWindow *, bool bHide = true);
|
void DoRemovePage(wxWindow *, bool bHide = true);
|
||||||
void TogglePane();
|
void TogglePane();
|
||||||
void SetSimplePaneSize();
|
|
||||||
void SetPaneSize();
|
void SetPaneSize();
|
||||||
void ResetToolbarStyle();
|
void ResetToolbarStyle();
|
||||||
void TogglePaneStyle(bool On, int EventId);
|
void TogglePaneStyle(bool On, int EventId);
|
||||||
|
@ -377,13 +377,24 @@ void CFrame::TogglePane()
|
|||||||
if (NB)
|
if (NB)
|
||||||
{
|
{
|
||||||
if (NB->GetPageCount() == 0)
|
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();
|
m_Mgr->GetPane(wxT("Pane 1")).Hide();
|
||||||
|
}
|
||||||
else
|
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();
|
m_Mgr->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSimplePaneSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::DoRemovePage(wxWindow *Win, bool bHide)
|
void CFrame::DoRemovePage(wxWindow *Win, bool bHide)
|
||||||
@ -721,22 +732,11 @@ void CFrame::ResizeConsole()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::SetSimplePaneSize()
|
static int Limit(int i, int Low, int High)
|
||||||
{
|
{
|
||||||
int x = 0, y = 0;
|
if (i < Low) return Low;
|
||||||
|
if (i > High) return High;
|
||||||
// Produce pixel width from percentage width
|
return i;
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::SetPaneSize()
|
void CFrame::SetPaneSize()
|
||||||
@ -755,10 +755,12 @@ void CFrame::SetPaneSize()
|
|||||||
u32 W = Perspectives[ActivePerspective].Width[j],
|
u32 W = Perspectives[ActivePerspective].Width[j],
|
||||||
H = Perspectives[ActivePerspective].Height[j];
|
H = Perspectives[ActivePerspective].Height[j];
|
||||||
// Check limits
|
// Check limits
|
||||||
W = Limit(W, 5, 95); H = Limit(H, 5, 95);
|
W = Limit(W, 5, 95);
|
||||||
// Produce pixel width from percentage width
|
H = Limit(H, 5, 95);
|
||||||
W = PercentageToPixels(W, iClientX); H = PercentageToPixels(H, iClientY);
|
// Convert percentages to pixel lengths
|
||||||
m_Mgr->GetAllPanes().Item(i).BestSize(W,H).MinSize(W,H).MaxSize(W,H);
|
W = (W * iClientX) / 100;
|
||||||
|
H = (H * iClientY) / 100;
|
||||||
|
m_Mgr->GetAllPanes().Item(i).BestSize(W,H).MinSize(W,H);
|
||||||
|
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
@ -769,7 +771,7 @@ void CFrame::SetPaneSize()
|
|||||||
{
|
{
|
||||||
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiToolBar)))
|
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->
|
if (!m_Mgr->GetAllPanes().Item(i).window->
|
||||||
IsKindOf(CLASSINFO(wxAuiToolBar)))
|
IsKindOf(CLASSINFO(wxAuiToolBar)))
|
||||||
{
|
{
|
||||||
current->Width.push_back(PixelsToPercentage(
|
// Save width and height as a percentage of the client width and height
|
||||||
m_Mgr->GetAllPanes().Item(i).window->
|
current->Width.push_back(
|
||||||
GetClientSize().GetX(), iClientX));
|
(m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetX() * 100) /
|
||||||
current->Height.push_back(PixelsToPercentage(
|
iClientX);
|
||||||
m_Mgr->GetAllPanes().Item(i).window->
|
current->Height.push_back(
|
||||||
GetClientSize().GetY(), iClientY));
|
(m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetY() * 100) /
|
||||||
|
iClientY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -956,28 +959,6 @@ void CFrame::AddPane()
|
|||||||
m_Mgr->Update();
|
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)
|
wxWindow * CFrame::GetNotebookPageFromId(wxWindowID Id)
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||||
|
@ -1451,13 +1451,21 @@ void CFrame::DoToggleToolbar(bool _show)
|
|||||||
if (_show)
|
if (_show)
|
||||||
{
|
{
|
||||||
m_Mgr->GetPane(wxT("TBMain")).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();
|
m_Mgr->Update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Mgr->GetPane(wxT("TBMain")).Hide();
|
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();
|
m_Mgr->Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1261,7 +1261,7 @@ void CGameListCtrl::OnSize(wxSizeEvent& event)
|
|||||||
|
|
||||||
void CGameListCtrl::AutomaticColumnWidth()
|
void CGameListCtrl::AutomaticColumnWidth()
|
||||||
{
|
{
|
||||||
wxRect rc(GetClientRect());
|
wxRect rc(GetParent()->GetRect());
|
||||||
|
|
||||||
if (GetColumnCount() == 1)
|
if (GetColumnCount() == 1)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,8 @@ END_EVENT_TABLE()
|
|||||||
CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos,
|
CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos,
|
||||||
const wxSize& size, long style, const wxString& name)
|
const wxSize& size, long style, const wxString& name)
|
||||||
: wxPanel(parent, id, pos, size, style, name)
|
: wxPanel(parent, id, pos, size, style, name)
|
||||||
, Parent(parent) , m_LogAccess(true)
|
, x(0), y(0), winpos(0)
|
||||||
|
, Parent(parent) , m_LogAccess(true)
|
||||||
, m_Log(NULL), m_cmdline(NULL), m_FontChoice(NULL)
|
, m_Log(NULL), m_cmdline(NULL), m_FontChoice(NULL)
|
||||||
, m_LogSection(1)
|
, m_LogSection(1)
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
@ -74,27 +75,28 @@ CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos,
|
|||||||
void CLogWindow::CreateGUIControls()
|
void CLogWindow::CreateGUIControls()
|
||||||
{
|
{
|
||||||
// Verbosity
|
// Verbosity
|
||||||
wxArrayString wxLevels, wxLevelsUse;
|
wxArrayString wxLevels, wxLevelsUse;
|
||||||
wxLevels.Add(wxT("Notice"));
|
wxLevels.Add(wxT("Notice"));
|
||||||
wxLevels.Add(wxT("Error"));
|
wxLevels.Add(wxT("Error"));
|
||||||
wxLevels.Add(wxT("Warning"));
|
wxLevels.Add(wxT("Warning"));
|
||||||
wxLevels.Add(wxT("Info"));
|
wxLevels.Add(wxT("Info"));
|
||||||
wxLevels.Add(wxT("Debug"));
|
wxLevels.Add(wxT("Debug"));
|
||||||
for (int i = 0; i < MAX_LOGLEVEL; ++i) wxLevelsUse.Add(wxString::Format(wxT("%s"), wxLevels.Item(i).c_str()));
|
for (int i = 0; i < MAX_LOGLEVEL; ++i)
|
||||||
m_verbosity = new wxRadioBox(this, IDM_VERBOSITY, wxT("Verbosity"), wxDefaultPosition, wxDefaultSize, wxLevelsUse, 0, wxRA_SPECIFY_ROWS, wxDefaultValidator);
|
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
|
// Don't take up so much space
|
||||||
m_verbosity->SetFont(wxFont(7, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
|
m_verbosity->SetFont(wxFont(7, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
|
||||||
|
|
||||||
// Font
|
// Font
|
||||||
m_FontChoice = new wxChoice(this, IDM_FONT, wxDefaultPosition, wxDefaultSize, 0, NULL, 0, wxDefaultValidator);
|
m_FontChoice = new wxChoice(this, IDM_FONT, wxDefaultPosition, wxDefaultSize, 0, NULL, 0, wxDefaultValidator);
|
||||||
|
|
||||||
m_FontChoice->Append(wxT("Default font"));
|
m_FontChoice->Append(wxT("Default font"));
|
||||||
m_FontChoice->Append(wxT("Monospaced font"));
|
m_FontChoice->Append(wxT("Monospaced font"));
|
||||||
m_FontChoice->Append(wxT("Selected font"));
|
m_FontChoice->Append(wxT("Selected font"));
|
||||||
m_FontChoice->SetSelection(0);
|
m_FontChoice->SetSelection(0);
|
||||||
// wxTextCtrl *Tmp = CreateTextCtrl(this);
|
DefaultFont = GetFont();
|
||||||
// DefaultFont = Tmp->GetFont();
|
|
||||||
// Tmp->Destroy();
|
|
||||||
MonoSpaceFont.SetNativeFontInfoUserDesc(wxString::FromAscii("lucida console windows-1252"));
|
MonoSpaceFont.SetNativeFontInfoUserDesc(wxString::FromAscii("lucida console windows-1252"));
|
||||||
Font.push_back(DefaultFont);
|
Font.push_back(DefaultFont);
|
||||||
Font.push_back(MonoSpaceFont);
|
Font.push_back(MonoSpaceFont);
|
||||||
@ -122,12 +124,12 @@ void CLogWindow::CreateGUIControls()
|
|||||||
// Left side: buttons (-submit), options, and log type selection
|
// Left side: buttons (-submit), options, and log type selection
|
||||||
wxStaticBoxSizer* sbLeftOptions = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Options"));
|
wxStaticBoxSizer* sbLeftOptions = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Options"));
|
||||||
|
|
||||||
wxBoxSizer* sLogCtrl = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer* sLogCtrl = new wxBoxSizer(wxHORIZONTAL);
|
||||||
sLogCtrl->Add(new wxButton(this, IDM_TOGGLEALL, wxT("Toggle all"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT), 1);
|
sLogCtrl->Add(new wxButton(this, IDM_TOGGLEALL, wxT("Toggle all"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT), 1);
|
||||||
sLogCtrl->Add(new wxButton(this, IDM_CLEARLOG, wxT("Clear"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT), 1);
|
sLogCtrl->Add(new wxButton(this, IDM_CLEARLOG, wxT("Clear"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT), 1);
|
||||||
|
|
||||||
sbLeftOptions->Add(m_FontChoice, 0, (wxDOWN), 1);
|
sbLeftOptions->Add(m_FontChoice, 0, (wxDOWN), 1);
|
||||||
sbLeftOptions->Add(m_WrapLine, 0, (wxDOWN), 1);
|
sbLeftOptions->Add(m_WrapLine, 0, (wxDOWN), 1);
|
||||||
sbLeftOptions->Add(m_writeFileCB, 0, (wxDOWN), 1);
|
sbLeftOptions->Add(m_writeFileCB, 0, (wxDOWN), 1);
|
||||||
sbLeftOptions->Add(m_writeConsoleCB, 0, (wxDOWN), 1);
|
sbLeftOptions->Add(m_writeConsoleCB, 0, (wxDOWN), 1);
|
||||||
sbLeftOptions->Add(m_writeWindowCB, 0);
|
sbLeftOptions->Add(m_writeWindowCB, 0);
|
||||||
@ -135,10 +137,10 @@ void CLogWindow::CreateGUIControls()
|
|||||||
sLeft->Add(m_verbosity, 0, wxEXPAND | (wxLEFT | wxRIGHT), 5);
|
sLeft->Add(m_verbosity, 0, wxEXPAND | (wxLEFT | wxRIGHT), 5);
|
||||||
sLeft->Add(sbLeftOptions, 0, wxEXPAND | (wxLEFT | wxRIGHT), 5);
|
sLeft->Add(sbLeftOptions, 0, wxEXPAND | (wxLEFT | wxRIGHT), 5);
|
||||||
sLeft->Add(sLogCtrl, 0, wxEXPAND);
|
sLeft->Add(sLogCtrl, 0, wxEXPAND);
|
||||||
sLeft->Add(m_checks, 1, wxEXPAND);
|
sLeft->Add(m_checks, 1, wxEXPAND);
|
||||||
|
|
||||||
PopulateRight();
|
PopulateRight();
|
||||||
|
|
||||||
sUber->Add(sLeft, 0, wxEXPAND);
|
sUber->Add(sLeft, 0, wxEXPAND);
|
||||||
sUber->Add(sRight, 1, wxEXPAND);
|
sUber->Add(sRight, 1, wxEXPAND);
|
||||||
this->SetSizer(sUber);
|
this->SetSizer(sUber);
|
||||||
@ -171,9 +173,12 @@ void CLogWindow::OnClose(wxCloseEvent& event)
|
|||||||
void CLogWindow::SaveSettings()
|
void CLogWindow::SaveSettings()
|
||||||
{
|
{
|
||||||
IniFile ini;
|
IniFile ini;
|
||||||
ini.Set("LogWindow", "x", Parent->m_Mgr->GetPane(wxT("Pane 1")).rect.GetWidth());
|
if (!Parent->g_pCodeWindow)
|
||||||
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("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", "Verbosity", m_verbosity->GetSelection() + 1);
|
||||||
ini.Set("Options", "Font", m_FontChoice->GetSelection());
|
ini.Set("Options", "Font", m_FontChoice->GetSelection());
|
||||||
ini.Set("Options", "WriteToFile", m_writeFile);
|
ini.Set("Options", "WriteToFile", m_writeFile);
|
||||||
@ -188,6 +193,11 @@ void CLogWindow::LoadSettings()
|
|||||||
{
|
{
|
||||||
IniFile ini;
|
IniFile ini;
|
||||||
ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
|
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;
|
int verbosity,font;
|
||||||
ini.Get("Options", "Verbosity", &verbosity, 0);
|
ini.Get("Options", "Verbosity", &verbosity, 0);
|
||||||
if (verbosity < 1) verbosity = 1;
|
if (verbosity < 1) verbosity = 1;
|
||||||
@ -196,7 +206,7 @@ void CLogWindow::LoadSettings()
|
|||||||
ini.Get("Options", "Font", &font, 0);
|
ini.Get("Options", "Font", &font, 0);
|
||||||
m_FontChoice->SetSelection(font);
|
m_FontChoice->SetSelection(font);
|
||||||
if (m_FontChoice->GetSelection() < (int)Font.size())
|
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);
|
ini.Get("Options", "WriteToFile", &m_writeFile, true);
|
||||||
m_writeFileCB->SetValue(m_writeFile);
|
m_writeFileCB->SetValue(m_writeFile);
|
||||||
ini.Get("Options", "WriteToConsole", &m_writeConsole, true);
|
ini.Get("Options", "WriteToConsole", &m_writeConsole, true);
|
||||||
@ -241,7 +251,7 @@ void CLogWindow::OnClear(wxCommandEvent& WXUNUSED (event))
|
|||||||
|
|
||||||
m_LogSection.Enter();
|
m_LogSection.Enter();
|
||||||
int msgQueueSize = (int)msgQueue.size();
|
int msgQueueSize = (int)msgQueue.size();
|
||||||
for (int i = 0; i < msgQueueSize; i++)
|
for (int i = 0; i < msgQueueSize; i++)
|
||||||
msgQueue.pop();
|
msgQueue.pop();
|
||||||
m_LogSection.Leave();
|
m_LogSection.Leave();
|
||||||
|
|
||||||
@ -263,7 +273,7 @@ void CLogWindow::OnToggleAll(wxCommandEvent& WXUNUSED (event))
|
|||||||
enableAll = !enableAll;
|
enableAll = !enableAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append checkboxes and update checked groups.
|
// Append checkboxes and update checked groups.
|
||||||
void CLogWindow::UpdateChecks()
|
void CLogWindow::UpdateChecks()
|
||||||
{
|
{
|
||||||
// This is only run once to append checkboxes to the wxCheckListBox.
|
// This is only run once to append checkboxes to the wxCheckListBox.
|
||||||
@ -307,12 +317,12 @@ void CLogWindow::PopulateRight()
|
|||||||
|
|
||||||
wxTextCtrl* CLogWindow::CreateTextCtrl(wxPanel* parent, wxWindowID id, long Style)
|
wxTextCtrl* CLogWindow::CreateTextCtrl(wxPanel* parent, wxWindowID id, long Style)
|
||||||
{
|
{
|
||||||
wxTextCtrl* TC = new wxTextCtrl(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, Style);
|
wxTextCtrl* TC = new wxTextCtrl(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, Style);
|
||||||
TC->SetBackgroundColour(*wxBLACK);
|
TC->SetBackgroundColour(*wxBLACK);
|
||||||
if (m_FontChoice)
|
if (m_FontChoice)
|
||||||
{
|
{
|
||||||
if (m_FontChoice->GetSelection() < (int)Font.size())
|
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;
|
return TC;
|
||||||
}
|
}
|
||||||
@ -322,7 +332,7 @@ void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
wxString Text;
|
wxString Text;
|
||||||
|
|
||||||
switch (event.GetId())
|
switch (event.GetId())
|
||||||
{
|
{
|
||||||
case IDM_VERBOSITY:
|
case IDM_VERBOSITY:
|
||||||
{
|
{
|
||||||
@ -335,7 +345,7 @@ void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_WRAPLINE:
|
case IDM_WRAPLINE:
|
||||||
// SetWindowStyleFlag doesn't fully work, we need to redraw the window
|
// SetWindowStyleFlag doesn't fully work, we need to redraw the window
|
||||||
//m_Log->SetWindowStyleFlag(m_Log->GetWindowStyleFlag() ^ wxTE_DONTWRAP);
|
//m_Log->SetWindowStyleFlag(m_Log->GetWindowStyleFlag() ^ wxTE_DONTWRAP);
|
||||||
/* Notice: To retain the colors when changing word wrapping we need to
|
/* Notice: To retain the colors when changing word wrapping we need to
|
||||||
@ -353,14 +363,14 @@ void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
|
|||||||
m_Log->SetDefaultStyle(wxTextAttr(*wxWHITE));
|
m_Log->SetDefaultStyle(wxTextAttr(*wxWHITE));
|
||||||
m_Log->AppendText(Text);
|
m_Log->AppendText(Text);
|
||||||
PopulateRight();
|
PopulateRight();
|
||||||
m_LogAccess = true;
|
m_LogAccess = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_FONT:
|
case IDM_FONT:
|
||||||
// Update selected font
|
// Update selected font
|
||||||
Font.at(Font.size()-1) = DebuggerFont;
|
Font[Font.size()-1] = DebuggerFont;
|
||||||
m_Log->SetStyle(0, m_Log->GetLastPosition(), wxTextAttr(wxNullColour, wxNullColour, Font.at(event.GetSelection())));
|
m_Log->SetStyle(0, m_Log->GetLastPosition(), wxTextAttr(wxNullColour, wxNullColour, Font[event.GetSelection()]));
|
||||||
m_Log->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, Font.at(event.GetSelection())));
|
m_Log->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, Font[event.GetSelection()]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_WRITEFILE:
|
case IDM_WRITEFILE:
|
||||||
@ -375,7 +385,7 @@ void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
|
|||||||
m_LogManager->removeListener((LogTypes::LOG_TYPE)i, m_fileLog);
|
m_LogManager->removeListener((LogTypes::LOG_TYPE)i, m_fileLog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_WRITEWINDOW:
|
case IDM_WRITEWINDOW:
|
||||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||||
@ -389,7 +399,7 @@ void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
|
|||||||
m_LogManager->removeListener((LogTypes::LOG_TYPE)i, this);
|
m_LogManager->removeListener((LogTypes::LOG_TYPE)i, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_WRITECONSOLE:
|
case IDM_WRITECONSOLE:
|
||||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||||
@ -426,7 +436,7 @@ void CLogWindow::OnLogCheck(wxCommandEvent& event)
|
|||||||
void CLogWindow::ToggleLog(int _logType, bool enable)
|
void CLogWindow::ToggleLog(int _logType, bool enable)
|
||||||
{
|
{
|
||||||
LogTypes::LOG_TYPE logType = (LogTypes::LOG_TYPE)_logType;
|
LogTypes::LOG_TYPE logType = (LogTypes::LOG_TYPE)_logType;
|
||||||
|
|
||||||
m_checks->Check(_logType, enable);
|
m_checks->Check(_logType, enable);
|
||||||
|
|
||||||
m_LogManager->setEnable(logType, enable);
|
m_LogManager->setEnable(logType, enable);
|
||||||
@ -483,34 +493,34 @@ void CLogWindow::UpdateLog()
|
|||||||
int msgQueueSize = (int)msgQueue.size();
|
int msgQueueSize = (int)msgQueue.size();
|
||||||
for (int i = 0; i < msgQueueSize; i++)
|
for (int i = 0; i < msgQueueSize; i++)
|
||||||
{
|
{
|
||||||
switch (msgQueue.front().first)
|
switch (msgQueue.front().first)
|
||||||
{
|
{
|
||||||
// red
|
// red
|
||||||
case ERROR_LEVEL:
|
case ERROR_LEVEL:
|
||||||
m_Log->SetDefaultStyle(wxTextAttr(*wxRED));
|
m_Log->SetDefaultStyle(wxTextAttr(*wxRED));
|
||||||
break;
|
break;
|
||||||
// yellow
|
// yellow
|
||||||
case WARNING_LEVEL:
|
case WARNING_LEVEL:
|
||||||
m_Log->SetDefaultStyle(wxTextAttr(wxColour(255, 255, 0)));
|
m_Log->SetDefaultStyle(wxTextAttr(wxColour(255, 255, 0)));
|
||||||
break;
|
break;
|
||||||
// green
|
// green
|
||||||
case NOTICE_LEVEL:
|
case NOTICE_LEVEL:
|
||||||
m_Log->SetDefaultStyle(wxTextAttr(*wxGREEN));
|
m_Log->SetDefaultStyle(wxTextAttr(*wxGREEN));
|
||||||
break;
|
break;
|
||||||
// cyan
|
// cyan
|
||||||
case INFO_LEVEL:
|
case INFO_LEVEL:
|
||||||
m_Log->SetDefaultStyle(wxTextAttr(*wxCYAN));
|
m_Log->SetDefaultStyle(wxTextAttr(*wxCYAN));
|
||||||
break;
|
break;
|
||||||
// light gray
|
// light gray
|
||||||
case DEBUG_LEVEL:
|
case DEBUG_LEVEL:
|
||||||
m_Log->SetDefaultStyle(wxTextAttr(wxColour(211, 211, 211)));
|
m_Log->SetDefaultStyle(wxTextAttr(wxColour(211, 211, 211)));
|
||||||
break;
|
break;
|
||||||
// white
|
// white
|
||||||
default:
|
default:
|
||||||
m_Log->SetDefaultStyle(wxTextAttr(*wxWHITE));
|
m_Log->SetDefaultStyle(wxTextAttr(*wxWHITE));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (msgQueue.front().second.size())
|
if (msgQueue.front().second.size())
|
||||||
{
|
{
|
||||||
int j = m_Log->GetLastPosition();
|
int j = m_Log->GetLastPosition();
|
||||||
m_Log->AppendText(msgQueue.front().second);
|
m_Log->AppendText(msgQueue.front().second);
|
||||||
@ -518,7 +528,7 @@ void CLogWindow::UpdateLog()
|
|||||||
m_Log->SetStyle(j, j + 9, wxTextAttr(*wxWHITE));
|
m_Log->SetStyle(j, j + 9, wxTextAttr(*wxWHITE));
|
||||||
}
|
}
|
||||||
collected_text.Append(msgQueue.front().second);
|
collected_text.Append(msgQueue.front().second);
|
||||||
msgQueue.pop();
|
msgQueue.pop();
|
||||||
}
|
}
|
||||||
m_LogSection.Leave();
|
m_LogSection.Leave();
|
||||||
// Write all text at once, needs multiple SetStyle, may not be better
|
// Write all text at once, needs multiple SetStyle, may not be better
|
||||||
@ -527,7 +537,7 @@ void CLogWindow::UpdateLog()
|
|||||||
m_LogTimer->Start(UPDATETIME);
|
m_LogTimer->Start(UPDATETIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogWindow::Log(LogTypes::LOG_LEVELS level, const char *text)
|
void CLogWindow::Log(LogTypes::LOG_LEVELS level, const char *text)
|
||||||
{
|
{
|
||||||
m_LogSection.Enter();
|
m_LogSection.Enter();
|
||||||
if (msgQueue.size() >= 100)
|
if (msgQueue.size() >= 100)
|
||||||
|
@ -28,19 +28,19 @@
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
IDM_LOG,
|
IDM_LOG,
|
||||||
IDM_CLEARLOG,
|
IDM_CLEARLOG,
|
||||||
IDM_LOGCHECKS,
|
IDM_LOGCHECKS,
|
||||||
IDM_OPTIONS,
|
IDM_OPTIONS,
|
||||||
IDM_TOGGLEALL,
|
IDM_TOGGLEALL,
|
||||||
IDM_WRAPLINE,
|
IDM_WRAPLINE,
|
||||||
IDM_WRITEFILE,
|
IDM_WRITEFILE,
|
||||||
IDM_WRITECONSOLE,
|
IDM_WRITECONSOLE,
|
||||||
IDM_WRITEWINDOW,
|
IDM_WRITEWINDOW,
|
||||||
IDTM_UPDATELOG,
|
IDTM_UPDATELOG,
|
||||||
IDM_VERBOSITY,
|
IDM_VERBOSITY,
|
||||||
IDM_FONT,
|
IDM_FONT,
|
||||||
IDM_SUBMITCMD
|
IDM_SUBMITCMD
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxTextCtrl;
|
class wxTextCtrl;
|
||||||
@ -66,10 +66,12 @@ public:
|
|||||||
void LoadSettings();
|
void LoadSettings();
|
||||||
void Log(LogTypes::LOG_LEVELS, const char *text);
|
void Log(LogTypes::LOG_LEVELS, const char *text);
|
||||||
|
|
||||||
|
int x, y, winpos;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CFrame *Parent;
|
CFrame *Parent;
|
||||||
wxFont DefaultFont, MonoSpaceFont;
|
wxFont DefaultFont, MonoSpaceFont;
|
||||||
std::vector<wxFont> Font;
|
std::vector<wxFont> Font;
|
||||||
wxTimer *m_LogTimer;
|
wxTimer *m_LogTimer;
|
||||||
FileLogListener *m_fileLog;
|
FileLogListener *m_fileLog;
|
||||||
ConsoleListener *m_console;
|
ConsoleListener *m_console;
|
||||||
|
Reference in New Issue
Block a user