MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / ShowAxisContextMenu

Function ShowAxisContextMenu

Source/3rdParty/implot/implot.cpp:1385–1498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1383}
1384
1385void ShowAxisContextMenu(ImPlotAxis& axis, ImPlotAxis* equal_axis, bool /*time_allowed*/) {
1386
1387 ImGui::PushItemWidth(75);
1388 bool always_locked = axis.IsRangeLocked() || axis.IsAutoFitting();
1389 bool label = axis.HasLabel();
1390 bool grid = axis.HasGridLines();
1391 bool ticks = axis.HasTickMarks();
1392 bool labels = axis.HasTickLabels();
1393 double drag_speed = (axis.Range.Size() <= DBL_EPSILON) ? DBL_EPSILON * 1.0e+13 : 0.01 * axis.Range.Size(); // recover from almost equal axis limits.
1394
1395 if (axis.Scale == ImPlotScale_Time) {
1396 ImPlotTime tmin = ImPlotTime::FromDouble(axis.Range.Min);
1397 ImPlotTime tmax = ImPlotTime::FromDouble(axis.Range.Max);
1398
1399 BeginDisabledControls(always_locked);
1400 ImGui::CheckboxFlags("##LockMin", (unsigned int*)&axis.Flags, ImPlotAxisFlags_LockMin);
1401 EndDisabledControls(always_locked);
1402 ImGui::SameLine();
1403 BeginDisabledControls(axis.IsLockedMin() || always_locked);
1404 if (ImGui::BeginMenu("Min Time")) {
1405 if (ShowTimePicker("mintime", &tmin)) {
1406 if (tmin >= tmax)
1407 tmax = AddTime(tmin, ImPlotTimeUnit_S, 1);
1408 axis.SetRange(tmin.ToDouble(),tmax.ToDouble());
1409 }
1410 ImGui::Separator();
1411 if (ShowDatePicker("mindate",&axis.PickerLevel,&axis.PickerTimeMin,&tmin,&tmax)) {
1412 tmin = CombineDateTime(axis.PickerTimeMin, tmin);
1413 if (tmin >= tmax)
1414 tmax = AddTime(tmin, ImPlotTimeUnit_S, 1);
1415 axis.SetRange(tmin.ToDouble(), tmax.ToDouble());
1416 }
1417 ImGui::EndMenu();
1418 }
1419 EndDisabledControls(axis.IsLockedMin() || always_locked);
1420
1421 BeginDisabledControls(always_locked);
1422 ImGui::CheckboxFlags("##LockMax", (unsigned int*)&axis.Flags, ImPlotAxisFlags_LockMax);
1423 EndDisabledControls(always_locked);
1424 ImGui::SameLine();
1425 BeginDisabledControls(axis.IsLockedMax() || always_locked);
1426 if (ImGui::BeginMenu("Max Time")) {
1427 if (ShowTimePicker("maxtime", &tmax)) {
1428 if (tmax <= tmin)
1429 tmin = AddTime(tmax, ImPlotTimeUnit_S, -1);
1430 axis.SetRange(tmin.ToDouble(),tmax.ToDouble());
1431 }
1432 ImGui::Separator();
1433 if (ShowDatePicker("maxdate",&axis.PickerLevel,&axis.PickerTimeMax,&tmin,&tmax)) {
1434 tmax = CombineDateTime(axis.PickerTimeMax, tmax);
1435 if (tmax <= tmin)
1436 tmin = AddTime(tmax, ImPlotTimeUnit_S, -1);
1437 axis.SetRange(tmin.ToDouble(), tmax.ToDouble());
1438 }
1439 ImGui::EndMenu();
1440 }
1441 EndDisabledControls(axis.IsLockedMax() || always_locked);
1442 }

Callers 2

ShowPlotContextMenuFunction · 0.85
EndPlotFunction · 0.85

Calls 15

BeginDisabledControlsFunction · 0.85
EndDisabledControlsFunction · 0.85
BeginMenuFunction · 0.85
ShowTimePickerFunction · 0.85
AddTimeFunction · 0.85
SeparatorFunction · 0.85
ShowDatePickerFunction · 0.85
CombineDateTimeFunction · 0.85
CheckboxFunction · 0.85
ImFlipFlagFunction · 0.85
IsRangeLockedMethod · 0.80
IsAutoFittingMethod · 0.80

Tested by

no test coverage detected