Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fixes for latest imgui, suppress some warnings about unused parameters #206

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixes to build on latest imgui, disabled a bunch of warnings
  • Loading branch information
azonenberg committed Oct 22, 2022
commit 4eda0efbacdc8ffa2732dbbcfbff8ecee4f8dd53
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
//
@@ -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
//
@@ -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
//
@@ -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
//
@@ -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;

@@ -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;

@@ -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;
@@ -5807,3 +5773,7 @@ void ed::Config::EndSave()
if (EndSaveSession)
EndSaveSession(UserPointer);
}

#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif