Cleanup for coding style

Add strict mode to check_style_guide script
This commit is contained in:
Alexander Bock
2017-11-08 10:35:39 -06:00
parent d94408224c
commit b50b52d351
387 changed files with 1907 additions and 2132 deletions
+12 -12
View File
@@ -59,7 +59,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[&](){
LDEBUGC("ImGUIModule", "Initializing GUI");
gui.initialize();
gui._globalProperty.setSource(
[]() {
std::vector<properties::PropertyOwner*> res = {
@@ -73,7 +73,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
return res;
}
);
gui._screenSpaceProperty.setSource(
[]() {
const std::vector<ScreenSpaceRenderable*>& ssr =
@@ -81,7 +81,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
return std::vector<properties::PropertyOwner*>(ssr.begin(), ssr.end());
}
);
gui._property.setSource(
[]() {
const std::vector<SceneGraphNode*>& nodes =
@@ -122,7 +122,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
);
}
);
OsEng.registerModuleCallback(
OpenSpaceEngine::CallbackOption::Deinitialize,
[&](){
@@ -130,7 +130,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
gui.deinitialize();
}
);
OsEng.registerModuleCallback(
OpenSpaceEngine::CallbackOption::InitializeGL,
[&](){
@@ -138,7 +138,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
gui.initializeGL();
}
);
OsEng.registerModuleCallback(
OpenSpaceEngine::CallbackOption::DeinitializeGL,
[&](){
@@ -160,7 +160,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
//glm::ivec2 drawBufferResolution = _windowWrapper->currentDrawBufferResolution();
glm::ivec2 windowSize = wrapper.currentWindowSize();
uint32_t mouseButtons = wrapper.mouseButtons(2);
double dt = std::max(wrapper.averageDeltaTime(), 0.0);
if (touchInput.active && mouseButtons == 0) {
mouseButtons = touchInput.action;
@@ -180,7 +180,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
}
}
);
OsEng.registerModuleKeyboardCallback(
[&](Key key, KeyModifier mod, KeyAction action) -> bool {
if (gui.isEnabled()) {
@@ -191,7 +191,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
}
}
);
OsEng.registerModuleCharCallback(
[&](unsigned int codepoint, KeyModifier modifier) -> bool {
if (gui.isEnabled()) {
@@ -202,7 +202,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
}
}
);
OsEng.registerModuleMouseButtonCallback(
[&](MouseButton button, MouseAction action) -> bool {
if (gui.isEnabled()) {
@@ -213,7 +213,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
}
}
);
OsEng.registerModuleMouseScrollWheelCallback(
[&](double, double posY) -> bool {
if (gui.isEnabled()) {
@@ -225,5 +225,5 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
}
);
}
} // namespace openspace
+1 -1
View File
@@ -42,7 +42,7 @@ public:
constexpr static const char* Name = "ImGUI";
ImGUIModule();
gui::GUI gui;
Touch touchInput = { false, glm::vec2(0), 0 };
};
+1 -1
View File
@@ -62,7 +62,7 @@ public:
/// Deinitializes the component with things that do not require an OpenGL context
virtual void deinitialize();
/// Deinitializes the component with things that require an OpenGL context
virtual void deinitializeGL();
+3 -3
View File
@@ -451,9 +451,9 @@ void GUI::initializeGL() {
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, vboMaxSize, nullptr, GL_DYNAMIC_DRAW);
glGenBuffers(1, &vboElements);
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
@@ -770,7 +770,7 @@ void GUI::render() {
ImGui::End();
}
void GUI::renderAndUpdatePropertyVisibility() {
// Fragile! Keep this in sync with properties::Property::Visibility
using V = properties::Property::Visibility;
+2 -2
View File
@@ -59,7 +59,7 @@ void GuiIswaComponent::render() {
ImGui::Begin("ISWA", &e, WindowSize, 0.5f);
_isEnabled = e;
ImGui::Text("Global Magnetosphere");
ImGui::Checkbox("Gm From Data", &_gmData); ImGui::SameLine();
ImGui::Checkbox("Gm From Images", &_gmImage);
@@ -215,7 +215,7 @@ void GuiIswaComponent::render() {
}
}
}
ImGui::End();
#endif
}
+2 -2
View File
@@ -45,7 +45,7 @@ namespace {
double currentTime = OsEng.timeManager().time().j2000Seconds();
openspace::MissionPhase::Trace t = mission.phaseTrace(currentTime, 0);
int treeOption = t.empty() ? 0 : ImGuiTreeNodeFlags_DefaultOpen;
if (ImGui::TreeNodeEx(("%s" + missionHashname).c_str(), treeOption, "%s", mission.name().c_str())) {
if (!mission.description().empty()) {
@@ -55,7 +55,7 @@ namespace {
openspace::TimeRange range = mission.timeRange();
openspace::Time startTime = openspace::Time(range.start);
openspace::Time endTime = openspace::Time(range.end);
openspace::gui::CaptionText("Mission Progress");
ImGui::Text("%s", startTime.UTC().c_str());
+11 -13
View File
@@ -125,7 +125,7 @@ void GuiPerformanceComponent::render() {
bool sge = _sceneGraphIsEnabled;
ImGui::Begin("SceneGraph", &sge);
_sceneGraphIsEnabled = sge;
// The indices correspond to the index into the average array further below
ImGui::Text("Sorting");
int sorting = _sortingSelection;
@@ -181,17 +181,17 @@ void GuiPerformanceComponent::render() {
layout->nScaleGraphEntries,
{ 0.f, 0.f, 0.f, 0.f, 0.f }
);
std::vector<std::array<std::pair<float, float>, 5>> minMax(
layout->nScaleGraphEntries
);
for (int i = 0; i < layout->nScaleGraphEntries; ++i) {
const PerformanceLayout::SceneGraphPerformanceLayout& entry =
layout->sceneGraphEntries[i];
int nValues[5] = { 0, 0, 0, 0, 0 };
// Compute the averages and count the number of values so we don't divide
// by 0 later
for (int j = 0; j < PerformanceLayout::NumberValues; ++j) {
@@ -256,7 +256,7 @@ void GuiPerformanceComponent::render() {
*(minmaxScaling.first),
*(minmaxScaling.second)
);
auto minmaxUpdateRenderable = std::minmax_element(
std::begin(entry.updateRenderable),
std::end(entry.updateRenderable)
@@ -274,10 +274,8 @@ void GuiPerformanceComponent::render() {
*(minmaxRendering.first),
*(minmaxRendering.second)
);
}
// If we don't want to sort, we will leave the indices list alone, thus
// leaving them in the regular ordering
Sorting selection = Sorting(sorting);
@@ -430,17 +428,17 @@ void GuiPerformanceComponent::render() {
}
ImGui::End();
}
if (_functionsIsEnabled) {
bool fe = _functionsIsEnabled;
ImGui::Begin("Functions", &fe);
_functionsIsEnabled = fe;
using namespace performance;
for (int i = 0; i < layout->nFunctionEntries; ++i) {
const PerformanceLayout::FunctionPerformanceLayout& entry =
layout->functionEntries[i];
float avg = 0.f;
int count = 0;
for (int j = 0; j < PerformanceLayout::NumberValues; ++j) {
@@ -449,12 +447,12 @@ void GuiPerformanceComponent::render() {
++count;
}
avg /= count;
auto minmax = std::minmax_element(
std::begin(layout->functionEntries[i].time),
std::end(layout->functionEntries[i].time)
);
std::string renderTime = std::to_string(
entry.time[PerformanceLayout::NumberValues - 1]
) + "us";
+1 -2
View File
@@ -218,7 +218,7 @@ void GuiSpaceTimeComponent::render() {
// UTC returns a string of the type YYYY MMM DDTHH:mm:ss.xxx
// setTime doesn't like the T in it and wants a space instead
nowTime[11] = ' ';
OsEng.scriptEngine().queueScript(
"openspace.time.setTime(\"" + nowTime + "\")",
scripting::ScriptEngine::RemoteScripting::Yes
@@ -273,7 +273,6 @@ void GuiSpaceTimeComponent::render() {
bool isPaused = OsEng.timeManager().time().paused();
bool pauseChanged = ImGui::Button(isPaused ? "Resume" : "Pause", { ImGui::GetWindowWidth() - 7.5f, 0.f } );
if (pauseChanged) {
OsEng.scriptEngine().queueScript(
+1 -1
View File
@@ -36,7 +36,7 @@ GuiTimeComponent::GuiTimeComponent() : GuiComponent("Time") {}
void GuiTimeComponent::render() {
float deltaTime = static_cast<float>(OsEng.timeManager().time().deltaTime());
bool changed = ImGui::SliderFloat("Delta Time", &deltaTime, -50000.f, 50000.f);
if (changed) {
OsEng.scriptEngine().queueScript(
+10 -10
View File
@@ -250,7 +250,7 @@ void renderIntProperty(Property* prop, const std::string& ownerName,
IntProperty::ValueType value = *p;
int min = p->minValue();
int max = p->maxValue();
ImGui::SliderInt(name.c_str(), &value, min, max);
renderTooltip(prop);
@@ -268,7 +268,7 @@ void renderIVec2Property(Property* prop, const std::string& ownerName,
IVec2Property* p = static_cast<IVec2Property*>(prop);
std::string name = p->guiName();
ImGui::PushID((ownerName + "." + name).c_str());
IVec2Property::ValueType value = *p;
int min = std::min(p->minValue().x, p->minValue().y);
int max = std::max(p->maxValue().x, p->maxValue().y);
@@ -279,7 +279,7 @@ void renderIVec2Property(Property* prop, const std::string& ownerName,
max
);
renderTooltip(prop);
if (value != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),
@@ -287,7 +287,7 @@ void renderIVec2Property(Property* prop, const std::string& ownerName,
isRegular
);
}
ImGui::PopID();
}
@@ -298,11 +298,11 @@ void renderIVec3Property(Property* prop, const std::string& ownerName,
IVec3Property* p = static_cast<IVec3Property*>(prop);
std::string name = p->guiName();
ImGui::PushID((ownerName + "." + name).c_str());
IVec3Property::ValueType value = *p;
int min = std::min(std::min(p->minValue().x, p->minValue().y), p->minValue().z);
int max = std::max(std::max(p->maxValue().x, p->maxValue().y), p->maxValue().z);
ImGui::SliderInt3(
name.c_str(),
&value.x,
@@ -310,7 +310,7 @@ void renderIVec3Property(Property* prop, const std::string& ownerName,
max
);
renderTooltip(prop);
if (value != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),
@@ -329,7 +329,7 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
IVec4Property* p = static_cast<IVec4Property*>(prop);
std::string name = p->guiName();
ImGui::PushID((ownerName + "." + name).c_str());
IVec4Property::ValueType value = *p;
int min = std::min(std::min(std::min(
p->minValue().x, p->minValue().y), p->minValue().z), p->minValue().w
@@ -337,7 +337,7 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
int max = std::max(std::max(std::max(
p->maxValue().x, p->maxValue().y), p->maxValue().z), p->maxValue().w
);
ImGui::SliderInt4(
name.c_str(),
&value.x,
@@ -345,7 +345,7 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
max
);
renderTooltip(prop);
if (value != p->value()) {
executeScript(
p->fullyQualifiedIdentifier(),