LogWindow.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright 2009 Dolphin Emulator Project
  2. // Licensed under GPLv2+
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <mutex>
  6. #include <queue>
  7. #include <utility>
  8. #include <vector>
  9. #include <wx/font.h>
  10. #include <wx/panel.h>
  11. #include <wx/timer.h>
  12. #include "Common/CommonTypes.h"
  13. #include "Common/Logging/LogManager.h"
  14. class CFrame;
  15. class wxBoxSizer;
  16. class wxCheckBox;
  17. class wxChoice;
  18. class wxTextCtrl;
  19. // Uses multiple inheritance - only sane because LogListener is a pure virtual interface.
  20. class CLogWindow : public wxPanel, LogListener
  21. {
  22. public:
  23. CLogWindow(CFrame* parent,
  24. wxWindowID id = wxID_ANY,
  25. const wxPoint& pos = wxDefaultPosition,
  26. const wxSize& size = wxDefaultSize,
  27. long style = wxTAB_TRAVERSAL,
  28. const wxString& name = _("Log")
  29. );
  30. ~CLogWindow();
  31. void SaveSettings();
  32. void Log(LogTypes::LOG_LEVELS, const char *text) override;
  33. int x, y, winpos;
  34. private:
  35. CFrame* Parent;
  36. wxFont DefaultFont, MonoSpaceFont;
  37. std::vector<wxFont> LogFont;
  38. wxTimer m_LogTimer;
  39. LogManager* m_LogManager;
  40. std::queue<std::pair<u8, wxString> > msgQueue;
  41. bool m_writeFile, m_writeWindow, m_LogAccess;
  42. // Controls
  43. wxBoxSizer* sBottom;
  44. wxTextCtrl* m_Log;
  45. wxTextCtrl* m_cmdline;
  46. wxChoice* m_FontChoice;
  47. wxCheckBox* m_WrapLine;
  48. wxButton* m_clear_log_btn;
  49. std::mutex m_LogSection;
  50. wxTextCtrl* CreateTextCtrl(wxPanel* parent, wxWindowID id, long Style);
  51. void CreateGUIControls();
  52. void PopulateBottom();
  53. void UnPopulateBottom();
  54. void OnClose(wxCloseEvent& event);
  55. void OnFontChange(wxCommandEvent& event);
  56. void OnWrapLineCheck(wxCommandEvent& event);
  57. void OnClear(wxCommandEvent& event);
  58. void OnLogTimer(wxTimerEvent& WXUNUSED(event));
  59. void UpdateLog();
  60. };