Make sure a imgui.ini is never created
This commit is contained in:
parent
1dec163012
commit
6fc469123f
2 changed files with 54 additions and 42 deletions
|
|
@ -187,7 +187,13 @@ void ImGuiTextEditor::drawImGui()
|
||||||
ImGui::SetNextWindowPos(ImVec2(0, 0));
|
ImGui::SetNextWindowPos(ImVec2(0, 0));
|
||||||
ImGui::SetNextWindowSize(ImVec2(box.size.x * scaleFactor, box.size.y * scaleFactor));
|
ImGui::SetNextWindowSize(ImVec2(box.size.x * scaleFactor, box.size.y * scaleFactor));
|
||||||
|
|
||||||
if (ImGui::Begin("TextEdit", nullptr, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize))
|
const int pflags = ImGuiWindowFlags_NoSavedSettings
|
||||||
|
| ImGuiWindowFlags_NoCollapse
|
||||||
|
| ImGuiWindowFlags_NoResize
|
||||||
|
| ImGuiWindowFlags_NoTitleBar
|
||||||
|
| ImGuiWindowFlags_AlwaysAutoResize;
|
||||||
|
|
||||||
|
if (ImGui::Begin("TextEdit", nullptr, pflags))
|
||||||
{
|
{
|
||||||
TextEditor& editor(pData->editor);
|
TextEditor& editor(pData->editor);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,33 +24,22 @@
|
||||||
|
|
||||||
#include "DearImGui/imgui_impl_opengl2.h"
|
#include "DearImGui/imgui_impl_opengl2.h"
|
||||||
|
|
||||||
struct ImGuiWidget::PrivateData {
|
static const char* GetClipboardTextFn(void*)
|
||||||
ImGuiContext* context = nullptr;
|
{
|
||||||
bool created = false;
|
|
||||||
bool fontGenerated = false;
|
|
||||||
bool useMonospacedFont = false;
|
|
||||||
float originalScaleFactor = 0.0f;
|
|
||||||
float scaleFactor = 0.0f;
|
|
||||||
|
|
||||||
static const char* GetClipboardTextFn(void*)
|
|
||||||
{
|
|
||||||
return glfwGetClipboardString(nullptr);
|
return glfwGetClipboardString(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetClipboardTextFn(void*, const char* const text)
|
static void SetClipboardTextFn(void*, const char* const text)
|
||||||
{
|
{
|
||||||
glfwSetClipboardString(nullptr, text);
|
glfwSetClipboardString(nullptr, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrivateData()
|
|
||||||
{
|
|
||||||
IMGUI_CHECKVERSION();
|
|
||||||
context = ImGui::CreateContext();
|
|
||||||
ImGui::SetCurrentContext(context);
|
|
||||||
|
|
||||||
|
static void setupIO()
|
||||||
|
{
|
||||||
ImGuiIO& io(ImGui::GetIO());
|
ImGuiIO& io(ImGui::GetIO());
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
|
||||||
io.IniFilename = nullptr;
|
io.IniFilename = nullptr;
|
||||||
|
io.LogFilename = nullptr;
|
||||||
|
|
||||||
io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB;
|
io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB;
|
||||||
io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT;
|
io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT;
|
||||||
|
|
@ -77,7 +66,22 @@ struct ImGuiWidget::PrivateData {
|
||||||
|
|
||||||
io.GetClipboardTextFn = GetClipboardTextFn;
|
io.GetClipboardTextFn = GetClipboardTextFn;
|
||||||
io.SetClipboardTextFn = SetClipboardTextFn;
|
io.SetClipboardTextFn = SetClipboardTextFn;
|
||||||
io.ClipboardUserData = this;
|
}
|
||||||
|
|
||||||
|
struct ImGuiWidget::PrivateData {
|
||||||
|
ImGuiContext* context = nullptr;
|
||||||
|
bool created = false;
|
||||||
|
bool fontGenerated = false;
|
||||||
|
bool useMonospacedFont = false;
|
||||||
|
float originalScaleFactor = 0.0f;
|
||||||
|
float scaleFactor = 0.0f;
|
||||||
|
|
||||||
|
PrivateData()
|
||||||
|
{
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
|
context = ImGui::CreateContext();
|
||||||
|
ImGui::SetCurrentContext(context);
|
||||||
|
setupIO();
|
||||||
}
|
}
|
||||||
|
|
||||||
~PrivateData()
|
~PrivateData()
|
||||||
|
|
@ -368,6 +372,8 @@ void ImGuiWidget::drawFramebufferForBrowserPreview()
|
||||||
|
|
||||||
imData->context = ImGui::CreateContext();
|
imData->context = ImGui::CreateContext();
|
||||||
ImGui::SetCurrentContext(imData->context);
|
ImGui::SetCurrentContext(imData->context);
|
||||||
|
setupIO();
|
||||||
|
|
||||||
ImGui_ImplOpenGL2_Init();
|
ImGui_ImplOpenGL2_Init();
|
||||||
imData->created = true;
|
imData->created = true;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue