FIX: Display inconsistence in parameter table

JIra: STUDIO-3716

Signed-off-by: wenjie.guo <wenjie.guo@bambulab.com>
Change-Id: I986473bcbb3efff4abd9c5917926d9e888a4f28c
This commit is contained in:
wenjie.guo 2023-11-23 09:52:10 +08:00 committed by Lane.Wei
parent f2b938ebc6
commit 33b9fbc4a0
1 changed files with 40 additions and 28 deletions

View File

@ -345,10 +345,16 @@ void GridCellFilamentsRenderer::Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &d
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxBrush(attr.GetBackgroundColour()));
dc.DrawRectangle(rect);
if ( grid_row->model_volume_type != ModelVolumeType::NEGATIVE_VOLUME) {
if ((grid_row->model_volume_type != ModelVolumeType::NEGATIVE_VOLUME) && \
(grid_row->model_volume_type != ModelVolumeType::SUPPORT_BLOCKER) && \
(grid_row->model_volume_type != ModelVolumeType::SUPPORT_ENFORCER) && \
(grid_row->model_volume_type != ModelVolumeType::PARAMETER_MODIFIER)) {
dc.DrawBitmap(*bitmap, wxPoint(rect.x + offset_x, rect.y + offset_y));
}
else if (grid_row->model_volume_type == ModelVolumeType::PARAMETER_MODIFIER){
dc.DrawText("Default", 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);
}
@ -693,40 +699,44 @@ void GridCellSupportRenderer::Draw(wxGrid& grid,
auto width = grid.GetColSize(col);
wxGridCellRenderer::Draw(grid, attr, dc, rect, row, col, isSelected);
if (cur_option.value) {
wxString value = table->GetValue(row, col);
if (grid_row->row_type != table->GridRowType::row_volume || col != table->GridColType::col_printable) {
if (cur_option.value) {
auto check_on = create_scaled_bitmap("check_on", nullptr, 18);
dc.SetPen(*wxTRANSPARENT_PEN);
auto check_on = create_scaled_bitmap("check_on", nullptr, 18);
dc.SetPen(*wxTRANSPARENT_PEN);
auto offsetx = 0;
auto offsety = 0;
auto offsetx = 0;
auto offsety = 0;
#ifdef __WXOSX_MAC__
offsetx = (width - 18) / 2;
offsety = (height - 18) / 2;
#else
offsetx = (width - check_on.GetSize().x) / 2;
offsety = (height - check_on.GetSize().y) / 2;
#endif // __WXOSX_MAC__
#ifdef __WXOSX_MAC__
offsetx = (width - 18) / 2;
offsety = (height - 18) / 2;
#else
offsetx = (width - check_on.GetSize().x) / 2;
offsety = (height - check_on.GetSize().y) / 2;
#endif // __WXOSX_MAC__
dc.DrawBitmap(check_on, rect.x + offsetx, rect.y + offsety);
dc.DrawBitmap(check_on, rect.x + offsetx, rect.y + offsety);
} else {
auto check_off = create_scaled_bitmap("check_off_focused", nullptr, 18);
dc.SetPen(*wxTRANSPARENT_PEN);
auto check_off = create_scaled_bitmap("check_off_focused", nullptr, 18);
dc.SetPen(*wxTRANSPARENT_PEN);
auto offsetx = 0;
auto offsety = 0;
auto offsetx = 0;
auto offsety = 0;
#ifdef __WXOSX_MAC__
offsetx = (width - 18) / 2;
offsety = (height - 18) / 2;
#else
offsetx = (width - check_off.GetSize().x) / 2;
offsety = (height - check_off.GetSize().y) / 2;
#endif // __WXOSX_MAC__
#ifdef __WXOSX_MAC__
offsetx = (width - 18) / 2;
offsety = (height - 18) / 2;
#else
offsetx = (width - check_off.GetSize().x) / 2;
offsety = (height - check_off.GetSize().y) / 2;
#endif // __WXOSX_MAC__
dc.DrawBitmap(check_off, rect.x + offsetx, rect.y + offsety);
dc.DrawBitmap(check_off, rect.x + offsetx, rect.y + offsety);
}
}
}
wxSize GridCellSupportRenderer::GetBestSize(wxGrid& grid,
@ -2965,7 +2975,9 @@ void ObjectTablePanel::load_data()
break;
case coEnum:
if (col == ObjectGridTable::col_filaments) {
if (grid_row->model_volume_type != ModelVolumeType::NEGATIVE_VOLUME) {
if ((grid_row->model_volume_type != ModelVolumeType::NEGATIVE_VOLUME) && \
(grid_row->model_volume_type != ModelVolumeType::SUPPORT_BLOCKER) && \
(grid_row->model_volume_type != ModelVolumeType::SUPPORT_ENFORCER)) {
GridCellFilamentsEditor* filament_editor = new GridCellFilamentsEditor(grid_col->choices, false, &m_color_bitmaps);
m_object_grid->SetCellEditor(row, col, filament_editor);
m_object_grid->SetCellRenderer(row, col, new GridCellFilamentsRenderer());