Skip to content

Commit

Permalink
Fixes to build on latest imgui, disabled a bunch of warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
azonenberg committed Oct 22, 2022
1 parent 2f99b2d commit 4eda0ef
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 45 deletions.
16 changes: 15 additions & 1 deletion crude_json.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
// Crude implementation of JSON value object and parser.
//Disable a bunch of warnings for now
#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcomment"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif

// Crude implementation of JSON value object and parser.
//
// VERSION 0.1
//
Expand Down Expand Up @@ -888,3 +897,8 @@ bool value::save(const string& path, const int indent, const char indent_char) c
# endif

} // namespace crude_json

//Disable a bunch of warnings for now
#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif
15 changes: 13 additions & 2 deletions crude_json.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
// Crude implementation of JSON value object and parser.
//Disable a bunch of warnings for now
#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif

// Crude implementation of JSON value object and parser.
//
// VERSION 0.1
//
Expand Down Expand Up @@ -247,4 +253,9 @@ template <> inline number* value::get_ptr<number>() { if (m_Type =

} // namespace crude_json

# endif // __CRUDE_JSON_H__
# endif // __CRUDE_JSON_H__

//Disable a bunch of warnings for now
#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif
13 changes: 13 additions & 0 deletions imgui_bezier_math.inl
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
//Disable a bunch of warnings for now
#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcomment"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif

//------------------------------------------------------------------------------
// VERSION 0.1
//
Expand Down Expand Up @@ -673,3 +682,7 @@ inline void ImCubicBezierFixedStep(F& callback, const ImCubicBezierPoints& curve

//------------------------------------------------------------------------------
# endif // __IMGUI_BEZIER_MATH_INL__

#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif
54 changes: 12 additions & 42 deletions imgui_node_editor.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//Disable a bunch of warnings for now
#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif

//------------------------------------------------------------------------------
// VERSION 0.9.1
//
Expand Down Expand Up @@ -35,46 +41,6 @@
static bool const value = sizeof(test<T>(0)) == sizeof(yes); \
};


namespace ax {
namespace NodeEditor {
namespace Detail {

# define DECLARE_KEY_TESTER(Key) \
DECLARE_HAS_NESTED(Key, Key) \
struct KeyTester_ ## Key \
{ \
template <typename T> \
static int Get(typename std::enable_if<has_nested_ ## Key<ImGuiKey_>::value, T>::type*) \
{ \
return ImGui::GetKeyIndex(T::Key); \
} \
\
template <typename T> \
static int Get(typename std::enable_if<!has_nested_ ## Key<ImGuiKey_>::value, T>::type*) \
{ \
return -1; \
} \
}

DECLARE_KEY_TESTER(ImGuiKey_F);
DECLARE_KEY_TESTER(ImGuiKey_D);

static inline int GetKeyIndexForF()
{
return KeyTester_ImGuiKey_F::Get<ImGuiKey_>(nullptr);
}

static inline int GetKeyIndexForD()
{
return KeyTester_ImGuiKey_D::Get<ImGuiKey_>(nullptr);
}

} // namespace Detail
} // namespace NodeEditor
} // namespace ax


//------------------------------------------------------------------------------
namespace ed = ax::NodeEditor::Detail;

Expand Down Expand Up @@ -3314,7 +3280,7 @@ ed::EditorAction::AcceptResult ed::NavigateAction::Accept(const Control& control

auto& io = ImGui::GetIO();

if (Editor->CanAcceptUserInput() && ImGui::IsKeyPressed(GetKeyIndexForF()) && Editor->AreShortcutsEnabled())
if (Editor->CanAcceptUserInput() && ImGui::IsKeyPressed(ImGuiKey_F) && Editor->AreShortcutsEnabled())
{
const auto zoomMode = io.KeyShift ? NavigateAction::ZoomMode::WithMargin : NavigateAction::ZoomMode::None;

Expand Down Expand Up @@ -4353,7 +4319,7 @@ ed::EditorAction::AcceptResult ed::ShortcutAction::Accept(const Control& control
candidateAction = Copy;
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_V)))
candidateAction = Paste;
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(GetKeyIndexForD()))
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_D)))
candidateAction = Duplicate;
if (!io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Space)))
candidateAction = CreateNode;
Expand Down Expand Up @@ -5807,3 +5773,7 @@ void ed::Config::EndSave()
if (EndSaveSession)
EndSaveSession(UserPointer);
}

#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif

0 comments on commit 4eda0ef

Please sign in to comment.