224 menu->addAction(action); |
224 menu->addAction(action); |
225 } |
225 } |
226 } |
226 } |
227 |
227 |
228 template<typename Fn> |
228 template<typename Fn> |
229 static void forModel(const DocumentManager* documents, Fn&& fn) |
229 static void forEachModel(const DocumentManager* documents, Fn&& fn) |
230 { |
230 { |
231 forValueInMap(*documents, [&fn](const DocumentManager::ModelInfo& info) |
231 forValueInMap(*documents, [&fn](const DocumentManager::ModelInfo& info) |
232 { |
232 { |
233 ModelData* modelSpecificData = qobject_cast<ModelData*>(info.payload); |
233 ModelData* modelSpecificData = qobject_cast<ModelData*>(info.payload); |
234 if (modelSpecificData != nullptr) { |
234 if (modelSpecificData != nullptr) { |
240 static void updateRenderPreferences( |
240 static void updateRenderPreferences( |
241 Ui_MainWindow* ui, |
241 Ui_MainWindow* ui, |
242 const gl::RenderPreferences* renderPreferences, |
242 const gl::RenderPreferences* renderPreferences, |
243 const DocumentManager* documents) |
243 const DocumentManager* documents) |
244 { |
244 { |
245 forModel(documents, [&renderPreferences](const void*, const ModelData* data){ |
245 forEachModel(documents, [&renderPreferences](const void*, const ModelData* data){ |
246 if (data->canvas != nullptr) { |
246 if (data->canvas != nullptr) { |
247 data->canvas->setRenderPreferences(*renderPreferences); |
247 data->canvas->setRenderPreferences(*renderPreferences); |
248 data->canvas->setLayerEnabled(data->axesLayer.get(), renderPreferences->drawAxes); |
248 data->canvas->setLayerEnabled(data->axesLayer.get(), renderPreferences->drawAxes); |
249 } |
249 } |
250 }); |
250 }); |