mirror of
https://github.com/gwm17/Specter.git
synced 2024-11-26 12:18:51 -05:00
Fixed some semantics to reduce warnings from strings in ImGui widgets. HistogramMap now has a nullResult member
This commit is contained in:
parent
8c6fce5220
commit
ec401030e1
|
@ -165,23 +165,23 @@ namespace Navigator {
|
||||||
auto& params = gram.second->GetParameters();
|
auto& params = gram.second->GetParameters();
|
||||||
if (ImGui::TreeNode(params.name.c_str()))
|
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);
|
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")
|
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);
|
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"))
|
if(params.cutsDrawnUpon.size() != 0 && ImGui::TreeNode("Cuts Drawn"))
|
||||||
{
|
{
|
||||||
for(auto& cut : params.cutsDrawnUpon)
|
for(auto& cut : params.cutsDrawnUpon)
|
||||||
ImGui::BulletText(cut.c_str());
|
ImGui::BulletText("%s", cut.c_str());
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
if(params.cutsAppliedTo.size() != 0 && ImGui::TreeNode("Cuts Applied"))
|
if(params.cutsAppliedTo.size() != 0 && ImGui::TreeNode("Cuts Applied"))
|
||||||
{
|
{
|
||||||
for(auto& cut : params.cutsAppliedTo)
|
for(auto& cut : params.cutsAppliedTo)
|
||||||
ImGui::BulletText(cut.c_str());
|
ImGui::BulletText("%s", cut.c_str());
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
|
@ -197,9 +197,9 @@ namespace Navigator {
|
||||||
auto& params = cut.second->GetCutParams();
|
auto& params = cut.second->GetCutParams();
|
||||||
if(ImGui::TreeNode(params.name.c_str()))
|
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")
|
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();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Navigator {
|
||||||
|
|
||||||
FileDialog::FileDialog() :
|
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_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;
|
table_flags = ImGuiTableFlags_BordersH | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_BordersOuterV | ImGuiTableFlags_RowBg;
|
||||||
select_flags = ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_DontClosePopups;
|
select_flags = ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_DontClosePopups;
|
||||||
|
@ -37,9 +37,9 @@ namespace Navigator {
|
||||||
std::string text = "";
|
std::string text = "";
|
||||||
if (ImGui::BeginPopupModal(m_openFileName.c_str()))
|
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::SameLine();
|
||||||
ImGui::Text(("Extension Filter: "+ext).c_str());
|
ImGui::Text("%s", ("Extension Filter: "+ext).c_str());
|
||||||
ImGui::InputText("Selected", &m_selectedItem);
|
ImGui::InputText("Selected", &m_selectedItem);
|
||||||
if (ImGui::Button("Ok"))
|
if (ImGui::Button("Ok"))
|
||||||
{
|
{
|
||||||
|
@ -87,7 +87,7 @@ namespace Navigator {
|
||||||
if (ImGui::Selectable(text.c_str(), false, select_flags))
|
if (ImGui::Selectable(text.c_str(), false, select_flags))
|
||||||
m_selectedItem = entry.path().filename().string();
|
m_selectedItem = entry.path().filename().string();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Text(ConvertFileSystemSizeToString(entry.file_size()).c_str());
|
ImGui::Text("%s", ConvertFileSystemSizeToString(entry.file_size()).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
|
@ -112,9 +112,9 @@ namespace Navigator {
|
||||||
std::string text = "";
|
std::string text = "";
|
||||||
if (ImGui::BeginPopupModal(m_saveFileName.c_str()))
|
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::SameLine();
|
||||||
ImGui::Text(("Extension Filter: "+ext).c_str());
|
ImGui::Text("%s", ("Extension Filter: "+ext).c_str());
|
||||||
ImGui::InputText("Selected", &m_selectedItem);
|
ImGui::InputText("Selected", &m_selectedItem);
|
||||||
if (ImGui::Button("Ok"))
|
if (ImGui::Button("Ok"))
|
||||||
{
|
{
|
||||||
|
@ -162,7 +162,7 @@ namespace Navigator {
|
||||||
if (ImGui::Selectable(text.c_str(), false, select_flags))
|
if (ImGui::Selectable(text.c_str(), false, select_flags))
|
||||||
m_selectedItem = entry.path().filename().string();
|
m_selectedItem = entry.path().filename().string();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Text(ConvertFileSystemSizeToString(entry.file_size()).c_str());
|
ImGui::Text("%s", ConvertFileSystemSizeToString(entry.file_size()).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
|
@ -185,7 +185,7 @@ namespace Navigator {
|
||||||
std::string text = "";
|
std::string text = "";
|
||||||
if (ImGui::BeginPopupModal(m_openDirName.c_str()))
|
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);
|
ImGui::InputText("Selected", &m_selectedItem);
|
||||||
if (ImGui::Button("Ok"))
|
if (ImGui::Button("Ok"))
|
||||||
{
|
{
|
||||||
|
@ -228,9 +228,9 @@ namespace Navigator {
|
||||||
{
|
{
|
||||||
text = ICON_FA_FILE " " + entry.path().filename().string();
|
text = ICON_FA_FILE " " + entry.path().filename().string();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Text(text.c_str());
|
ImGui::Text("%s", text.c_str());
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Text(ConvertFileSystemSizeToString(entry.file_size()).c_str());
|
ImGui::Text("%s", ConvertFileSystemSizeToString(entry.file_size()).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace Navigator {
|
||||||
{
|
{
|
||||||
for (auto& name : m_newParams.cutsAppliedTo)
|
for (auto& name : m_newParams.cutsAppliedTo)
|
||||||
{
|
{
|
||||||
ImGui::BulletText(name.c_str());
|
ImGui::BulletText("%s", name.c_str());
|
||||||
}
|
}
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@ namespace Navigator {
|
||||||
m_newCutParams.x_par = zoomed_params.x_par;
|
m_newCutParams.x_par = zoomed_params.x_par;
|
||||||
m_newCutParams.y_par = zoomed_params.y_par;
|
m_newCutParams.y_par = zoomed_params.y_par;
|
||||||
ImGui::InputText("Cut Name", &m_newCutParams.name);
|
ImGui::InputText("Cut Name", &m_newCutParams.name);
|
||||||
ImGui::BulletText(("X Parameter: "+m_newCutParams.x_par).c_str());
|
ImGui::BulletText("%s", ("X Parameter: "+m_newCutParams.x_par).c_str());
|
||||||
ImGui::BulletText(("Y Parameter: "+m_newCutParams.y_par).c_str());
|
ImGui::BulletText("%s", ("Y Parameter: "+m_newCutParams.y_par).c_str());
|
||||||
if(ImGui::Button("Accept & Draw"))
|
if(ImGui::Button("Accept & Draw"))
|
||||||
{
|
{
|
||||||
m_cutModeFlag = true;
|
m_cutModeFlag = true;
|
||||||
|
|
|
@ -64,13 +64,9 @@ namespace Navigator {
|
||||||
|
|
||||||
void HistogramMap::UpdateHistograms()
|
void HistogramMap::UpdateHistograms()
|
||||||
{
|
{
|
||||||
std::string xpar, ypar;
|
|
||||||
ParameterMap& pmap = ParameterMap::GetInstance();
|
|
||||||
for (auto& pair : m_map)
|
for (auto& pair : m_map)
|
||||||
{
|
|
||||||
pair.second->FillData();
|
pair.second->FillData();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const HistogramParameters& HistogramMap::GetHistogramParams(const std::string& name)
|
const HistogramParameters& HistogramMap::GetHistogramParams(const std::string& name)
|
||||||
{
|
{
|
||||||
|
@ -79,9 +75,7 @@ namespace Navigator {
|
||||||
if (iter != m_map.end())
|
if (iter != m_map.end())
|
||||||
return iter->second->GetParameters();
|
return iter->second->GetParameters();
|
||||||
else
|
else
|
||||||
{
|
return m_nullResult;
|
||||||
return HistogramParameters();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Only to be used within ImGui context!!
|
//Only to be used within ImGui context!!
|
||||||
|
|
|
@ -40,6 +40,8 @@ namespace Navigator {
|
||||||
private:
|
private:
|
||||||
std::unordered_map<std::string, std::shared_ptr<Histogram>> m_map;
|
std::unordered_map<std::string, std::shared_ptr<Histogram>> m_map;
|
||||||
|
|
||||||
|
HistogramParameters m_nullResult;
|
||||||
|
|
||||||
static HistogramMap* s_instance;
|
static HistogramMap* s_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ namespace Navigator {
|
||||||
case DataSource::SourceType::CompassOnline : return new CompassOnlineSource(loc, port);
|
case DataSource::SourceType::CompassOnline : return new CompassOnlineSource(loc, port);
|
||||||
case DataSource::SourceType::None : return nullptr;
|
case DataSource::SourceType::None : return nullptr;
|
||||||
}
|
}
|
||||||
|
NAV_WARN("Invalid DataSourceType at CreateDataSource!");
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ConvertDataSourceTypeToString(DataSource::SourceType type)
|
std::string ConvertDataSourceTypeToString(DataSource::SourceType type)
|
||||||
|
@ -22,5 +24,7 @@ namespace Navigator {
|
||||||
case DataSource::SourceType::CompassOnline : return "CompassOnline";
|
case DataSource::SourceType::CompassOnline : return "CompassOnline";
|
||||||
case DataSource::SourceType::CompassOffline : return "CompassOffline";
|
case DataSource::SourceType::CompassOffline : return "CompassOffline";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return "None";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
],
|
],
|
||||||
"settings":
|
"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"]
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user