Skip to content

Commit

Permalink
Fix Undo/Redo buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
ForserX committed Mar 4, 2025
1 parent e2c6f2d commit 065fd1f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
19 changes: 2 additions & 17 deletions src/Editors/LevelEditor/UI/UITopBarForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ UITopBarForm::~UITopBarForm() {}
} \
ImGui::SameLine()

#define IMGUI_HINT_BUTTON_EX(Name, Ptr, Timer, Hint, Callback) \
Ptr->Load(); \
if (ImGui::ImageButton("##" Name, Ptr->pSurface, ImVec2(20, 20), ImVec2(Timer > EDevice->TimerAsync() ? 0.5 : 0, 0), ImVec2(m_timeUndo > EDevice->TimerAsync() ? 1 : 0.5, 1))) \
{ \
Callback(); \
Timer = EDevice->TimerAsync() + 130;\
} \
if (ImGui::IsItemHovered()) \
{ \
ImGui::SetMouseCursor(ImGuiMouseCursor_Hand); \
ImGui::SetTooltip(Hint); \
} \
ImGui::SameLine()

void UITopBarForm::Draw()
{
ImGuiViewport* viewport = ImGui::GetMainViewport();
Expand Down Expand Up @@ -94,11 +80,10 @@ void UITopBarForm::Draw()

if (ImGui::TableNextColumn())
{
IMGUI_HINT_BUTTON_EX("Undo", m_tUndo, m_timeUndo, "Undo the last action", ClickUndo);
IMGUI_HINT_BUTTON_EX("Redo", m_tRedo, m_timeRedo, "Repeat the last action", ClickRedo);
IMGUI_HINT_BUTTON("Undo", m_tUndo, "Undo last action", ClickUndo);
IMGUI_HINT_BUTTON("Redo", m_tRedo, "Repeat last action", ClickRedo);
}


if (ImGui::TableNextColumn())
{
IMGUI_HINT_BUTTON("New", m_tNew, "Clear/New Scene", ClickNew);
Expand Down
4 changes: 2 additions & 2 deletions src/Editors/LevelEditor/UI/UITopBarForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class UITopBarForm :public IEditorWnd
bool UseCameraPosForActor = false;
private:

void ClickUndo(); ref_texture m_tUndo; u32 m_timeUndo;
void ClickRedo(); ref_texture m_tRedo; u32 m_timeRedo;
void ClickUndo(); ref_texture m_tUndo;
void ClickRedo(); ref_texture m_tRedo;

void ClickNew(); ref_texture m_tNew;
void ClickOpen(); ref_texture m_tOpen;
Expand Down

0 comments on commit 065fd1f

Please sign in to comment.