Skip to content

Commit

Permalink
Fixed the misscomunication between RawText and TimingEditor.
Browse files Browse the repository at this point in the history
Fixed the browser window name being displayed incorrectly.
  • Loading branch information
98ahni committed May 22, 2024
1 parent c89159f commit 36f46c4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Source/Serialization/KaraokeData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions Source/Serialization/KaraokeData.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
25 changes: 11 additions & 14 deletions Source/Windows/RawText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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();
}
1 change: 0 additions & 1 deletion Source/Windows/TimingEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ TimingEditor::TimingEditor()
myMarkHasMoved = false;
myInputIsUnsafe = false;
myDisableInput = false;
SetInputUnsafe(false);
}

void TimingEditor::OnImGuiDraw()
Expand Down
2 changes: 1 addition & 1 deletion Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down
Binary file modified bin/public/Resonate.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion bin/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 36f46c4

Please sign in to comment.