| 2104 | } |
| 2105 | |
| 2106 | bool ImGuiMenu::drawRemoveButton( const std::vector<std::shared_ptr<Object>>& selectedObjs ) |
| 2107 | { |
| 2108 | bool someChanges = false; |
| 2109 | auto backUpColorBtn = ImGui::GetStyle().Colors[ImGuiCol_Button]; |
| 2110 | auto backUpColorBtnH = ImGui::GetStyle().Colors[ImGuiCol_ButtonHovered]; |
| 2111 | auto backUpColorBtnA = ImGui::GetStyle().Colors[ImGuiCol_ButtonActive]; |
| 2112 | |
| 2113 | if ( !allowRemoval_ ) |
| 2114 | { |
| 2115 | const auto& colorDis = ImGui::GetStyle().Colors[ImGuiCol_TextDisabled]; |
| 2116 | ImGui::GetStyle().Colors[ImGuiCol_Button] = colorDis; |
| 2117 | ImGui::GetStyle().Colors[ImGuiCol_ButtonHovered] = colorDis; |
| 2118 | ImGui::GetStyle().Colors[ImGuiCol_ButtonActive] = colorDis; |
| 2119 | } |
| 2120 | bool clicked = allowRemoval_ ? |
| 2121 | UI::button( _tr( "Remove" ), Vector2f( -1, 0 ) ) : |
| 2122 | ImGui::Button( _tr( "Remove" ), ImVec2( -1, 0 ) ); |
| 2123 | if ( clicked ) |
| 2124 | { |
| 2125 | someChanges |= true; |
| 2126 | if ( allowRemoval_ ) |
| 2127 | { |
| 2128 | SCOPED_HISTORY( _t( "Remove Objects (context)" ) ); |
| 2129 | for ( int i = ( int )selectedObjs.size() - 1; i >= 0; --i ) |
| 2130 | if ( selectedObjs[i] ) |
| 2131 | { |
| 2132 | // for now do it by one object |
| 2133 | AppendHistory<ChangeSceneAction>( "Remove object", selectedObjs[i], ChangeSceneAction::Type::RemoveObject ); |
| 2134 | selectedObjs[i]->detachFromParent(); |
| 2135 | } |
| 2136 | } |
| 2137 | } |
| 2138 | if ( !allowRemoval_ ) |
| 2139 | { |
| 2140 | ImGui::GetStyle().Colors[ImGuiCol_Button] = backUpColorBtn; |
| 2141 | ImGui::GetStyle().Colors[ImGuiCol_ButtonHovered] = backUpColorBtnH; |
| 2142 | ImGui::GetStyle().Colors[ImGuiCol_ButtonActive] = backUpColorBtnA; |
| 2143 | } |
| 2144 | |
| 2145 | return someChanges; |
| 2146 | } |
| 2147 | |
| 2148 | bool ImGuiMenu::drawDrawOptionsCheckboxes( const std::vector<std::shared_ptr<VisualObject>>& selectedVisualObjs, SelectedTypesMask selectedMask ) |
| 2149 | { |
no test coverage detected