ENH:the negative volume will not display fillment in object table

Change-Id: I25f000c7770378e7919f9be8869c6320867d1ecd
This commit is contained in:
tao wang 2023-02-10 11:25:57 +08:00 committed by Lane.Wei
parent 7ecc8a9834
commit f542f6f51e
2 changed files with 21 additions and 6 deletions

View File

@ -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());
}

View File

@ -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)