@@ -90,6 +90,60 @@ extern "C" {
90
90
#include " supportpsx/binloader.h"
91
91
#include " tracy/Tracy.hpp"
92
92
93
+ unsigned PCSX::GUI::MarkDown::m_id = 0 ;
94
+
95
+ PCSX::GUI::MarkDown::MarkDown (GUI* gui) : m_gui(gui) {}
96
+
97
+ PCSX::GUI::MarkDown::MarkDown (GUI* gui, std::map<std::string_view, std::function<void ()>>&& customURLs)
98
+ : m_customURLs(std::move(customURLs)), m_gui(gui) {}
99
+
100
+ int PCSX::GUI::MarkDown::print (const std::string_view text) {
101
+ const char * ptr = text.data ();
102
+ const char * end = ptr + text.size ();
103
+ return imgui_md::print (ptr, end);
104
+ }
105
+
106
+ void PCSX::GUI::MarkDown::open_url () const {
107
+ if (m_href.starts_with (" http" )) {
108
+ openUrl (m_href);
109
+ return ;
110
+ }
111
+ auto i = m_customURLs.find (m_href);
112
+ if (i != m_customURLs.end ()) i->second ();
113
+ }
114
+
115
+ bool PCSX::GUI::MarkDown::get_image (image_info& nfo) const { return false ; }
116
+
117
+ void PCSX::GUI::MarkDown::BLOCK_CODE (const MD_BLOCK_CODE_DETAIL* d, bool e) {
118
+ imgui_md::BLOCK_CODE (d, e);
119
+ if (e) {
120
+ ImGui::PushStyleVar (ImGuiStyleVar_ChildBorderSize, 5 .0f );
121
+ auto color = ImGui::GetStyleColorVec4 (ImGuiCol_CheckMark);
122
+ ImGui::PushStyleColor (ImGuiCol_Text, color);
123
+ ImGui::PushID (m_id++);
124
+ ImGui::BeginChild (" pre" , ImVec2 (-FLT_MIN, 0 .0f ), ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY);
125
+ m_gui->useMonoFont ();
126
+ } else {
127
+ ImGui::PopFont ();
128
+ ImGui::EndChild ();
129
+ ImGui::PopID ();
130
+ ImGui::PopStyleColor ();
131
+ ImGui::PopStyleVar ();
132
+ }
133
+ }
134
+
135
+ void PCSX::GUI::MarkDown::SPAN_CODE (bool e) {
136
+ imgui_md::SPAN_CODE (e);
137
+ if (e) {
138
+ auto color = ImGui::GetStyleColorVec4 (ImGuiCol_CheckMark);
139
+ ImGui::PushStyleColor (ImGuiCol_Text, color);
140
+ m_gui->useMonoFont ();
141
+ } else {
142
+ ImGui::PopFont ();
143
+ ImGui::PopStyleColor ();
144
+ }
145
+ }
146
+
93
147
#ifdef _WIN32
94
148
extern " C" {
95
149
__declspec (dllexport) DWORD NvOptimusEnablement = 1;
@@ -937,6 +991,7 @@ void PCSX::GUI::startFrame() {
937
991
ImGui_ImplOpenGL3_NewFrame ();
938
992
ImGui_ImplGlfw_NewFrame ();
939
993
ImGui::NewFrame ();
994
+ MarkDown::newFrame ();
940
995
if (io.WantSaveIniSettings ) {
941
996
io.WantSaveIniSettings = false ;
942
997
saveCfg ();
@@ -2362,7 +2417,7 @@ bool PCSX::GUI::about() {
2362
2417
if (ImGui::BeginTabItem (_ (" Licenses" ))) {
2363
2418
ImGui::BeginChild (" Licenses" , ImVec2 (0 , 0 ), true );
2364
2419
2365
- static MarkDown md ({{" AUTHORS" , [this ]() { m_aboutSelectAuthors = true ; }}});
2420
+ MarkDown md (this , {{" AUTHORS" , [this ]() { m_aboutSelectAuthors = true ; }}});
2366
2421
std::string_view text =
2367
2422
#include " LICENSES.md"
2368
2423
;
0 commit comments