@@ -40,46 +40,10 @@ namespace ax {
4040namespace NodeEditor {
4141namespace Detail {
4242
43- # if !defined(IMGUI_VERSION_NUM) || (IMGUI_VERSION_NUM < 18822)
44- # define DECLARE_KEY_TESTER (Key ) \
45- DECLARE_HAS_NESTED (Key, Key) \
46- struct KeyTester_ ## Key \
47- { \
48- template <typename T> \
49- static int Get (typename std::enable_if<has_nested_ ## Key<ImGuiKey_>::value, T>::type*) \
50- { \
51- return ImGui::GetKeyIndex (T::Key); \
52- } \
53- \
54- template <typename T> \
55- static int Get (typename std::enable_if<!has_nested_ ## Key<ImGuiKey_>::value, T>::type*) \
56- { \
57- return -1 ; \
58- } \
59- }
60-
61- DECLARE_KEY_TESTER (ImGuiKey_F);
62- DECLARE_KEY_TESTER (ImGuiKey_D);
63-
64- static inline int GetKeyIndexForF ()
65- {
66- return KeyTester_ImGuiKey_F::Get<ImGuiKey_>(nullptr );
67- }
68-
69- static inline int GetKeyIndexForD ()
70- {
71- return KeyTester_ImGuiKey_D::Get<ImGuiKey_>(nullptr );
72- }
73- # else
74- static inline ImGuiKey GetKeyIndexForF ()
75- {
76- return ImGuiKey_F;
77- }
78-
79- static inline ImGuiKey GetKeyIndexForD ()
80- {
81- return ImGuiKey_D;
82- }
43+ # if !defined(IMGUI_VERSION_NUM)
44+ # error IMGUI_VERSION_NUM is not defined, please update Dear ImGui copy to at least 1.89 (August 2022)
45+ # elif IMGUI_VERSION_NUM < 18900
46+ # error Please update Dear ImGui copy to at least 1.89 (August 2022)
8347# endif
8448
8549} // namespace Detail
@@ -129,11 +93,7 @@ static const float c_SelectionFadeOutDuration = 0.15f; // seconds
12993static const auto c_MaxMoveOverEdgeSpeed = 10 .0f ;
13094static const auto c_MaxMoveOverEdgeDistance = 300 .0f ;
13195
132- #if IMGUI_VERSION_NUM > 18101
13396static const auto c_AllRoundCornersFlags = ImDrawFlags_RoundCornersAll;
134- #else
135- static const auto c_AllRoundCornersFlags = 15 ;
136- #endif
13797
13898
13999// ------------------------------------------------------------------------------
@@ -2565,7 +2525,7 @@ ed::Control ed::EditorContext::BuildControl(bool allowOffscreen)
25652525# if IMGUI_VERSION_NUM >= 18836
25662526 if (m_IsHoveredWithoutOverlapp)
25672527 ImGui::SetItemKeyOwner (ImGuiKey_MouseWheelY);
2568- # elif IMGUI_VERSION_NUM >= 17909
2528+ # else
25692529 if (m_IsHoveredWithoutOverlapp)
25702530 ImGui::SetItemUsingMouseWheel ();
25712531# endif
@@ -3333,7 +3293,7 @@ ed::EditorAction::AcceptResult ed::NavigateAction::Accept(const Control& control
33333293
33343294 auto & io = ImGui::GetIO ();
33353295
3336- if (Editor->CanAcceptUserInput () && ImGui::IsKeyPressed (GetKeyIndexForF () ) && Editor->AreShortcutsEnabled ())
3296+ if (Editor->CanAcceptUserInput () && ImGui::IsKeyPressed (ImGuiKey_F ) && Editor->AreShortcutsEnabled ())
33373297 {
33383298 const auto zoomMode = io.KeyShift ? NavigateAction::ZoomMode::WithMargin : NavigateAction::ZoomMode::None;
33393299
@@ -4391,15 +4351,15 @@ ed::EditorAction::AcceptResult ed::ShortcutAction::Accept(const Control& control
43914351 Action candidateAction = None;
43924352
43934353 auto & io = ImGui::GetIO ();
4394- if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed (ImGui::GetKeyIndex ( ImGuiKey_X) ))
4354+ if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed (ImGuiKey_X))
43954355 candidateAction = Cut;
4396- if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed (ImGui::GetKeyIndex ( ImGuiKey_C) ))
4356+ if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed (ImGuiKey_C))
43974357 candidateAction = Copy;
4398- if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed (ImGui::GetKeyIndex ( ImGuiKey_V) ))
4358+ if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed (ImGuiKey_V))
43994359 candidateAction = Paste;
4400- if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed (GetKeyIndexForD () ))
4360+ if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed (ImGuiKey_D ))
44014361 candidateAction = Duplicate;
4402- if (!io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed (ImGui::GetKeyIndex ( ImGuiKey_Space) ))
4362+ if (!io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed (ImGuiKey_Space))
44034363 candidateAction = CreateNode;
44044364
44054365 if (candidateAction != None)
@@ -4953,7 +4913,7 @@ ed::EditorAction::AcceptResult ed::DeleteItemsAction::Accept(const Control& cont
49534913 return False;
49544914
49554915 auto & io = ImGui::GetIO ();
4956- if (Editor->CanAcceptUserInput () && ImGui::IsKeyPressed (ImGui::GetKeyIndex ( ImGuiKey_Delete) ) && Editor->AreShortcutsEnabled ())
4916+ if (Editor->CanAcceptUserInput () && ImGui::IsKeyPressed (ImGuiKey_Delete) && Editor->AreShortcutsEnabled ())
49574917 {
49584918 auto & selection = Editor->GetSelectedObjects ();
49594919 if (!selection.empty ())
0 commit comments