INSTINCT Code Coverage Report


Directory: src/
File: internal/gui/menus/FileMenu.cpp
Date: 2025-02-07 16:54:41
Exec Total Coverage
Lines: 0 25 0.0%
Functions: 0 1 0.0%
Branches: 0 18 0.0%

Line Branch Exec Source
1 // This file is part of INSTINCT, the INS Toolkit for Integrated
2 // Navigation Concepts and Training by the Institute of Navigation of
3 // the University of Stuttgart, Germany.
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9 #include "FileMenu.hpp"
10
11 #include <imgui.h>
12 #include <imgui_node_editor.h>
13
14 #include "internal/NodeManager.hpp"
15 namespace nm = NAV::NodeManager;
16
17 #include "internal/FlowManager.hpp"
18
19 #include <iostream>
20
21 void NAV::gui::menus::ShowFileMenu(GlobalActions& globalAction)
22 {
23 if (ImGui::MenuItem("New Flow", "Ctrl+N"))
24 {
25 if (flow::HasUnsavedChanges())
26 {
27 globalAction = GlobalActions::Clear;
28 }
29 else
30 {
31 nm::DeleteAllNodes();
32 flow::DiscardChanges();
33 flow::SetCurrentFilename("");
34 }
35 }
36 if (ImGui::MenuItem("Open Flow", "Ctrl+O"))
37 {
38 globalAction = GlobalActions::Load;
39 }
40 if (ImGui::BeginMenu("Open Recent", false))
41 {
42 ImGui::MenuItem("fish_hat.c");
43 ImGui::MenuItem("fish_hat.inl");
44 ImGui::MenuItem("fish_hat.h");
45 ImGui::MenuItem("fish_hat.h");
46 // ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5);
47 ImGui::Separator();
48 ImGui::MenuItem("More...");
49 ImGui::EndMenu();
50 }
51 if (ImGui::MenuItem("Save", "Ctrl+S"))
52 {
53 flow::SaveFlow(globalAction);
54 }
55 if (ImGui::MenuItem("Save As..", "Ctrl+Shift+S"))
56 {
57 globalAction = GlobalActions::SaveAs;
58 }
59
60 ImGui::Separator();
61
62 if (ImGui::MenuItem("Quit", "Ctrl+Q"))
63 {
64 globalAction = GlobalActions::Quit;
65 }
66 }
67