From f542f6f51e5784ddb992de396674b922d86c039a Mon Sep 17 00:00:00 2001 From: tao wang Date: Fri, 10 Feb 2023 11:25:57 +0800 Subject: [PATCH] ENH:the negative volume will not display fillment in object table Change-Id: I25f000c7770378e7919f9be8869c6320867d1ecd --- src/slic3r/GUI/GUI_ObjectTable.cpp | 26 ++++++++++++++++++++------ src/slic3r/GUI/GUI_ObjectTable.hpp | 1 + 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectTable.cpp b/src/slic3r/GUI/GUI_ObjectTable.cpp index 498976751..8928f87d7 100644 --- a/src/slic3r/GUI/GUI_ObjectTable.cpp +++ b/src/slic3r/GUI/GUI_ObjectTable.cpp @@ -344,7 +344,10 @@ void GridCellFilamentsRenderer::Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &d dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(wxBrush(attr.GetBackgroundColour())); dc.DrawRectangle(rect); - dc.DrawBitmap(*bitmap, wxPoint(rect.x + offset_x, rect.y + offset_y)); + if ( grid_row->model_volume_type != ModelVolumeType::NEGATIVE_VOLUME) { + dc.DrawBitmap(*bitmap, wxPoint(rect.x + offset_x, rect.y + offset_y)); + } + text_rect.x += bitmap_width + grid_cell_border_width * 2; text_rect.width -= (bitmap_width + grid_cell_border_width * 2); } @@ -1968,6 +1971,7 @@ void ObjectGridTable::construct_object_configs(ObjectGrid *object_grid) { ModelVolume* volume = object->volumes[j]; ObjectGridRow* volume_grid = new ObjectGridRow(i, j, row_volume); + volume_grid->model_volume_type = volume->type(); volume_grid->config = &(volume->config); volume_grid->name.value = volume->name; size_t pos = volume_grid->name.value.find_first_not_of(' '); @@ -2952,11 +2956,21 @@ void ObjectTablePanel::load_data() break; case coEnum: if (col == ObjectGridTable::col_filaments) { - GridCellFilamentsEditor *filament_editor = new GridCellFilamentsEditor(grid_col->choice_count, grid_col->choices, false, &m_color_bitmaps); - m_object_grid->SetCellEditor(row, col, filament_editor); - m_object_grid->SetCellRenderer(row, col, new GridCellFilamentsRenderer()); - } else { - GridCellChoiceEditor *combo_editor = new GridCellChoiceEditor(grid_col->choice_count, grid_col->choices); + if (grid_row->model_volume_type != ModelVolumeType::NEGATIVE_VOLUME) { + GridCellFilamentsEditor* filament_editor = new GridCellFilamentsEditor(grid_col->choice_count, grid_col->choices, false, &m_color_bitmaps); + m_object_grid->SetCellEditor(row, col, filament_editor); + m_object_grid->SetCellRenderer(row, col, new GridCellFilamentsRenderer()); + } + else { + m_object_grid->SetCellEditor(row, col, new GridCellTextEditor()); + auto gcfil = new GridCellFilamentsRenderer(); + m_object_grid->SetCellRenderer(row, col, gcfil); + m_object_grid->SetReadOnly(row, col); + //m_object_grid->SetCellFitMode(row, col, wxGridFitMode::Ellipsize()); + } + } + else { + GridCellChoiceEditor* combo_editor = new GridCellChoiceEditor(grid_col->choice_count, grid_col->choices); m_object_grid->SetCellEditor(row, col, combo_editor); m_object_grid->SetCellRenderer(row, col, new wxGridCellChoiceRenderer()); } diff --git a/src/slic3r/GUI/GUI_ObjectTable.hpp b/src/slic3r/GUI/GUI_ObjectTable.hpp index 0abe00545..072f211f7 100644 --- a/src/slic3r/GUI/GUI_ObjectTable.hpp +++ b/src/slic3r/GUI/GUI_ObjectTable.hpp @@ -348,6 +348,7 @@ public: ConfigOptionFloat ori_speed_perimeter; ModelConfig* config; + ModelVolumeType model_volume_type; ObjectGridRow(int obj_id, int vol_id, GridRowType type) : object_id(obj_id), volume_id(vol_id), row_type(type)