Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit 836380a

Browse files
add chapter change event
1 parent 888566c commit 836380a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/UI/OFS_ChapterManager.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ void OFS_ChapterManager::ShowWindow(bool* open) noexcept
3333
ImGui::TableSetupColumn("##controls", ImGuiTableColumnFlags_WidthFixed);
3434
ImGui::TableHeadersRow();
3535

36+
bool chapterStateChange = false;
3637
int deleteIdx = -1;
3738
char timeBuf[16];
3839
for(int i=0, size=chapterState.chapters.size(); i < size; i += 1)
@@ -44,7 +45,7 @@ void OFS_ChapterManager::ShowWindow(bool* open) noexcept
4445
ImGui::TableSetColumnIndex(0);
4546
ImGui::ColorEdit3("##chapterColorPicker", &chapter.color.Value.x, ImGuiColorEditFlags_NoInputs);
4647
ImGui::SameLine();
47-
ImGui::InputText("##chapterName", &chapter.name);
48+
chapterStateChange |= ImGui::InputText("##chapterName", &chapter.name);
4849
ImGui::TableNextColumn();
4950

5051
Util::FormatTime(timeBuf, sizeof(timeBuf), chapter.startTime, true);
@@ -58,6 +59,7 @@ void OFS_ChapterManager::ShowWindow(bool* open) noexcept
5859
if (ImGui::Button(TR(DELETE)))
5960
{
6061
deleteIdx = i;
62+
chapterStateChange = true;
6163
}
6264
ImGui::PopID();
6365
}
@@ -66,8 +68,10 @@ void OFS_ChapterManager::ShowWindow(bool* open) noexcept
6668
{
6769
auto it = chapterState.chapters.begin() + deleteIdx;
6870
chapterState.chapters.erase(it);
69-
EV::Enqueue<ChapterStateChanged>();
7071
}
72+
73+
if(chapterStateChange)
74+
EV::Enqueue<ChapterStateChanged>();
7175

7276
ImGui::EndTable();
7377
}

0 commit comments

Comments
 (0)