quick undo change
This commit is contained in:
@@ -557,7 +557,6 @@ static void _imgui_context_menu(Imgui* self)
|
|||||||
{
|
{
|
||||||
if (!self->isContextualActionsEnabled) return;
|
if (!self->isContextualActionsEnabled) return;
|
||||||
|
|
||||||
|
|
||||||
if (_imgui_is_window_hovered() && ImGui::IsMouseClicked(ImGuiMouseButton_Right))
|
if (_imgui_is_window_hovered() && ImGui::IsMouseClicked(ImGuiMouseButton_Right))
|
||||||
imgui_open_popup(IMGUI_CONTEXT_MENU.label_get());
|
imgui_open_popup(IMGUI_CONTEXT_MENU.label_get());
|
||||||
|
|
||||||
@@ -2548,6 +2547,7 @@ void imgui_update(Imgui* self)
|
|||||||
{
|
{
|
||||||
if (ImGui::IsKeyChordPressed(hotkey.chord))
|
if (ImGui::IsKeyChordPressed(hotkey.chord))
|
||||||
{
|
{
|
||||||
|
if (hotkey.is_undoable()) imgui_undo_push(self, hotkey.undoAction);
|
||||||
if (hotkey.is_focus_window()) continue;
|
if (hotkey.is_focus_window()) continue;
|
||||||
hotkey.function(self);
|
hotkey.function(self);
|
||||||
}
|
}
|
||||||
|
@@ -197,8 +197,10 @@ struct ImguiHotkey
|
|||||||
ImGuiKeyChord chord;
|
ImGuiKeyChord chord;
|
||||||
ImguiFunction function;
|
ImguiFunction function;
|
||||||
std::string focusWindow{};
|
std::string focusWindow{};
|
||||||
|
std::string undoAction{};
|
||||||
|
|
||||||
bool is_focus_window() const { return !focusWindow.empty(); }
|
bool is_focus_window() const { return !focusWindow.empty(); }
|
||||||
|
bool is_undoable() const { return !undoAction.empty(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void imgui_log_push(Imgui* self, const std::string& text)
|
static void imgui_log_push(Imgui* self, const std::string& text)
|
||||||
@@ -423,8 +425,6 @@ static inline void imgui_end_popup(Imgui* imgui)
|
|||||||
imgui_pending_popup_process(imgui);
|
imgui_pending_popup_process(imgui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enum ImguiItemType
|
enum ImguiItemType
|
||||||
{
|
{
|
||||||
IMGUI_ITEM,
|
IMGUI_ITEM,
|
||||||
@@ -504,7 +504,6 @@ struct ImguiItem
|
|||||||
s32 windowFlags{};
|
s32 windowFlags{};
|
||||||
s32 rowCount = 0;
|
s32 rowCount = 0;
|
||||||
|
|
||||||
|
|
||||||
void construct()
|
void construct()
|
||||||
{
|
{
|
||||||
static s32 idNew = 0;
|
static s32 idNew = 0;
|
||||||
@@ -517,7 +516,7 @@ struct ImguiItem
|
|||||||
label += std::format(IMGUI_LABEL_SHORTCUT_FORMAT, chordString);
|
label += std::format(IMGUI_LABEL_SHORTCUT_FORMAT, chordString);
|
||||||
tooltip += std::format(IMGUI_TOOLTIP_SHORTCUT_FORMAT, chordString);
|
tooltip += std::format(IMGUI_TOOLTIP_SHORTCUT_FORMAT, chordString);
|
||||||
if (function)
|
if (function)
|
||||||
imgui_hotkey_registry().push_back({chord, function, focusWindow});
|
imgui_hotkey_registry().push_back({chord, function, focusWindow, undoAction});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string labelNew{};
|
std::string labelNew{};
|
||||||
|
Reference in New Issue
Block a user