@@ -33,6 +33,7 @@ void OFS_ChapterManager::ShowWindow(bool* open) noexcept
33
33
ImGui::TableSetupColumn (" ##controls" , ImGuiTableColumnFlags_WidthFixed);
34
34
ImGui::TableHeadersRow ();
35
35
36
+ bool chapterStateChange = false ;
36
37
int deleteIdx = -1 ;
37
38
char timeBuf[16 ];
38
39
for (int i=0 , size=chapterState.chapters .size (); i < size; i += 1 )
@@ -44,7 +45,7 @@ void OFS_ChapterManager::ShowWindow(bool* open) noexcept
44
45
ImGui::TableSetColumnIndex (0 );
45
46
ImGui::ColorEdit3 (" ##chapterColorPicker" , &chapter.color .Value .x , ImGuiColorEditFlags_NoInputs);
46
47
ImGui::SameLine ();
47
- ImGui::InputText (" ##chapterName" , &chapter.name );
48
+ chapterStateChange |= ImGui::InputText (" ##chapterName" , &chapter.name );
48
49
ImGui::TableNextColumn ();
49
50
50
51
Util::FormatTime (timeBuf, sizeof (timeBuf), chapter.startTime , true );
@@ -58,6 +59,7 @@ void OFS_ChapterManager::ShowWindow(bool* open) noexcept
58
59
if (ImGui::Button (TR (DELETE)))
59
60
{
60
61
deleteIdx = i;
62
+ chapterStateChange = true ;
61
63
}
62
64
ImGui::PopID ();
63
65
}
@@ -66,8 +68,10 @@ void OFS_ChapterManager::ShowWindow(bool* open) noexcept
66
68
{
67
69
auto it = chapterState.chapters .begin () + deleteIdx;
68
70
chapterState.chapters .erase (it);
69
- EV::Enqueue <ChapterStateChanged>();
70
71
}
72
+
73
+ if (chapterStateChange)
74
+ EV::Enqueue <ChapterStateChanged>();
71
75
72
76
ImGui::EndTable ();
73
77
}
0 commit comments