Skip to content

Commit

Permalink
Merge remote-tracking branch 'Auburn/master' into zoom2
Browse files Browse the repository at this point in the history
  • Loading branch information
Auburn committed Mar 12, 2024
2 parents e026025 + 8563e16 commit a0e963e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 24 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ endif()

if(MSVC)
add_compile_definitions(SDL_MAIN_HANDLED)
add_compile_options(/W4 /WX)
add_compile_options(/WX)
# replace existing /W to avoid warning
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
add_compile_options(/W4)
endif()
else()
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()
Expand Down
5 changes: 2 additions & 3 deletions example/color_node_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ class ColorNodeEditor
// These are driven by the user, so we place this code before rendering the nodes
{
const bool open_popup = ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) &&
ImNodes::IsEditorHovered() &&
ImGui::IsKeyReleased(ImGuiKey_A);
ImNodes::IsEditorHovered() && ImGui::IsKeyReleased(ImGuiKey_A);

ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8.f, 8.f));
if (!ImGui::IsAnyItemHovered() && open_popup)
Expand Down Expand Up @@ -513,7 +512,7 @@ class ColorNodeEditor
const float label_width = ImGui::CalcTextSize("output").x;
ImGui::Indent(node_width - label_width);
ImGui::TextUnformatted("output");
ImNodes::EndInputAttribute();
ImNodes::EndOutputAttribute();
}

ImNodes::EndNode();
Expand Down
32 changes: 16 additions & 16 deletions imnodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@ static inline void CalcMiniMapLayout()
const ImVec2 grid_content_size = editor.GridContentBounds.IsInverted()
? max_size
: ImFloor(editor.GridContentBounds.GetSize());
const float grid_content_aspect_ratio = grid_content_size.x / grid_content_size.y;
const float grid_content_aspect_ratio = grid_content_size.x / grid_content_size.y;
mini_map_size = ImFloor(
grid_content_aspect_ratio > max_size_aspect_ratio
? ImVec2(max_size.x, max_size.x / grid_content_aspect_ratio)
Expand Down Expand Up @@ -2766,35 +2766,35 @@ struct ImNodesStyleVarInfo

static const ImNodesStyleVarInfo GStyleVarInfo[] = {
// ImNodesStyleVar_GridSpacing
{ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, GridSpacing)},
{ImGuiDataType_Float, 1, (ImU32)offsetof(ImNodesStyle, GridSpacing)},
// ImNodesStyleVar_NodeCornerRounding
{ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, NodeCornerRounding)},
{ImGuiDataType_Float, 1, (ImU32)offsetof(ImNodesStyle, NodeCornerRounding)},
// ImNodesStyleVar_NodePadding
{ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImNodesStyle, NodePadding)},
{ImGuiDataType_Float, 2, (ImU32)offsetof(ImNodesStyle, NodePadding)},
// ImNodesStyleVar_NodeBorderThickness
{ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, NodeBorderThickness)},
{ImGuiDataType_Float, 1, (ImU32)offsetof(ImNodesStyle, NodeBorderThickness)},
// ImNodesStyleVar_LinkThickness
{ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, LinkThickness)},
{ImGuiDataType_Float, 1, (ImU32)offsetof(ImNodesStyle, LinkThickness)},
// ImNodesStyleVar_LinkLineSegmentsPerLength
{ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, LinkLineSegmentsPerLength)},
{ImGuiDataType_Float, 1, (ImU32)offsetof(ImNodesStyle, LinkLineSegmentsPerLength)},
// ImNodesStyleVar_LinkHoverDistance
{ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, LinkHoverDistance)},
{ImGuiDataType_Float, 1, (ImU32)offsetof(ImNodesStyle, LinkHoverDistance)},
// ImNodesStyleVar_PinCircleRadius
{ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, PinCircleRadius)},
{ImGuiDataType_Float, 1, (ImU32)offsetof(ImNodesStyle, PinCircleRadius)},
// ImNodesStyleVar_PinQuadSideLength
{ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, PinQuadSideLength)},
{ImGuiDataType_Float, 1, (ImU32)offsetof(ImNodesStyle, PinQuadSideLength)},
// ImNodesStyleVar_PinTriangleSideLength
{ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, PinTriangleSideLength)},
{ImGuiDataType_Float, 1, (ImU32)offsetof(ImNodesStyle, PinTriangleSideLength)},
// ImNodesStyleVar_PinLineThickness
{ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, PinLineThickness)},
{ImGuiDataType_Float, 1, (ImU32)offsetof(ImNodesStyle, PinLineThickness)},
// ImNodesStyleVar_PinHoverRadius
{ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, PinHoverRadius)},
{ImGuiDataType_Float, 1, (ImU32)offsetof(ImNodesStyle, PinHoverRadius)},
// ImNodesStyleVar_PinOffset
{ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImNodesStyle, PinOffset)},
{ImGuiDataType_Float, 1, (ImU32)offsetof(ImNodesStyle, PinOffset)},
// ImNodesStyleVar_MiniMapPadding
{ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImNodesStyle, MiniMapPadding)},
{ImGuiDataType_Float, 2, (ImU32)offsetof(ImNodesStyle, MiniMapPadding)},
// ImNodesStyleVar_MiniMapOffset
{ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImNodesStyle, MiniMapOffset)},
{ImGuiDataType_Float, 2, (ImU32)offsetof(ImNodesStyle, MiniMapOffset)},
};

static const ImNodesStyleVarInfo* GetStyleVarInfo(ImNodesStyleVar idx)
Expand Down
9 changes: 5 additions & 4 deletions imnodes_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,11 @@ struct ImNodesEditorContext

ImNodesEditorContext()
: Nodes(), Pins(), Links(), ZoomScale(1.f), Panning(0.f, 0.f), SelectedNodeIndices(),
SelectedLinkIndices(), SelectedNodeOffsets(), PrimaryNodeOffset(0.f, 0.f),
ClickInteraction(), MiniMapEnabled(false), MiniMapSizeFraction(0.0f),
MiniMapNodeHoveringCallback(NULL), MiniMapNodeHoveringCallbackUserData(NULL),
MiniMapScaling(0.0f) {}
SelectedLinkIndices(), SelectedNodeOffsets(), PrimaryNodeOffset(0.f, 0.f), ClickInteraction(),
MiniMapEnabled(false), MiniMapSizeFraction(0.0f), MiniMapNodeHoveringCallback(NULL),
MiniMapNodeHoveringCallbackUserData(NULL), MiniMapScaling(0.0f)
{
}
};

struct ImNodesContext
Expand Down

0 comments on commit a0e963e

Please sign in to comment.