1
0
Fork 0
mirror of https://github.com/gwm17/Specter.git synced 2024-11-22 18:28:52 -05:00

Fixed some semantics to reduce warnings from strings in ImGui widgets. HistogramMap now has a nullResult member

This commit is contained in:
Gordon McCann 2022-02-03 16:18:24 -05:00
parent 8c6fce5220
commit ec401030e1
8 changed files with 27 additions and 27 deletions

View File

@ -165,23 +165,23 @@ namespace Navigator {
auto& params = gram.second->GetParameters();
if (ImGui::TreeNode(params.name.c_str()))
{
ImGui::BulletText(("X Parameter: "+params.x_par).c_str());
ImGui::BulletText("%s", ("X Parameter: "+params.x_par).c_str());
ImGui::BulletText("X Bins: %d X Min: %f X Max: %f", params.nbins_x, params.min_x, params.max_x);
if (params.y_par != "None")
{
ImGui::BulletText(("Y Parameter: "+params.y_par).c_str());
ImGui::BulletText("%s", ("Y Parameter: "+params.y_par).c_str());
ImGui::BulletText("Y Bins: %d Y Min: %f Y Max: %f", params.nbins_y, params.min_y, params.max_y);
}
if(params.cutsDrawnUpon.size() != 0 && ImGui::TreeNode("Cuts Drawn"))
{
for(auto& cut : params.cutsDrawnUpon)
ImGui::BulletText(cut.c_str());
ImGui::BulletText("%s", cut.c_str());
ImGui::TreePop();
}
if(params.cutsAppliedTo.size() != 0 && ImGui::TreeNode("Cuts Applied"))
{
for(auto& cut : params.cutsAppliedTo)
ImGui::BulletText(cut.c_str());
ImGui::BulletText("%s", cut.c_str());
ImGui::TreePop();
}
ImGui::TreePop();
@ -197,9 +197,9 @@ namespace Navigator {
auto& params = cut.second->GetCutParams();
if(ImGui::TreeNode(params.name.c_str()))
{
ImGui::BulletText(("X Parameter: "+params.x_par).c_str());
ImGui::BulletText("%s", ("X Parameter: "+params.x_par).c_str());
if(params.y_par != "None")
ImGui::BulletText(("Y Parameter: "+params.y_par).c_str());
ImGui::BulletText("%s", ("Y Parameter: "+params.y_par).c_str());
ImGui::TreePop();
}
}

View File

@ -16,7 +16,7 @@ namespace Navigator {
FileDialog::FileDialog() :
m_currentPath(std::filesystem::current_path()), m_openFileName(ICON_FA_FILE " Open File"), m_saveFileName(ICON_FA_SAVE " Save File"), m_openDirName(ICON_FA_FOLDER " Open Directory"),
m_selectedItem(""), m_openFileFlag(false), m_openDirFlag(false), m_saveFileFlag(false)
m_selectedItem(""), m_openFileFlag(false), m_saveFileFlag(false), m_openDirFlag(false)
{
table_flags = ImGuiTableFlags_BordersH | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_BordersOuterV | ImGuiTableFlags_RowBg;
select_flags = ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_DontClosePopups;
@ -37,9 +37,9 @@ namespace Navigator {
std::string text = "";
if (ImGui::BeginPopupModal(m_openFileName.c_str()))
{
ImGui::Text(("Current Directory: " + m_currentPath.lexically_normal().string()).c_str());
ImGui::Text("%s", ("Current Directory: " + m_currentPath.lexically_normal().string()).c_str());
ImGui::SameLine();
ImGui::Text(("Extension Filter: "+ext).c_str());
ImGui::Text("%s", ("Extension Filter: "+ext).c_str());
ImGui::InputText("Selected", &m_selectedItem);
if (ImGui::Button("Ok"))
{
@ -87,7 +87,7 @@ namespace Navigator {
if (ImGui::Selectable(text.c_str(), false, select_flags))
m_selectedItem = entry.path().filename().string();
ImGui::TableNextColumn();
ImGui::Text(ConvertFileSystemSizeToString(entry.file_size()).c_str());
ImGui::Text("%s", ConvertFileSystemSizeToString(entry.file_size()).c_str());
}
}
ImGui::EndTable();
@ -112,9 +112,9 @@ namespace Navigator {
std::string text = "";
if (ImGui::BeginPopupModal(m_saveFileName.c_str()))
{
ImGui::Text(("Current Directory: "+m_currentPath.lexically_normal().string()).c_str());
ImGui::Text("%s", ("Current Directory: "+m_currentPath.lexically_normal().string()).c_str());
ImGui::SameLine();
ImGui::Text(("Extension Filter: "+ext).c_str());
ImGui::Text("%s", ("Extension Filter: "+ext).c_str());
ImGui::InputText("Selected", &m_selectedItem);
if (ImGui::Button("Ok"))
{
@ -162,7 +162,7 @@ namespace Navigator {
if (ImGui::Selectable(text.c_str(), false, select_flags))
m_selectedItem = entry.path().filename().string();
ImGui::TableNextColumn();
ImGui::Text(ConvertFileSystemSizeToString(entry.file_size()).c_str());
ImGui::Text("%s", ConvertFileSystemSizeToString(entry.file_size()).c_str());
}
}
ImGui::EndTable();
@ -185,7 +185,7 @@ namespace Navigator {
std::string text = "";
if (ImGui::BeginPopupModal(m_openDirName.c_str()))
{
ImGui::Text(("Current Directory: "+m_currentPath.lexically_normal().string()).c_str());
ImGui::Text("%s", ("Current Directory: "+m_currentPath.lexically_normal().string()).c_str());
ImGui::InputText("Selected", &m_selectedItem);
if (ImGui::Button("Ok"))
{
@ -228,9 +228,9 @@ namespace Navigator {
{
text = ICON_FA_FILE " " + entry.path().filename().string();
ImGui::TableNextColumn();
ImGui::Text(text.c_str());
ImGui::Text("%s", text.c_str());
ImGui::TableNextColumn();
ImGui::Text(ConvertFileSystemSizeToString(entry.file_size()).c_str());
ImGui::Text("%s", ConvertFileSystemSizeToString(entry.file_size()).c_str());
}
}
ImGui::EndTable();

View File

@ -82,7 +82,7 @@ namespace Navigator {
{
for (auto& name : m_newParams.cutsAppliedTo)
{
ImGui::BulletText(name.c_str());
ImGui::BulletText("%s", name.c_str());
}
ImGui::TreePop();
}

View File

@ -38,8 +38,8 @@ namespace Navigator {
m_newCutParams.x_par = zoomed_params.x_par;
m_newCutParams.y_par = zoomed_params.y_par;
ImGui::InputText("Cut Name", &m_newCutParams.name);
ImGui::BulletText(("X Parameter: "+m_newCutParams.x_par).c_str());
ImGui::BulletText(("Y Parameter: "+m_newCutParams.y_par).c_str());
ImGui::BulletText("%s", ("X Parameter: "+m_newCutParams.x_par).c_str());
ImGui::BulletText("%s", ("Y Parameter: "+m_newCutParams.y_par).c_str());
if(ImGui::Button("Accept & Draw"))
{
m_cutModeFlag = true;

View File

@ -64,13 +64,9 @@ namespace Navigator {
void HistogramMap::UpdateHistograms()
{
std::string xpar, ypar;
ParameterMap& pmap = ParameterMap::GetInstance();
for (auto& pair : m_map)
{
pair.second->FillData();
}
}
const HistogramParameters& HistogramMap::GetHistogramParams(const std::string& name)
{
@ -79,9 +75,7 @@ namespace Navigator {
if (iter != m_map.end())
return iter->second->GetParameters();
else
{
return HistogramParameters();
}
return m_nullResult;
}
//Only to be used within ImGui context!!

View File

@ -40,6 +40,8 @@ namespace Navigator {
private:
std::unordered_map<std::string, std::shared_ptr<Histogram>> m_map;
HistogramParameters m_nullResult;
static HistogramMap* s_instance;
};

View File

@ -12,6 +12,8 @@ namespace Navigator {
case DataSource::SourceType::CompassOnline : return new CompassOnlineSource(loc, port);
case DataSource::SourceType::None : return nullptr;
}
NAV_WARN("Invalid DataSourceType at CreateDataSource!");
return nullptr;
}
std::string ConvertDataSourceTypeToString(DataSource::SourceType type)
@ -22,5 +24,7 @@ namespace Navigator {
case DataSource::SourceType::CompassOnline : return "CompassOnline";
case DataSource::SourceType::CompassOffline : return "CompassOffline";
}
return "None";
}
}

View File

@ -7,6 +7,6 @@
],
"settings":
{
"SublimeLinter.linters.g++.args": ["-c","-Wall","-fsyntax-only","-std=c++17","-include${folder}/Navigator/src/navpch.h","-INavigator/src/", "-INavigator/src/Navigator/","-INavigator/vendor/spdlog/include", "-INavigator/vendor/glfw/include/","-INavigator/vendor/glad/include","-INavigator/vendor/imgui","-INavigator/vendor/implot"]
"SublimeLinter.linters.g++.args": ["-c","-Wall","-fsyntax-only","-std=c++17","-include${folder}/Navigator/src/navpch.h","-INavigator/src/", "-INavigator/src/Navigator/","-INavigator/vendor/spdlog/include", "-INavigator/vendor/glfw/include/","-INavigator/vendor/glad/include","-INavigator/vendor/imgui","-INavigator/vendor/implot","-INavigator/vendor/asio/asio/include","-INavigator/vendor/IconFontCppHeaders","-INavigator/vendor/glm"]
}
}