MCPcopy Create free account
hub / github.com/SatDump/SatDump / ShowAxisContextMenu

Function ShowAxisContextMenu

src-core/imgui/implot/implot.cpp:1347–1460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1345}
1346
1347void ShowAxisContextMenu(ImPlotAxis& axis, ImPlotAxis* equal_axis, bool /*time_allowed*/) {
1348
1349 ImGui::PushItemWidth(75);
1350 bool always_locked = axis.IsRangeLocked() || axis.IsAutoFitting();
1351 bool label = axis.HasLabel();
1352 bool grid = axis.HasGridLines();
1353 bool ticks = axis.HasTickMarks();
1354 bool labels = axis.HasTickLabels();
1355 double drag_speed = (axis.Range.Size() <= DBL_EPSILON) ? DBL_EPSILON * 1.0e+13 : 0.01 * axis.Range.Size(); // recover from almost equal axis limits.
1356
1357 if (axis.Scale == ImPlotScale_Time) {
1358 ImPlotTime tmin = ImPlotTime::FromDouble(axis.Range.Min);
1359 ImPlotTime tmax = ImPlotTime::FromDouble(axis.Range.Max);
1360
1361 BeginDisabledControls(always_locked);
1362 ImGui::CheckboxFlags("##LockMin", (unsigned int*)&axis.Flags, ImPlotAxisFlags_LockMin);
1363 EndDisabledControls(always_locked);
1364 ImGui::SameLine();
1365 BeginDisabledControls(axis.IsLockedMin() || always_locked);
1366 if (ImGui::BeginMenu("Min Time")) {
1367 if (ShowTimePicker("mintime", &tmin)) {
1368 if (tmin >= tmax)
1369 tmax = AddTime(tmin, ImPlotTimeUnit_S, 1);
1370 axis.SetRange(tmin.ToDouble(),tmax.ToDouble());
1371 }
1372 ImGui::Separator();
1373 if (ShowDatePicker("mindate",&axis.PickerLevel,&axis.PickerTimeMin,&tmin,&tmax)) {
1374 tmin = CombineDateTime(axis.PickerTimeMin, tmin);
1375 if (tmin >= tmax)
1376 tmax = AddTime(tmin, ImPlotTimeUnit_S, 1);
1377 axis.SetRange(tmin.ToDouble(), tmax.ToDouble());
1378 }
1379 ImGui::EndMenu();
1380 }
1381 EndDisabledControls(axis.IsLockedMin() || always_locked);
1382
1383 BeginDisabledControls(always_locked);
1384 ImGui::CheckboxFlags("##LockMax", (unsigned int*)&axis.Flags, ImPlotAxisFlags_LockMax);
1385 EndDisabledControls(always_locked);
1386 ImGui::SameLine();
1387 BeginDisabledControls(axis.IsLockedMax() || always_locked);
1388 if (ImGui::BeginMenu("Max Time")) {
1389 if (ShowTimePicker("maxtime", &tmax)) {
1390 if (tmax <= tmin)
1391 tmin = AddTime(tmax, ImPlotTimeUnit_S, -1);
1392 axis.SetRange(tmin.ToDouble(),tmax.ToDouble());
1393 }
1394 ImGui::Separator();
1395 if (ShowDatePicker("maxdate",&axis.PickerLevel,&axis.PickerTimeMax,&tmin,&tmax)) {
1396 tmax = CombineDateTime(axis.PickerTimeMax, tmax);
1397 if (tmax <= tmin)
1398 tmin = AddTime(tmax, ImPlotTimeUnit_S, -1);
1399 axis.SetRange(tmin.ToDouble(), tmax.ToDouble());
1400 }
1401 ImGui::EndMenu();
1402 }
1403 EndDisabledControls(axis.IsLockedMax() || always_locked);
1404 }

Callers 2

ShowPlotContextMenuFunction · 0.85
EndPlotFunction · 0.85

Calls 15

BeginDisabledControlsFunction · 0.85
EndDisabledControlsFunction · 0.85
ShowTimePickerFunction · 0.85
AddTimeFunction · 0.85
SeparatorFunction · 0.85
ShowDatePickerFunction · 0.85
CombineDateTimeFunction · 0.85
DragFloatFunction · 0.85
ImFlipFlagFunction · 0.85
IsRangeLockedMethod · 0.80
IsAutoFittingMethod · 0.80
HasLabelMethod · 0.80

Tested by

no test coverage detected