diff --git a/Source/Serialization/KaraokeData.cpp b/Source/Serialization/KaraokeData.cpp index d3f7ede..645a50d 100644 --- a/Source/Serialization/KaraokeData.cpp +++ b/Source/Serialization/KaraokeData.cpp @@ -257,6 +257,7 @@ namespace Serialization } Clear(); myPath = aPath; + myName = std::filesystem::path(myPath).filename().string(); std::ifstream docFile(aPath); std::string line; while(std::getline(docFile, line)) @@ -420,8 +421,7 @@ namespace Serialization // } std::string KaraokeDocument::GetName() { - auto pathName = std::filesystem::path(myPath); - return pathName.filename().string(); + return myName; } uint KaraokeDocument::StringToTime(std::string aTimeStr) { diff --git a/Source/Serialization/KaraokeData.h b/Source/Serialization/KaraokeData.h index 043ae26..2fbb93a 100644 --- a/Source/Serialization/KaraokeData.h +++ b/Source/Serialization/KaraokeData.h @@ -70,6 +70,7 @@ namespace Serialization static inline KaraokeLine ourNullLine = KaraokeLine(); KaraokeData myTokens; std::string myPath; + std::string myName; bool myIsDirty = false; bool myIsAutoDirty = false; // Set immediatly double myLastEditTime = 0; diff --git a/Source/Windows/RawText.cpp b/Source/Windows/RawText.cpp index 9e122f1..bb6866c 100644 --- a/Source/Windows/RawText.cpp +++ b/Source/Windows/RawText.cpp @@ -13,7 +13,7 @@ TextEditor::TextEditor() void TextEditor::OnImGuiDraw() { - if(ImGui::Begin(GetName().c_str(), 0, ImGuiWindowFlags_HorizontalScrollbar | Serialization::KaraokeDocument::Get().GetIsDirty() ? ImGuiWindowFlags_UnsavedDocument : 0)) + if(ImGui::Begin(GetName().c_str(), 0, ImGuiWindowFlags_HorizontalScrollbar | (Serialization::KaraokeDocument::Get().GetIsDirty() ? ImGuiWindowFlags_UnsavedDocument : 0))) { if(ImGui::InputTextMultiline("##RawText", &myRawText, ImGui::GetContentRegionAvail()) && myHasTakenFocus) { @@ -22,23 +22,20 @@ void TextEditor::OnImGuiDraw() } TouchInput_ReadyKeyboard(); - if(ImGui::IsItemHovered() || ImGui::IsWindowFocused()) + if(!myHasTakenFocus) { - if(!myHasTakenFocus) - { - myRawText = Serialization::KaraokeDocument::Get().Serialize(); - ((TimingEditor*)WindowManager::GetWindow("Timing"))->SetInputUnsafe(true); - } - myHasTakenFocus = true; + myRawText = Serialization::KaraokeDocument::Get().Serialize(); + ((TimingEditor*)WindowManager::GetWindow("Timing"))->SetInputUnsafe(true); } - else + myHasTakenFocus = true; + } + else + { + if(myHasTakenFocus) { - if(myHasTakenFocus) - { - ((TimingEditor*)WindowManager::GetWindow("Timing"))->SetInputUnsafe(false); - } - myHasTakenFocus = false; + ((TimingEditor*)WindowManager::GetWindow("Timing"))->SetInputUnsafe(false); } + myHasTakenFocus = false; } Gui_End(); } \ No newline at end of file diff --git a/Source/Windows/TimingEditor.cpp b/Source/Windows/TimingEditor.cpp index fe05ee2..fde5a83 100644 --- a/Source/Windows/TimingEditor.cpp +++ b/Source/Windows/TimingEditor.cpp @@ -11,7 +11,6 @@ TimingEditor::TimingEditor() myMarkHasMoved = false; myInputIsUnsafe = false; myDisableInput = false; - SetInputUnsafe(false); } void TimingEditor::OnImGuiDraw() diff --git a/Source/main.cpp b/Source/main.cpp index 4556987..d350048 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -47,7 +47,7 @@ extern "C" EMSCRIPTEN_KEEPALIVE void SaveProject() void loop(void* window){ MainWindow_NewFrame(window); Serialization::KaraokeDocument& doc = Serialization::KaraokeDocument::Get(); - MainWindow_SetName(doc.GetName().empty() ? (doc.GetIsDirty() ? "*" : "") + doc.GetName() + " - Resonate" : "Resonate"); + MainWindow_SetName(doc.GetName().empty() ? "Resonate" : (doc.GetIsDirty() ? "*" : "") + doc.GetName() + " - Resonate"); MainWindow_SetIcon(doc.GetIsDirty() ? "ResonateIconUnsaved.png" : "ResonateIcon.png"); if(doc.GetIsAutoDirty()) { diff --git a/bin/public/Resonate.wasm b/bin/public/Resonate.wasm index ea309de..e6d4021 100755 Binary files a/bin/public/Resonate.wasm and b/bin/public/Resonate.wasm differ diff --git a/bin/server.js b/bin/server.js index 6a38773..27e2fb1 100644 --- a/bin/server.js +++ b/bin/server.js @@ -7,7 +7,7 @@ var os = require('os'); // Skip compile steps: const REBUILD_Imgui = false; -const REBUILD_Source = true; +const REBUILD_Source = false; const SKIP_ImguiCompile = true; const SKIP_SourceCompile = false; const SKIP_Linking = false;