@@ -40,46 +40,10 @@ namespace ax {
40
40
namespace NodeEditor {
41
41
namespace Detail {
42
42
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)
83
47
# endif
84
48
85
49
} // namespace Detail
@@ -129,11 +93,7 @@ static const float c_SelectionFadeOutDuration = 0.15f; // seconds
129
93
static const auto c_MaxMoveOverEdgeSpeed = 10 .0f ;
130
94
static const auto c_MaxMoveOverEdgeDistance = 300 .0f ;
131
95
132
- #if IMGUI_VERSION_NUM > 18101
133
96
static const auto c_AllRoundCornersFlags = ImDrawFlags_RoundCornersAll;
134
- #else
135
- static const auto c_AllRoundCornersFlags = 15 ;
136
- #endif
137
97
138
98
139
99
// ------------------------------------------------------------------------------
@@ -2565,7 +2525,7 @@ ed::Control ed::EditorContext::BuildControl(bool allowOffscreen)
2565
2525
# if IMGUI_VERSION_NUM >= 18836
2566
2526
if (m_IsHoveredWithoutOverlapp)
2567
2527
ImGui::SetItemKeyOwner (ImGuiKey_MouseWheelY);
2568
- # elif IMGUI_VERSION_NUM >= 17909
2528
+ # else
2569
2529
if (m_IsHoveredWithoutOverlapp)
2570
2530
ImGui::SetItemUsingMouseWheel ();
2571
2531
# endif
@@ -3333,7 +3293,7 @@ ed::EditorAction::AcceptResult ed::NavigateAction::Accept(const Control& control
3333
3293
3334
3294
auto & io = ImGui::GetIO ();
3335
3295
3336
- if (Editor->CanAcceptUserInput () && ImGui::IsKeyPressed (GetKeyIndexForF () ) && Editor->AreShortcutsEnabled ())
3296
+ if (Editor->CanAcceptUserInput () && ImGui::IsKeyPressed (ImGuiKey_F ) && Editor->AreShortcutsEnabled ())
3337
3297
{
3338
3298
const auto zoomMode = io.KeyShift ? NavigateAction::ZoomMode::WithMargin : NavigateAction::ZoomMode::None;
3339
3299
@@ -4391,15 +4351,15 @@ ed::EditorAction::AcceptResult ed::ShortcutAction::Accept(const Control& control
4391
4351
Action candidateAction = None;
4392
4352
4393
4353
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))
4395
4355
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))
4397
4357
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))
4399
4359
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 ))
4401
4361
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))
4403
4363
candidateAction = CreateNode;
4404
4364
4405
4365
if (candidateAction != None)
@@ -4953,7 +4913,7 @@ ed::EditorAction::AcceptResult ed::DeleteItemsAction::Accept(const Control& cont
4953
4913
return False;
4954
4914
4955
4915
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 ())
4957
4917
{
4958
4918
auto & selection = Editor->GetSelectedObjects ();
4959
4919
if (!selection.empty ())
0 commit comments