| 1885 | } |
| 1886 | |
| 1887 | void ImGuiMenu::drawComparablePropertiesEditor_( ObjectComparableWithReference& object ) |
| 1888 | { |
| 1889 | const float fullWidth = getSceneInfoItemWidth_( 1 ); |
| 1890 | const ImVec2 buttonSize( ImGui::GetFrameHeight(), ImGui::GetFrameHeight() ); |
| 1891 | |
| 1892 | const std::string_view notSpecifiedStr = "\xE2\x80\x94"; // U+2014 EM DASH |
| 1893 | |
| 1894 | // Reference values. |
| 1895 | const std::size_t numRefs = object.numComparisonReferenceValues(); |
| 1896 | for ( std::size_t i = 0; i < numRefs; i++ ) |
| 1897 | { |
| 1898 | auto nominalValue = object.getComparisonReferenceValue( i ); |
| 1899 | |
| 1900 | ImGui::SetNextItemWidth( fullWidth ); |
| 1901 | |
| 1902 | if ( std::visit( [&]( auto& elem ){ return UI::input<LengthUnit>( std::string( object.getComparisonReferenceValueName( i ) ).c_str(), elem, -FLT_MAX, FLT_MAX, { .decorationFormatString = nominalValue.isSet ? "{}" : notSpecifiedStr } ); }, nominalValue.var ) ) |
| 1903 | object.setComparisonReferenceValue( i, nominalValue.var ); |
| 1904 | |
| 1905 | if ( nominalValue.isSet ) |
| 1906 | { |
| 1907 | ImGui::SameLine(); |
| 1908 | |
| 1909 | ImGui::SetCursorPosX( ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - buttonSize.x ); |
| 1910 | if ( UI::buttonEx( fmt::format( "\xC3\x97###removeNominal:{}", object.getComparisonReferenceValueName( i ) ).c_str(), buttonSize, { .customTexture = UI::getTexture( UI::TextureType::GradientBtnGray ).get() } ) ) // U+00D7 MULTIPLICATION SIGN |
| 1911 | object.setComparisonReferenceValue( i, {} ); |
| 1912 | } |
| 1913 | } |
| 1914 | |
| 1915 | // Tolerances. |
| 1916 | const std::size_t numTols = object.numComparableProperties(); |
| 1917 | for ( std::size_t i = 0; i < numTols; i++ ) |
| 1918 | { |
| 1919 | std::string name; |
| 1920 | if ( numTols == 1 ) |
| 1921 | name = s_tr( "Tolerance" ); |
| 1922 | else |
| 1923 | name = fmt::format( "{} {}", object.getComparablePropertyName( i ), _tr( "tolerance" ) ); |
| 1924 | |
| 1925 | ImGui::SetNextItemWidth( fullWidth ); |
| 1926 | QualityControl::inputTolerance( name.c_str(), object, i ); |
| 1927 | |
| 1928 | // The button to remove tolerance. |
| 1929 | if ( object.getComparisonTolerence( i ) ) |
| 1930 | { |
| 1931 | ImGui::SameLine(); |
| 1932 | |
| 1933 | ImGui::SetCursorPosX( ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - buttonSize.x ); |
| 1934 | |
| 1935 | if ( UI::buttonEx( fmt::format( "\xC3\x97###removeTolerance:{}", name ).c_str(), buttonSize, { .customTexture = UI::getTexture( UI::TextureType::GradientBtnGray ).get() } ) ) // U+00D7 MULTIPLICATION SIGN |
| 1936 | object.setComparisonTolerance( i, {} ); |
| 1937 | } |
| 1938 | } |
| 1939 | } |
| 1940 | |
| 1941 | bool ImGuiMenu::drawGeneralOptions( const std::vector<std::shared_ptr<Object>>& selectedObjs ) |
| 1942 | { |
nothing calls this directly
no test coverage detected