MCPcopy Create free account
hub / github.com/chrxh/alien / processToolbar

Method processToolbar

source/Gui/SimulationParametersMainWindow.cpp:99–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99void SimulationParametersMainWindow::processToolbar()
100{
101 if (AlienImGui::ToolbarButton(AlienImGui::ToolbarButtonParameters().text(ICON_FA_FOLDER_OPEN).tooltip("Open simulation parameters from file"))) {
102 onOpenParameters();
103 }
104
105 ImGui::SameLine();
106 if (AlienImGui::ToolbarButton(AlienImGui::ToolbarButtonParameters().text(ICON_FA_SAVE).tooltip("Save simulation parameters to file"))) {
107 onSaveParameters();
108 }
109
110 ImGui::SameLine();
111 AlienImGui::ToolbarSeparator();
112
113 ImGui::SameLine();
114 if (AlienImGui::ToolbarButton(AlienImGui::ToolbarButtonParameters().text(ICON_FA_COPY).tooltip("Copy simulation parameters to clipboard"))) {
115 _copiedParameters = _simulationFacade->getSimulationParameters();
116 printOverlayMessage("Simulation parameters copied");
117 }
118
119 ImGui::SameLine();
120 if (AlienImGui::ToolbarButton(
121 AlienImGui::ToolbarButtonParameters().text(ICON_FA_PASTE).tooltip("Paste simulation parameters from clipboard").disabled(!_copiedParameters))) {
122 _simulationFacade->setSimulationParameters(*_copiedParameters);
123 _simulationFacade->setOriginalSimulationParameters(*_copiedParameters);
124 printOverlayMessage("Simulation parameters pasted");
125 }
126
127 ImGui::SameLine();
128 if (AlienImGui::ToolbarButton(AlienImGui::ToolbarButtonParameters()
129 .text(ICON_FA_PASTE)
130 .secondText(ICON_FA_UNDO)
131 .secondTextOffset(RealVector2D{32.0f, 28.0f})
132 .secondTextScale(0.3f)
133 .tooltip("Replace reference values by values from the clipboard. This is useful to see the diff between the current "
134 "parameters and those from the clipboard.")
135 .disabled(!_copiedParameters))) {
136 auto parameters = _simulationFacade->getSimulationParameters();
137 if (_copiedParameters->numZones == parameters.numZones && _copiedParameters->numRadiationSources == parameters.numRadiationSources) {
138 _simulationFacade->setOriginalSimulationParameters(*_copiedParameters);
139 printOverlayMessage("Reference simulation parameters replaced");
140 } else {
141 GenericMessageDialog::get().information(
142 "Error", "The number of zones and radiation sources of the current simulation parameters must match with those from the clipboard.");
143 }
144 }
145
146 ImGui::SameLine();
147 AlienImGui::ToolbarSeparator();
148
149 ImGui::SameLine();
150 if (AlienImGui::ToolbarButton(AlienImGui::ToolbarButtonParameters().text(ICON_FA_PLUS).secondText(ICON_FA_LAYER_GROUP).tooltip("Add parameter zone"))) {
151 onAddZone();
152 }
153
154 ImGui::SameLine();
155 if (AlienImGui::ToolbarButton(AlienImGui::ToolbarButtonParameters().text(ICON_FA_PLUS).secondText(ICON_FA_SUN).tooltip("Add radiation source"))) {
156 onAddSource();

Callers

nothing calls this directly

Calls 6

printOverlayMessageFunction · 0.85
informationMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected