2022-08-31 06:58:03 +02:00
|
|
|
#include "pch.h"
|
|
|
|
#include "font_selection.h"
|
|
|
|
|
|
|
|
#include "options.h"
|
2022-08-31 14:18:22 +02:00
|
|
|
#include "pb.h"
|
2022-08-31 06:58:03 +02:00
|
|
|
#include "score.h"
|
|
|
|
#include "winmain.h"
|
2022-08-31 10:11:21 +02:00
|
|
|
#include "translations.h"
|
2022-08-31 06:58:03 +02:00
|
|
|
|
|
|
|
static const char* popupName = "Font Selection";
|
|
|
|
bool font_selection::ShowDialogFlag = false;
|
|
|
|
char font_selection::DialogInputBuffer[512];
|
|
|
|
|
|
|
|
void font_selection::ShowDialog()
|
|
|
|
{
|
|
|
|
ShowDialogFlag = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void font_selection::RenderDialog()
|
|
|
|
{
|
|
|
|
if (ShowDialogFlag == true)
|
|
|
|
{
|
2023-01-03 14:42:34 +01:00
|
|
|
strncpy(DialogInputBuffer, options::Options.FontFileName.V.c_str(), sizeof(DialogInputBuffer));
|
2022-08-31 06:58:03 +02:00
|
|
|
ShowDialogFlag = false;
|
|
|
|
if (!ImGui::IsPopupOpen(popupName))
|
|
|
|
{
|
|
|
|
ImGui::OpenPopup(popupName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool unused_open = true;
|
|
|
|
if (ImGui::BeginPopupModal(popupName, &unused_open, ImGuiWindowFlags_AlwaysAutoResize))
|
|
|
|
{
|
|
|
|
ImGui::Text("Font file to use: ");
|
|
|
|
ImGui::SameLine();
|
2022-12-11 05:57:49 +01:00
|
|
|
ImGui::InputText("##Font", DialogInputBuffer, IM_ARRAYSIZE(DialogInputBuffer));
|
2022-08-31 06:58:03 +02:00
|
|
|
|
2023-02-12 06:43:08 +01:00
|
|
|
if (ImGui::Button(pb::get_rc_string(Msg::GenericOk)))
|
2022-08-31 06:58:03 +02:00
|
|
|
{
|
2023-01-03 14:42:34 +01:00
|
|
|
options::Options.FontFileName.V = DialogInputBuffer;
|
2022-08-31 06:58:03 +02:00
|
|
|
ImGui::CloseCurrentPopup();
|
|
|
|
winmain::Restart();
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
2023-02-12 06:43:08 +01:00
|
|
|
if (ImGui::Button(pb::get_rc_string(Msg::GenericCancel)))
|
2022-08-31 06:58:03 +02:00
|
|
|
ImGui::CloseCurrentPopup();
|
|
|
|
|
|
|
|
ImGui::EndPopup();
|
|
|
|
}
|
|
|
|
}
|