From 07a637d35a61db3cb80174b7255fbe354c6e9b0e Mon Sep 17 00:00:00 2001 From: Ocraftyone Date: Mon, 27 Nov 2023 07:02:43 -0500 Subject: [PATCH] Filament ComboBox editor updates -Add show drop down feature to ObjectTable -Call finish editing when ComboBox is closed in ObjectList --- src/slic3r/GUI/GUI_ObjectList.cpp | 2 ++ src/slic3r/GUI/GUI_ObjectTable.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 5a50df455c..aefad7e1ba 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -5486,9 +5486,11 @@ void ObjectList::ItemValueChanged(wxDataViewEvent &event) // Here the last active column is forgotten, so when leaving the editing mode, the next mouse click will not enter the editing mode of the newly selected column. void ObjectList::OnEditingStarted(wxDataViewEvent &event) { + // Orca: Automatically show drop down on editing start and finish editing when the combobox is closed if (event.GetColumn() == colFilament) { ::ComboBox*c = static_cast<::ComboBox *>(event.GetDataViewColumn()->GetRenderer()->GetEditorCtrl()); c->ToggleDropDown(); + c->Bind(wxEVT_COMBOBOX_CLOSEUP, [event](wxCommandEvent& evt){ event.GetDataViewColumn()->GetRenderer()->FinishEditing(); }); } #ifdef __WXMSW__ m_last_selected_column = -1; diff --git a/src/slic3r/GUI/GUI_ObjectTable.cpp b/src/slic3r/GUI/GUI_ObjectTable.cpp index 35320a9c4d..c23c871395 100644 --- a/src/slic3r/GUI/GUI_ObjectTable.cpp +++ b/src/slic3r/GUI/GUI_ObjectTable.cpp @@ -240,6 +240,9 @@ void GridCellFilamentsEditor::BeginEdit(int row, int col, wxGrid* grid) Combo()->SetFocus(); + // Orca: Show dropdown on editing start + Combo()->ToggleDropDown(); + #ifdef __WXOSX_COCOA__ // This is a work around for the combobox being simply dismissed when a // choice is made in it under OS X. The bug is almost certainly due to a @@ -432,6 +435,9 @@ void GridCellChoiceEditor::BeginEdit(int row, int col, wxGrid *grid) Combo()->SetFocus(); + // Orca: Show dropdown on editing start + Combo()->ToggleDropDown(); + #ifdef __WXOSX_COCOA__ // This is a work around for the combobox being simply dismissed when a // choice is made in it under OS X. The bug is almost certainly due to a @@ -528,7 +534,7 @@ void GridCellComboBoxRenderer::Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(wxBrush(attr.GetBackgroundColour())); dc.DrawRectangle(rect); - dc.DrawBitmap(bitmap->GetBitmapFor(dc.GetWindow()), wxPoint(rect.x + offset_x, rect.y + offset_y)); //TODO: determine if this way of getting bitmap works well + dc.DrawBitmap(bitmap->GetBitmapFor(dc.GetWindow()), 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); }