mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-10 16:27:54 -06:00
FIX:update objecttable layout
Change-Id: I759283fab3dff03671282b4fcff9d6caf6de51db
This commit is contained in:
parent
65393b8f73
commit
ad311a66d6
4 changed files with 498 additions and 122 deletions
|
@ -73,16 +73,27 @@ void GridCellIconRenderer::Draw(wxGrid& grid,
|
||||||
//not changed
|
//not changed
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!table->m_icon_col_width) {
|
//if (!table->m_icon_col_width) {
|
||||||
table->m_icon_row_height = grid.GetRowSize(row);
|
table->m_icon_row_height = grid.GetRowSize(row);
|
||||||
table->m_icon_col_width = grid.GetColSize(col);
|
table->m_icon_col_width = grid.GetColSize(col);
|
||||||
}
|
//}
|
||||||
wxBitmap& bitmap = table->get_undo_bitmap();
|
wxBitmap& bitmap = table->get_undo_bitmap();
|
||||||
int bitmap_width = bitmap.GetWidth();
|
int bitmap_width = bitmap.GetWidth();
|
||||||
int bitmap_height = bitmap.GetHeight();
|
int bitmap_height = bitmap.GetHeight();
|
||||||
int offset_x = (table->m_icon_col_width - bitmap_width)/2;
|
int offset_x = (table->m_icon_col_width - bitmap_width)/2;
|
||||||
int offset_y = (table->m_icon_row_height - bitmap_height)/2;
|
int offset_y = (table->m_icon_row_height - bitmap_height)/2;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __WXOSX_COCOA__
|
||||||
|
auto lock_pos = wxPoint(rect.x + offset_x, rect.y + offset_y);
|
||||||
|
auto left = (28 - 12) / 2;
|
||||||
|
auto top = (32 - 12) / 2;
|
||||||
|
lock_pos.x += left;
|
||||||
|
lock_pos.y += top;
|
||||||
|
dc.DrawBitmap(bitmap, lock_pos);
|
||||||
|
#else
|
||||||
dc.DrawBitmap(bitmap, wxPoint(rect.x + offset_x, rect.y + offset_y));
|
dc.DrawBitmap(bitmap, wxPoint(rect.x + offset_x, rect.y + offset_y));
|
||||||
|
#endif
|
||||||
|
|
||||||
//dc.SetPen(*wxGREEN_PEN);
|
//dc.SetPen(*wxGREEN_PEN);
|
||||||
//dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
//dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||||
|
@ -148,17 +159,15 @@ void GridCellFilamentsEditor::Create(wxWindow* parent,
|
||||||
|
|
||||||
if ( !m_allowOthers )
|
if ( !m_allowOthers )
|
||||||
style |= wxCB_READONLY;
|
style |= wxCB_READONLY;
|
||||||
wxBitmapComboBox *bitmap_combo = new wxBitmapComboBox(parent, id, wxEmptyString,
|
::ComboBox *bitmap_combo = new ComboBox(parent, id, wxEmptyString,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxSize(((*m_icons)[0])->GetWidth() + 10, -1), 0, nullptr, CB_NO_DROP_ICON | CB_NO_TEXT | wxCB_READONLY);
|
||||||
m_choices,
|
|
||||||
style);
|
|
||||||
if (m_icons) {
|
if (m_icons) {
|
||||||
int array_count = m_choices.GetCount();
|
int array_count = m_choices.GetCount();
|
||||||
int icon_count = m_icons->size();
|
int icon_count = m_icons->size();
|
||||||
for (int i = 0; i < array_count; i++)
|
for (int i = 0; i < array_count; i++)
|
||||||
{
|
{
|
||||||
wxBitmap* bitmap = (i < icon_count) ? (*m_icons)[i] : (*m_icons)[0];
|
wxBitmap* bitmap = (i < icon_count) ? (*m_icons)[i] : (*m_icons)[0];
|
||||||
bitmap_combo->SetItemBitmap(i, *bitmap);
|
bitmap_combo->Append(m_choices[i], *bitmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_control = bitmap_combo;
|
m_control = bitmap_combo;
|
||||||
|
@ -214,7 +223,10 @@ void GridCellFilamentsEditor::BeginEdit(int row, int col, wxGrid* grid)
|
||||||
}
|
}
|
||||||
//m_value = grid->GetTable()->GetValue(row, col);
|
//m_value = grid->GetTable()->GetValue(row, col);
|
||||||
|
|
||||||
Reset(); // this updates combo box to correspond to m_value
|
//Reset(); // this updates combo box to correspond to m_value
|
||||||
|
int pos = Combo()->FindString(m_value);
|
||||||
|
if (pos == wxNOT_FOUND) pos = 0;
|
||||||
|
Combo()->SetSelection(pos);
|
||||||
|
|
||||||
Combo()->SetFocus();
|
Combo()->SetFocus();
|
||||||
|
|
||||||
|
@ -223,7 +235,7 @@ void GridCellFilamentsEditor::BeginEdit(int row, int col, wxGrid* grid)
|
||||||
// choice is made in it under OS X. The bug is almost certainly due to a
|
// choice is made in it under OS X. The bug is almost certainly due to a
|
||||||
// problem in focus events generation logic but it's not obvious to fix and
|
// problem in focus events generation logic but it's not obvious to fix and
|
||||||
// for now this at least allows to use wxGrid.
|
// for now this at least allows to use wxGrid.
|
||||||
Combo()->Popup();
|
//Combo()->Popup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (evtHandler)
|
if (evtHandler)
|
||||||
|
@ -254,7 +266,6 @@ bool GridCellFilamentsEditor::EndEdit(int WXUNUSED(row),
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxGridActivationResult GridCellFilamentsEditor::TryActivate(int row, int col, wxGrid* grid, const wxGridActivationSource& actSource)
|
wxGridActivationResult GridCellFilamentsEditor::TryActivate(int row, int col, wxGrid* grid, const wxGridActivationSource& actSource)
|
||||||
{
|
{
|
||||||
ObjectGridTable *table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
|
ObjectGridTable *table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
|
||||||
|
@ -305,56 +316,223 @@ void GridCellFilamentsEditor::DoActivate(int row, int col, wxGrid* grid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
void GridCellFilamentsRenderer::Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, const wxRect &rect, int row, int col, bool isSelected)
|
||||||
// GridCellFilamentsRenderer
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
void GridCellFilamentsRenderer::Draw(wxGrid& grid,
|
|
||||||
wxGridCellAttr& attr,
|
|
||||||
wxDC& dc,
|
|
||||||
const wxRect& rect,
|
|
||||||
int row, int col,
|
|
||||||
bool isSelected)
|
|
||||||
{
|
{
|
||||||
ObjectGridTable *table = dynamic_cast<ObjectGridTable *>(grid.GetTable());
|
ObjectGridTable *table = dynamic_cast<ObjectGridTable *>(grid.GetTable());
|
||||||
wxRect text_rect = rect;
|
wxRect text_rect = rect;
|
||||||
|
|
||||||
if (table) {
|
if (table) {
|
||||||
ObjectGridTable::ObjectGridCol* grid_col = table->get_grid_col(col);
|
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
|
||||||
ObjectGridTable::ObjectGridRow* grid_row = table->get_grid_row(row - 1);
|
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
|
||||||
ConfigOptionInt& cur_option = dynamic_cast<ConfigOptionInt&>((*grid_row)[(ObjectGridTable::GridColType)col]);
|
ConfigOptionInt & cur_option = dynamic_cast<ConfigOptionInt &>((*grid_row)[(ObjectGridTable::GridColType) col]);
|
||||||
|
|
||||||
wxBitmap* bitmap = table->get_color_bitmap((cur_option.value >= 1)?cur_option.value-1:cur_option.value);
|
wxBitmap *bitmap = table->get_color_bitmap((cur_option.value >= 1) ? cur_option.value - 1 : cur_option.value);
|
||||||
int bitmap_width = bitmap->GetWidth();
|
int bitmap_width = bitmap->GetWidth();
|
||||||
int bitmap_height = bitmap->GetHeight();
|
int bitmap_height = bitmap->GetHeight();
|
||||||
int offset_x = grid_cell_border_width;
|
int offset_x = grid_cell_border_width;
|
||||||
int offset_y = (rect.height > bitmap_height)?(rect.height - bitmap_height)/2 : grid_cell_border_height;
|
int offset_y = (rect.height > bitmap_height) ? (rect.height - bitmap_height) / 2 : grid_cell_border_height;
|
||||||
|
|
||||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
dc.SetBrush(wxBrush(attr.GetBackgroundColour()));
|
dc.SetBrush(wxBrush(attr.GetBackgroundColour()));
|
||||||
dc.DrawRectangle(rect);
|
dc.DrawRectangle(rect);
|
||||||
dc.DrawBitmap(*bitmap, wxPoint(rect.x + offset_x, rect.y + offset_y));
|
dc.DrawBitmap(*bitmap, wxPoint(rect.x + offset_x, rect.y + offset_y));
|
||||||
text_rect.x += bitmap_width + grid_cell_border_width *2;
|
text_rect.x += bitmap_width + grid_cell_border_width * 2;
|
||||||
text_rect.width -= (bitmap_width + grid_cell_border_width *2);
|
text_rect.width -= (bitmap_width + grid_cell_border_width * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGridCellChoiceRenderer::Draw(grid, attr, dc, text_rect, row, col, isSelected);
|
wxGridCellChoiceRenderer::Draw(grid, attr, dc, text_rect, row, col, isSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize GridCellFilamentsRenderer::GetBestSize(wxGrid& grid,
|
wxSize GridCellFilamentsRenderer::GetBestSize(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, int WXUNUSED(row), int WXUNUSED(col))
|
||||||
wxGridCellAttr& attr,
|
|
||||||
wxDC& dc,
|
|
||||||
int WXUNUSED(row),
|
|
||||||
int WXUNUSED(col))
|
|
||||||
{
|
{
|
||||||
wxSize size{128, -1};
|
wxSize size{48, -1};
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
GridCellFilamentsRenderer *GridCellFilamentsRenderer::Clone() const
|
GridCellFilamentsRenderer *GridCellFilamentsRenderer::Clone() const { return new GridCellFilamentsRenderer(); }
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// GridCellFilamentsRenderer
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// GridCellChoiceEditor
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
GridCellChoiceEditor::GridCellChoiceEditor(const wxArrayString &choices)
|
||||||
|
: wxGridCellChoiceEditor(choices)
|
||||||
|
{}
|
||||||
|
|
||||||
|
GridCellChoiceEditor::GridCellChoiceEditor(size_t count, const wxString choices[])
|
||||||
|
: wxGridCellChoiceEditor(count, choices)
|
||||||
|
{}
|
||||||
|
|
||||||
|
wxGridCellEditor *GridCellChoiceEditor::Clone() const
|
||||||
{
|
{
|
||||||
return new GridCellFilamentsRenderer();
|
GridCellChoiceEditor *editor = new GridCellChoiceEditor;
|
||||||
|
editor->m_allowOthers = m_allowOthers;
|
||||||
|
editor->m_choices = m_choices;
|
||||||
|
|
||||||
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GridCellChoiceEditor::Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler)
|
||||||
|
{
|
||||||
|
int style = wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB | wxBORDER_NONE;
|
||||||
|
|
||||||
|
if (!m_allowOthers) style |= wxCB_READONLY;
|
||||||
|
::ComboBox *bitmap_combo = new ComboBox(parent, id, wxEmptyString, wxDefaultPosition, wxSize(100, -1), 0, nullptr, wxCB_READONLY);
|
||||||
|
bitmap_combo->SetFont(::Label::Body_12);
|
||||||
|
int array_count = m_choices.GetCount();
|
||||||
|
for (int i = 0; i < array_count; i++) {
|
||||||
|
bitmap_combo->Append(m_choices[i]);
|
||||||
|
}
|
||||||
|
m_control = bitmap_combo;
|
||||||
|
wxGridCellEditor::Create(parent, id, evtHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridCellChoiceEditor::SetSize(const wxRect &rect)
|
||||||
|
{
|
||||||
|
wxGridCellChoiceEditor::SetSize(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridCellChoiceEditor::OnComboCloseUp(wxCommandEvent &evt) { wxGridCellChoiceEditor::OnComboCloseUp(evt); }
|
||||||
|
|
||||||
|
void GridCellChoiceEditor::BeginEdit(int row, int col, wxGrid *grid)
|
||||||
|
{
|
||||||
|
wxGridCellEditorEvtHandler *evtHandler = NULL;
|
||||||
|
if (m_control) {
|
||||||
|
// This event handler is needed to properly dismiss the editor when the popup is closed
|
||||||
|
m_control->Bind(wxEVT_COMBOBOX_CLOSEUP, &GridCellChoiceEditor::OnComboCloseUp, this);
|
||||||
|
evtHandler = wxDynamicCast(m_control->GetEventHandler(), wxGridCellEditorEvtHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't immediately end if we get a kill focus event within BeginEdit
|
||||||
|
if (evtHandler) evtHandler->SetInSetFocus(true);
|
||||||
|
|
||||||
|
m_value = grid->GetTable()->GetValue(row, col);
|
||||||
|
|
||||||
|
// Reset(); // this updates combo box to correspond to m_value
|
||||||
|
int pos = Combo()->FindString(m_value);
|
||||||
|
if (pos == wxNOT_FOUND) pos = 0;
|
||||||
|
Combo()->SetSelection(pos);
|
||||||
|
|
||||||
|
Combo()->SetFocus();
|
||||||
|
|
||||||
|
#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
|
||||||
|
// problem in focus events generation logic but it's not obvious to fix and
|
||||||
|
// for now this at least allows to use wxGrid.
|
||||||
|
//Combo()->Popup();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (evtHandler) {
|
||||||
|
// When dropping down the menu, a kill focus event
|
||||||
|
// happens after this point, so we can't reset the flag yet.
|
||||||
|
#if !defined(__WXGTK20__)
|
||||||
|
evtHandler->SetInSetFocus(false);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GridCellChoiceEditor::EndEdit(int WXUNUSED(row), int WXUNUSED(col), const wxGrid *WXUNUSED(grid), const wxString &WXUNUSED(oldval), wxString *newval)
|
||||||
|
{
|
||||||
|
const wxString value = Combo()->GetValue();
|
||||||
|
if (value == m_value) return false;
|
||||||
|
|
||||||
|
m_value = value;
|
||||||
|
|
||||||
|
if (newval) *newval = value;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxGridActivationResult GridCellChoiceEditor::TryActivate(int row, int col, wxGrid *grid, const wxGridActivationSource &actSource)
|
||||||
|
{
|
||||||
|
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
|
||||||
|
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
|
||||||
|
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
|
||||||
|
|
||||||
|
if (actSource.GetOrigin() == wxGridActivationSource::Key) {
|
||||||
|
const wxKeyEvent &key_event = actSource.GetKeyEvent();
|
||||||
|
int keyCode = key_event.GetKeyCode();
|
||||||
|
wxString choice;
|
||||||
|
|
||||||
|
int digital_value = keyCode - '0';
|
||||||
|
if ((digital_value >= 1) && (digital_value <= 9))
|
||||||
|
m_cached_value = digital_value;
|
||||||
|
else
|
||||||
|
m_cached_value = -1;
|
||||||
|
|
||||||
|
if (m_cached_value != -1) {
|
||||||
|
if (m_cached_value <= grid_col->choice_count) {
|
||||||
|
choice = grid_col->choices[m_cached_value - 1];
|
||||||
|
return wxGridActivationResult::DoChange(choice);
|
||||||
|
} else {
|
||||||
|
return wxGridActivationResult::DoNothing();
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
return wxGridActivationResult::DoNothing();
|
||||||
|
} else {
|
||||||
|
m_cached_value = -1;
|
||||||
|
return wxGridActivationResult::DoEdit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridCellChoiceEditor::DoActivate(int row, int col, wxGrid *grid)
|
||||||
|
{
|
||||||
|
if (m_cached_value != -1) {
|
||||||
|
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
|
||||||
|
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
|
||||||
|
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
|
||||||
|
if (m_cached_value <= grid_col->choice_count) {
|
||||||
|
wxString choice = grid_col->choices[m_cached_value - 1];
|
||||||
|
table->SetValue(row, col, choice);
|
||||||
|
// Combo()->SetValue(choice);
|
||||||
|
}
|
||||||
|
m_cached_value = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridCellComboBoxRenderer::Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, const wxRect &rect, int row, int col, bool isSelected)
|
||||||
|
{
|
||||||
|
ObjectGridTable *table = dynamic_cast<ObjectGridTable *>(grid.GetTable());
|
||||||
|
wxRect text_rect = rect;
|
||||||
|
|
||||||
|
if (table) {
|
||||||
|
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
|
||||||
|
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
|
||||||
|
ConfigOptionInt & cur_option = dynamic_cast<ConfigOptionInt &>((*grid_row)[(ObjectGridTable::GridColType) col]);
|
||||||
|
|
||||||
|
wxBitmap *bitmap = table->get_color_bitmap((cur_option.value >= 1) ? cur_option.value - 1 : cur_option.value);
|
||||||
|
int bitmap_width = bitmap->GetWidth();
|
||||||
|
int bitmap_height = bitmap->GetHeight();
|
||||||
|
int offset_x = grid_cell_border_width;
|
||||||
|
int offset_y = (rect.height > bitmap_height) ? (rect.height - bitmap_height) / 2 : grid_cell_border_height;
|
||||||
|
|
||||||
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
|
dc.SetBrush(wxBrush(attr.GetBackgroundColour()));
|
||||||
|
dc.DrawRectangle(rect);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxGridCellChoiceRenderer::Draw(grid, attr, dc, text_rect, row, col, isSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSize GridCellComboBoxRenderer::GetBestSize(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, int WXUNUSED(row), int WXUNUSED(col))
|
||||||
|
{
|
||||||
|
wxSize size{48, -1};
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
GridCellComboBoxRenderer *GridCellComboBoxRenderer::Clone() const { return new GridCellComboBoxRenderer(); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxGridCellSupportEditor
|
// wxGridCellSupportEditor
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -1497,6 +1675,7 @@ wxString ObjectGridTable::convert_filament_string(int index, wxString& filament_
|
||||||
else
|
else
|
||||||
result_str = filament_str;
|
result_str = filament_str;
|
||||||
|
|
||||||
|
result_str = "";
|
||||||
return result_str;
|
return result_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1515,12 +1694,12 @@ void ObjectGridTable::init_cols(ObjectGrid *object_grid)
|
||||||
|
|
||||||
|
|
||||||
// printable for object
|
// printable for object
|
||||||
ObjectGridCol* col = new ObjectGridCol(coBool, "printable", ObjectGridTable::category_all, true, false, true, false, wxALIGN_CENTRE);
|
ObjectGridCol *col = new ObjectGridCol(coBool, "printable", ObjectGridTable::category_all, true, false, true, false, wxALIGN_CENTRE);
|
||||||
col->size = object_grid->GetTextExtent(L("Printable")).x;
|
col->size = object_grid->GetTextExtent(L("Printable")).x;
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
// reset icon for printable
|
// reset icon for printable
|
||||||
col = new ObjectGridCol(coBool, "printable_reset", ObjectGridTable::category_all, true, true, false, false, wxALIGN_CENTRE);
|
col = new ObjectGridCol(coBool, "printable_reset", ObjectGridTable::category_all, true, true, false, false, wxALIGN_LEFT);
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
//first column for plate_index
|
//first column for plate_index
|
||||||
|
@ -1532,7 +1711,7 @@ void ObjectGridTable::init_cols(ObjectGrid *object_grid)
|
||||||
m_col_data.push_back(col);*/
|
m_col_data.push_back(col);*/
|
||||||
|
|
||||||
//3th column: for object/volume name
|
//3th column: for object/volume name
|
||||||
col = new ObjectGridCol(coString, "name", ObjectGridTable::category_all, false, false, true, false, wxALIGN_CENTRE);
|
col = new ObjectGridCol(coString, "name", ObjectGridTable::category_all, false, false, true, false, wxALIGN_LEFT);
|
||||||
col->size = 200;
|
col->size = 200;
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
|
@ -1549,21 +1728,21 @@ void ObjectGridTable::init_cols(ObjectGrid *object_grid)
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
//object layer height
|
//object layer height
|
||||||
col = new ObjectGridCol(coFloat, "layer_height", L("Quality"), true, false, true, true, wxALIGN_CENTRE);
|
col = new ObjectGridCol(coFloat, "layer_height", L("Quality"), true, false, true, true, wxALIGN_CENTRE);
|
||||||
col->size = object_grid->GetTextExtent(L("Layer height")).x;
|
col->size = object_grid->GetTextExtent(L("Layer height")).x - 28;
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
//reset icon for extruder_id
|
//reset icon for extruder_id
|
||||||
col = new ObjectGridCol(coFloat, "layer_height_reset", L("Quality"), true, true, false, false, wxALIGN_CENTRE);
|
col = new ObjectGridCol(coFloat, "layer_height_reset", L("Quality"), true, true, false, false, wxALIGN_LEFT);
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
//object/volume perimeters
|
//object/volume perimeters
|
||||||
col = new ObjectGridCol(coInt, "wall_loops", L("Strength"), false, false, true, true, wxALIGN_CENTRE);
|
col = new ObjectGridCol(coInt, "wall_loops", L("Strength"), false, false, true, true, wxALIGN_CENTRE);
|
||||||
col->size = object_grid->GetTextExtent(L("Wall loops")).x;
|
col->size = object_grid->GetTextExtent(L("Wall loops")).x;
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
//reset icon for perimeters
|
//reset icon for perimeters
|
||||||
col = new ObjectGridCol(coInt, "wall_loops_reset", L("Strength"), false, true, false, false, wxALIGN_CENTRE);
|
col = new ObjectGridCol(coInt, "wall_loops_reset", L("Strength"), false, true, false, false, wxALIGN_LEFT);
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
//object/volume fill density
|
//object/volume fill density
|
||||||
|
@ -1572,7 +1751,7 @@ void ObjectGridTable::init_cols(ObjectGrid *object_grid)
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
//reset icon for fill density
|
//reset icon for fill density
|
||||||
col = new ObjectGridCol(coPercent, "fill_density_reset", L("Strength"), false, true, false, false, wxALIGN_CENTRE);
|
col = new ObjectGridCol(coPercent, "fill_density_reset", L("Strength"), false, true, false, false, wxALIGN_LEFT);
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
//support material
|
//support material
|
||||||
|
@ -1585,23 +1764,23 @@ void ObjectGridTable::init_cols(ObjectGrid *object_grid)
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
//Bed Adhesion
|
//Bed Adhesion
|
||||||
col = new ObjectGridCol(coEnum, "brim_type", L("Support"), true, false, true, true, wxALIGN_CENTRE);
|
col = new ObjectGridCol(coEnum, "brim_type", L("Support"), true, false, true, true, wxALIGN_LEFT);
|
||||||
col->size = object_grid->GetTextExtent(L("Auto Brim")).x + 8; //add 8 for border
|
col->size = object_grid->GetTextExtent(L("Auto Brim")).x + 8; //add 8 for border
|
||||||
col->choices = brim_choices;
|
col->choices = brim_choices;
|
||||||
col->choice_count = WXSIZEOF(brim_choices);
|
col->choice_count = WXSIZEOF(brim_choices);
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
//reset icon for Bed Adhesion
|
//reset icon for Bed Adhesion
|
||||||
col = new ObjectGridCol(coEnum, "brim_type_reset", L("Support"), true, true, false, false, wxALIGN_CENTRE);
|
col = new ObjectGridCol(coEnum, "brim_type_reset", L("Support"), true, true, false, false, wxALIGN_LEFT);
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
//object/volume speed
|
//object/volume speed
|
||||||
col = new ObjectGridCol(coFloat, "inner_wall_speed", L("Speed"), false, false, true, true, wxALIGN_CENTRE);
|
col = new ObjectGridCol(coFloat, "inner_wall_speed", L("Speed"), false, false, true, true, wxALIGN_LEFT);
|
||||||
col->size = object_grid->GetTextExtent(L("Inner wall speed")).x;
|
col->size = object_grid->GetTextExtent(L("Inner wall speed")).x;
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
//reset icon for speed
|
//reset icon for speed
|
||||||
col = new ObjectGridCol(coFloat, "inner_wall_speed_reset", L("Speed"), false, true, false, false, wxALIGN_CENTRE);
|
col = new ObjectGridCol(coFloat, "inner_wall_speed_reset", L("Speed"), false, true, false, false, wxALIGN_LEFT);
|
||||||
m_col_data.push_back(col);
|
m_col_data.push_back(col);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1922,7 +2101,7 @@ void ObjectGridTable::update_row_properties()
|
||||||
switch (grid_col->type)
|
switch (grid_col->type)
|
||||||
{
|
{
|
||||||
case coString:
|
case coString:
|
||||||
grid_table->SetCellEditor(row, col, new wxGridCellAutoWrapStringEditor());
|
grid_table->SetCellEditor(row, col, new GridCellTextEditor());
|
||||||
grid_table->SetCellRenderer(row, col, new wxGridCellAutoWrapStringRenderer());
|
grid_table->SetCellRenderer(row, col, new wxGridCellAutoWrapStringRenderer());
|
||||||
break;
|
break;
|
||||||
case coBool:
|
case coBool:
|
||||||
|
@ -1932,7 +2111,7 @@ void ObjectGridTable::update_row_properties()
|
||||||
grid_table->SetCellRenderer(row, col, new wxGridCellBoolRenderer());
|
grid_table->SetCellRenderer(row, col, new wxGridCellBoolRenderer());
|
||||||
break;
|
break;
|
||||||
case coInt:
|
case coInt:
|
||||||
grid_table->SetCellEditor(row, col, new wxGridCellNumberEditor());
|
grid_table->SetCellEditor(row, col, new GridCellTextEditor());
|
||||||
grid_table->SetCellRenderer(row, col, new wxGridCellNumberRenderer());
|
grid_table->SetCellRenderer(row, col, new wxGridCellNumberRenderer());
|
||||||
break;
|
break;
|
||||||
case coEnum:
|
case coEnum:
|
||||||
|
@ -1940,25 +2119,20 @@ void ObjectGridTable::update_row_properties()
|
||||||
GridCellFilamentsEditor *filament_editor = new GridCellFilamentsEditor(grid_col->choice_count, grid_col->choices, false, &m_panel->m_color_bitmaps);
|
GridCellFilamentsEditor *filament_editor = new GridCellFilamentsEditor(grid_col->choice_count, grid_col->choices, false, &m_panel->m_color_bitmaps);
|
||||||
grid_table->SetCellEditor(row, col, filament_editor);
|
grid_table->SetCellEditor(row, col, filament_editor);
|
||||||
grid_table->SetCellRenderer(row, col, new GridCellFilamentsRenderer());
|
grid_table->SetCellRenderer(row, col, new GridCellFilamentsRenderer());
|
||||||
}
|
} else {
|
||||||
else
|
GridCellChoiceEditor *combo_editor = new GridCellChoiceEditor(grid_col->choice_count, grid_col->choices);
|
||||||
grid_table->SetCellEditor(row, col, new wxGridCellChoiceEditor(grid_col->choice_count, grid_col->choices));
|
grid_table->SetCellEditor(row, col, combo_editor);
|
||||||
|
grid_table->SetCellRenderer(row, col, new wxGridCellChoiceRenderer());
|
||||||
|
//new wxGridCellChoiceEditor(grid_col->choice_count, grid_col->choices));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case coFloat:
|
case coFloat:
|
||||||
grid_table->SetCellEditor(row, col, new wxGridCellFloatEditor(6,2));
|
grid_table->SetCellEditor(row, col, new GridCellTextEditor());
|
||||||
grid_table->SetCellRenderer(row, col, new wxGridCellFloatRenderer(6,2));
|
grid_table->SetCellRenderer(row, col, new wxGridCellFloatRenderer(6,2));
|
||||||
break;
|
break;
|
||||||
case coPercent:
|
case coPercent:
|
||||||
{
|
{
|
||||||
/*wxGridCellFloatEditor *float_editor = new wxGridCellFloatEditor(6,2);
|
grid_table->SetCellEditor(row, col, new GridCellTextEditor());
|
||||||
wxFloatingPointValidator<float> *float_validator = new wxFloatingPointValidator<float>(3, nullptr, wxNUM_VAL_ZERO_AS_BLANK);
|
|
||||||
float_validator->SetRange(0.f, 100.f);
|
|
||||||
float_editor->SetValidator(*float_validator);
|
|
||||||
|
|
||||||
if (rows < 3)
|
|
||||||
m_object_grid->SetCellEditor(row, col, float_editor);
|
|
||||||
else*/
|
|
||||||
grid_table->SetCellEditor(row, col, new wxGridCellFloatEditor(6,2));
|
|
||||||
grid_table->SetCellRenderer(row, col, new wxGridCellFloatRenderer(6,2));
|
grid_table->SetCellRenderer(row, col, new wxGridCellFloatRenderer(6,2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2402,7 +2576,7 @@ ObjectTablePanel::ObjectTablePanel( wxWindow* parent, wxWindowID id, const wxPoi
|
||||||
//m_object_grid->AssignTable(m_object_grid_table);
|
//m_object_grid->AssignTable(m_object_grid_table);
|
||||||
|
|
||||||
|
|
||||||
m_side_window = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(460),FromDIP(480)), wxVSCROLL);
|
m_side_window = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(440),FromDIP(480)), wxVSCROLL);
|
||||||
m_side_window->SetScrollRate( 0, 5 );
|
m_side_window->SetScrollRate( 0, 5 );
|
||||||
m_page_sizer = new wxBoxSizer(wxVERTICAL);
|
m_page_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
m_page_top_sizer = new wxBoxSizer(wxHORIZONTAL);
|
m_page_top_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
@ -2464,7 +2638,7 @@ ObjectTablePanel::ObjectTablePanel( wxWindow* parent, wxWindowID id, const wxPoi
|
||||||
|
|
||||||
int ObjectTablePanel::init_bitmap()
|
int ObjectTablePanel::init_bitmap()
|
||||||
{
|
{
|
||||||
m_undo_bitmap = create_scaled_bitmap("lock_normal", nullptr, 24);
|
m_undo_bitmap = create_scaled_bitmap("lock_normal", nullptr, 18);
|
||||||
m_color_bitmaps = get_extruder_color_icons();
|
m_color_bitmaps = get_extruder_color_icons();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2535,6 +2709,8 @@ void ObjectTablePanel::load_data()
|
||||||
//construct tables
|
//construct tables
|
||||||
//m_object_grid->CreateGrid(rows, cols, wxGridSelectCells);
|
//m_object_grid->CreateGrid(rows, cols, wxGridSelectCells);
|
||||||
#if HAS_COL_HEADER
|
#if HAS_COL_HEADER
|
||||||
|
m_object_grid->SetColLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
|
||||||
|
|
||||||
m_object_grid->SetColLabelValue(ObjectGridTable::col_printable, L("Printable"));
|
m_object_grid->SetColLabelValue(ObjectGridTable::col_printable, L("Printable"));
|
||||||
m_object_grid->SetColLabelValue(ObjectGridTable::col_printable_reset, "");
|
m_object_grid->SetColLabelValue(ObjectGridTable::col_printable_reset, "");
|
||||||
m_object_grid->SetColLabelValue(ObjectGridTable::col_plate_index, L("Plate"));
|
m_object_grid->SetColLabelValue(ObjectGridTable::col_plate_index, L("Plate"));
|
||||||
|
@ -2556,12 +2732,16 @@ void ObjectTablePanel::load_data()
|
||||||
m_object_grid->SetColLabelValue(ObjectGridTable::col_speed_perimeter_reset, "");
|
m_object_grid->SetColLabelValue(ObjectGridTable::col_speed_perimeter_reset, "");
|
||||||
m_object_grid->SetLabelFont(Label::Head_13);
|
m_object_grid->SetLabelFont(Label::Head_13);
|
||||||
m_object_grid->SetLabelTextColour(wxColour(0x30,0x3a,0x3c));
|
m_object_grid->SetLabelTextColour(wxColour(0x30,0x3a,0x3c));
|
||||||
m_object_grid->SetLabelBackgroundColour(wxColour(0xff,0xff,0xff));
|
m_object_grid->SetLabelBackgroundColour(wxColour(0xff, 0xff, 0xff));
|
||||||
#else
|
#else
|
||||||
m_object_grid->HideColLabels();
|
m_object_grid->HideColLabels();
|
||||||
#endif
|
#endif
|
||||||
m_object_grid->HideRowLabels();
|
m_object_grid->HideRowLabels();
|
||||||
m_object_grid->EnableGridLines (true);
|
|
||||||
|
m_object_grid->EnableGridLines (false);
|
||||||
|
m_object_grid->EnableDragColSize(false);
|
||||||
|
m_object_grid->EnableDragGridSize(false);
|
||||||
|
m_object_grid->EnableDragRowSize(false);
|
||||||
|
|
||||||
/*set the first row as label*/
|
/*set the first row as label*/
|
||||||
//format
|
//format
|
||||||
|
@ -2570,7 +2750,7 @@ void ObjectTablePanel::load_data()
|
||||||
//attr->SetBackgroundColour(wxColour(191, 191, 255));
|
//attr->SetBackgroundColour(wxColour(191, 191, 255));
|
||||||
attr->SetBackgroundColour(*wxWHITE);
|
attr->SetBackgroundColour(*wxWHITE);
|
||||||
attr->SetTextColour(*wxBLACK);
|
attr->SetTextColour(*wxBLACK);
|
||||||
attr->SetAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
|
attr->SetAlignment(wxALIGN_LEFT, wxALIGN_CENTRE);
|
||||||
attr->SetReadOnly(true);
|
attr->SetReadOnly(true);
|
||||||
m_object_grid->SetRowAttr (0, attr);
|
m_object_grid->SetRowAttr (0, attr);
|
||||||
#if HAS_COL_HEADER
|
#if HAS_COL_HEADER
|
||||||
|
@ -2580,7 +2760,7 @@ void ObjectTablePanel::load_data()
|
||||||
m_object_grid->SetCellSize(0, ObjectGridTable::col_printable, 1, 2);
|
m_object_grid->SetCellSize(0, ObjectGridTable::col_printable, 1, 2);
|
||||||
//m_object_grid->SetCellSize(0, ObjectGridTable::col_assemble_name, 1, 1);
|
//m_object_grid->SetCellSize(0, ObjectGridTable::col_assemble_name, 1, 1);
|
||||||
m_object_grid->SetCellSize(0, ObjectGridTable::col_name, 1, 1);
|
m_object_grid->SetCellSize(0, ObjectGridTable::col_name, 1, 1);
|
||||||
m_object_grid->SetCellSize(0, ObjectGridTable::col_filaments, 1, 2);
|
m_object_grid->SetCellSize(0, ObjectGridTable::col_filaments, 1, 1);
|
||||||
m_object_grid->SetCellSize(0, ObjectGridTable::col_layer_height, 1, 2);
|
m_object_grid->SetCellSize(0, ObjectGridTable::col_layer_height, 1, 2);
|
||||||
m_object_grid->SetCellSize(0, ObjectGridTable::col_wall_loops, 1, 2);
|
m_object_grid->SetCellSize(0, ObjectGridTable::col_wall_loops, 1, 2);
|
||||||
m_object_grid->SetCellSize(0, ObjectGridTable::col_fill_density, 1, 2);
|
m_object_grid->SetCellSize(0, ObjectGridTable::col_fill_density, 1, 2);
|
||||||
|
@ -2588,14 +2768,8 @@ void ObjectTablePanel::load_data()
|
||||||
m_object_grid->SetCellSize(0, ObjectGridTable::col_brim_type, 1, 2);
|
m_object_grid->SetCellSize(0, ObjectGridTable::col_brim_type, 1, 2);
|
||||||
m_object_grid->SetCellSize(0, ObjectGridTable::col_speed_perimeter, 1, 2);
|
m_object_grid->SetCellSize(0, ObjectGridTable::col_speed_perimeter, 1, 2);
|
||||||
|
|
||||||
//m_object_grid->SetSelectionForeground(wxColour(255, 0, 0));
|
//m_object_grid->SetSelectionForeground(wxColour(0xDB,0xFD,0xE7));
|
||||||
//m_object_grid->SetSelectionBackground(wxColour(0, 255, 0));
|
//m_object_grid->SetSelectionBackground(*wxWHITE);
|
||||||
//wxGridCellAutoWrapStringEditor* string_editor = new wxGridCellAutoWrapStringEditor();
|
|
||||||
//wxGridCellBoolEditor* bool_editor = new wxGridCellBoolEditor();
|
|
||||||
//wxGridCellFloatEditor* float_editor = new wxGridCellFloatEditor();
|
|
||||||
//wxGridCellNumberEditor* number_editor = new wxGridCellNumberEditor();
|
|
||||||
//wxGridCellChoiceEditor* choice_editor = new wxGridCellChoiceEditor();
|
|
||||||
//wxGridCellEnumEditor* enum_editor = new wxGridCellEnumEditor();
|
|
||||||
|
|
||||||
for (int col = 0; col < cols; col++)
|
for (int col = 0; col < cols; col++)
|
||||||
{
|
{
|
||||||
|
@ -2627,7 +2801,7 @@ void ObjectTablePanel::load_data()
|
||||||
switch (grid_col->type)
|
switch (grid_col->type)
|
||||||
{
|
{
|
||||||
case coString:
|
case coString:
|
||||||
m_object_grid->SetCellEditor(row, col, new wxGridCellAutoWrapStringEditor());
|
m_object_grid->SetCellEditor(row, col, new GridCellTextEditor());
|
||||||
m_object_grid->SetCellRenderer(row, col, new wxGridCellAutoWrapStringRenderer());
|
m_object_grid->SetCellRenderer(row, col, new wxGridCellAutoWrapStringRenderer());
|
||||||
break;
|
break;
|
||||||
case coBool:
|
case coBool:
|
||||||
|
@ -2637,34 +2811,27 @@ void ObjectTablePanel::load_data()
|
||||||
m_object_grid->SetCellRenderer(row, col, new wxGridCellBoolRenderer());
|
m_object_grid->SetCellRenderer(row, col, new wxGridCellBoolRenderer());
|
||||||
break;
|
break;
|
||||||
case coInt:
|
case coInt:
|
||||||
m_object_grid->SetCellEditor(row, col, new wxGridCellNumberEditor());
|
m_object_grid->SetCellEditor(row, col, new GridCellTextEditor());
|
||||||
m_object_grid->SetCellRenderer(row, col, new wxGridCellNumberRenderer());
|
m_object_grid->SetCellRenderer(row, col, new wxGridCellNumberRenderer());
|
||||||
break;
|
break;
|
||||||
case coEnum:
|
case coEnum:
|
||||||
if (col == ObjectGridTable::col_filaments) {
|
if (col == ObjectGridTable::col_filaments) {
|
||||||
GridCellFilamentsEditor *filament_editor = new GridCellFilamentsEditor(grid_col->choice_count, grid_col->choices, false, &m_color_bitmaps);
|
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->SetCellEditor(row, col, filament_editor);
|
||||||
//m_object_grid->SetCellEditor(row, col, new wxGridCellChoiceEditor(grid_col->choice_count, grid_col->choices));
|
|
||||||
m_object_grid->SetCellRenderer(row, col, new GridCellFilamentsRenderer());
|
m_object_grid->SetCellRenderer(row, col, new GridCellFilamentsRenderer());
|
||||||
|
} 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());
|
||||||
}
|
}
|
||||||
else
|
|
||||||
m_object_grid->SetCellEditor(row, col, new wxGridCellChoiceEditor(grid_col->choice_count, grid_col->choices));
|
|
||||||
break;
|
break;
|
||||||
case coFloat:
|
case coFloat:
|
||||||
m_object_grid->SetCellEditor(row, col, new wxGridCellFloatEditor(6,2));
|
m_object_grid->SetCellEditor(row, col, new GridCellTextEditor());
|
||||||
m_object_grid->SetCellRenderer(row, col, new wxGridCellFloatRenderer(6,2));
|
m_object_grid->SetCellRenderer(row, col, new wxGridCellFloatRenderer(6,2));
|
||||||
break;
|
break;
|
||||||
case coPercent:
|
case coPercent:
|
||||||
{
|
{
|
||||||
/*wxGridCellFloatEditor *float_editor = new wxGridCellFloatEditor(6,2);
|
m_object_grid->SetCellEditor(row, col, new GridCellTextEditor());
|
||||||
wxFloatingPointValidator<float> *float_validator = new wxFloatingPointValidator<float>(3, nullptr, wxNUM_VAL_ZERO_AS_BLANK);
|
|
||||||
float_validator->SetRange(0.f, 100.f);
|
|
||||||
float_editor->SetValidator(*float_validator);
|
|
||||||
|
|
||||||
if (rows < 3)
|
|
||||||
m_object_grid->SetCellEditor(row, col, float_editor);
|
|
||||||
else*/
|
|
||||||
m_object_grid->SetCellEditor(row, col, new wxGridCellFloatEditor(6,2));
|
|
||||||
m_object_grid->SetCellRenderer(row, col, new wxGridCellFloatRenderer(6,2));
|
m_object_grid->SetCellRenderer(row, col, new wxGridCellFloatRenderer(6,2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2681,34 +2848,91 @@ void ObjectTablePanel::load_data()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_object_grid->Fit();
|
|
||||||
for (int i = 0; i < ObjectGridTable::col_max; i++)
|
for (int i = 0; i < ObjectGridTable::col_max; i++)
|
||||||
{
|
{
|
||||||
ObjectGridTable::ObjectGridCol *grid_col = m_object_grid_table->get_grid_col(i);
|
ObjectGridTable::ObjectGridCol *grid_col = m_object_grid_table->get_grid_col(i);
|
||||||
if (grid_col->size > 0) {
|
if (grid_col->size > 0) {
|
||||||
int fit_size1 = m_object_grid->GetColSize(i);
|
int fit_size1 = m_object_grid->GetColSize(i);
|
||||||
m_object_grid->SetColSize(i, grid_col->size);
|
m_object_grid->SetColSize(i, grid_col->size);
|
||||||
//if (grid_col->size < fit_size1) m_object_grid->SetColSize(i, grid_col->size);
|
}
|
||||||
|
}
|
||||||
|
m_object_grid->Fit();
|
||||||
|
|
||||||
|
for (int i = 0; i < ObjectGridTable::col_max; i++) {
|
||||||
|
switch (i) {
|
||||||
|
case ObjectGridTable::col_printable: {
|
||||||
|
m_object_grid->SetColSize(i, m_object_grid->GetColSize(i) - FromDIP(28));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//else {
|
case ObjectGridTable::col_printable_reset:
|
||||||
//adjust the left col
|
m_object_grid->SetColSize(i, FromDIP(28));
|
||||||
//int delta = grid_col->size - fit_size1;
|
break;
|
||||||
//grid_col = m_object_grid_table->get_grid_col(i - 1);
|
|
||||||
//int fit_size2 = m_object_grid->GetColSize(i-1);
|
case ObjectGridTable::col_name:
|
||||||
//grid_col->size = fit_size2 - delta;
|
m_object_grid->SetColSize(i, FromDIP(100));
|
||||||
//m_object_grid->SetColSize(i, grid_col->size);
|
break;
|
||||||
//}
|
|
||||||
|
case ObjectGridTable::col_filaments:
|
||||||
|
m_object_grid->SetColSize(i, FromDIP(52));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ObjectGridTable::col_filaments_reset:
|
||||||
|
m_object_grid->SetColSize(i, FromDIP(28));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ObjectGridTable::col_layer_height:
|
||||||
|
m_object_grid->SetColSize(i, m_object_grid->GetColSize(i) - FromDIP(28));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ObjectGridTable::col_layer_height_reset:
|
||||||
|
m_object_grid->SetColSize(i, FromDIP(28));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ObjectGridTable::col_wall_loops:
|
||||||
|
m_object_grid->SetColSize(i, m_object_grid->GetColSize(i) - FromDIP(28));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ObjectGridTable::col_wall_loops_reset:
|
||||||
|
m_object_grid->SetColSize(i, FromDIP(28));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ObjectGridTable::col_fill_density:
|
||||||
|
m_object_grid->SetColSize(i, m_object_grid->GetColSize(i) - FromDIP(28));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ObjectGridTable::col_fill_density_reset:
|
||||||
|
m_object_grid->SetColSize(i, FromDIP(28));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ObjectGridTable::col_enable_support:
|
||||||
|
m_object_grid->SetColSize(i, m_object_grid->GetColSize(i) - FromDIP(28));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ObjectGridTable::col_enable_support_reset:
|
||||||
|
m_object_grid->SetColSize(i, FromDIP(28));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ObjectGridTable::col_brim_type:
|
||||||
|
m_object_grid->SetColSize(i, FromDIP(56));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ObjectGridTable::col_brim_type_reset:
|
||||||
|
m_object_grid->SetColSize(i, FromDIP(28));
|
||||||
|
break;
|
||||||
|
case ObjectGridTable::col_speed_perimeter:
|
||||||
|
m_object_grid->SetColSize(i, m_object_grid->GetColSize(i) - FromDIP(28));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ObjectGridTable::col_speed_perimeter_reset:
|
||||||
|
m_object_grid->SetColSize(i, FromDIP(28));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//set col size after fit
|
|
||||||
/* ObjectGridTable::ObjectGridCol* grid_col = m_object_grid_table->get_grid_col(ObjectGridTable::col_brim_type);
|
|
||||||
grid_col->size = m_object_grid->GetTextExtent(grid_col->choices[0]).x + 30;
|
|
||||||
m_object_grid->SetColSize(ObjectGridTable::col_brim_type, grid_col->size);
|
|
||||||
|
|
||||||
grid_col = m_object_grid_table->get_grid_col(ObjectGridTable::col_filaments);
|
m_object_grid->SetGridLineColour(*wxWHITE);
|
||||||
grid_col->size = 128;
|
|
||||||
m_object_grid->SetColSize(ObjectGridTable::col_filaments, grid_col->size);*/
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(", finished, got %1% rows, %2% cols") %m_object_grid_table->GetNumberRows() %m_object_grid_table->GetNumberCols() ;
|
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(", finished, got %1% rows, %2% cols") %m_object_grid_table->GetNumberRows() %m_object_grid_table->GetNumberCols() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2794,7 +3018,6 @@ void ObjectTablePanel::OnSelectCell( wxGridEvent& ev )
|
||||||
|
|
||||||
m_cur_row = row;
|
m_cur_row = row;
|
||||||
m_cur_col = col;
|
m_cur_col = col;
|
||||||
|
|
||||||
ev.Skip();
|
ev.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2906,6 +3129,7 @@ ObjectTableDialog::ObjectTableDialog(wxWindow* parent, Plater* platerObj, Model
|
||||||
m_main_sizer->Add(m_line_top, 0, wxEXPAND, 0);
|
m_main_sizer->Add(m_line_top, 0, wxEXPAND, 0);
|
||||||
|
|
||||||
m_obj_panel = new ObjectTablePanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxEmptyString, m_plater, m_model);
|
m_obj_panel = new ObjectTablePanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxEmptyString, m_plater, m_model);
|
||||||
|
m_obj_panel->SetBackgroundColour(wxColour(0x00,0xAE,0x42));
|
||||||
//m_top_sizer->Add(m_obj_panel, 1, wxALL | wxEXPAND, 5);
|
//m_top_sizer->Add(m_obj_panel, 1, wxALL | wxEXPAND, 5);
|
||||||
|
|
||||||
wxSize panel_size = m_obj_panel->get_init_size();
|
wxSize panel_size = m_obj_panel->get_init_size();
|
||||||
|
@ -2937,7 +3161,7 @@ ObjectTableDialog::ObjectTableDialog(wxWindow* parent, Plater* platerObj, Model
|
||||||
//this->Layout();
|
//this->Layout();
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", created, this %1%, m_obj_panel %2%") %this % m_obj_panel;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", created, this %1%, m_obj_panel %2%") %this % m_obj_panel;
|
||||||
|
|
||||||
m_main_sizer->Add(m_obj_panel, 1, wxEXPAND|wxTOP,2);
|
m_main_sizer->Add(m_obj_panel, 1, wxEXPAND|wxLEFT,FromDIP(10));
|
||||||
SetSizer(m_main_sizer);
|
SetSizer(m_main_sizer);
|
||||||
Layout();
|
Layout();
|
||||||
Fit();
|
Fit();
|
||||||
|
@ -3000,5 +3224,56 @@ void ObjectTableDialog::OnSize(wxSizeEvent& event)
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// GridCellTextEditor
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
GridCellTextEditor::GridCellTextEditor() : wxGridCellTextEditor() {}
|
||||||
|
|
||||||
|
GridCellTextEditor::~GridCellTextEditor() {}
|
||||||
|
|
||||||
|
void GridCellTextEditor::Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler)
|
||||||
|
{
|
||||||
|
::TextInput *text_input = new ::TextInput(parent, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition, wxSize(-1, -1), 0);
|
||||||
|
m_control = text_input;
|
||||||
|
wxGridCellEditor::Create(parent, id, evtHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridCellTextEditor::SetSize(const wxRect &rect) { wxGridCellTextEditor::SetSize(rect); }
|
||||||
|
|
||||||
|
void GridCellTextEditor::BeginEdit(int row, int col, wxGrid *grid)
|
||||||
|
{
|
||||||
|
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
|
||||||
|
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
|
||||||
|
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
|
||||||
|
|
||||||
|
auto val = table->GetValue(row, col);
|
||||||
|
Text()->GetTextCtrl()->SetValue(val);
|
||||||
|
Text()->SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GridCellTextEditor::EndEdit(int row, int col, const wxGrid *grid, const wxString &WXUNUSED(oldval), wxString *newval)
|
||||||
|
{
|
||||||
|
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
|
||||||
|
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
|
||||||
|
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
|
||||||
|
|
||||||
|
wxCHECK_MSG(m_control, false, "wxGridCellTextEditor must be created first!");
|
||||||
|
|
||||||
|
const wxString value = Text()->GetTextCtrl()->GetValue();
|
||||||
|
if (value == m_value) return false;
|
||||||
|
|
||||||
|
m_value = value;
|
||||||
|
|
||||||
|
if (newval) *newval = m_value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridCellTextEditor::ApplyEdit(int row, int col, wxGrid *grid)
|
||||||
|
{
|
||||||
|
grid->GetTable()->SetValue(row, col, m_value);
|
||||||
|
m_value.clear();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace GUI
|
} // namespace GUI
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
#include "OptionsGroup.hpp"
|
#include "OptionsGroup.hpp"
|
||||||
#include "GUI_Factories.hpp"
|
#include "GUI_Factories.hpp"
|
||||||
#include "GUI_ObjectTableSettings.hpp"
|
#include "GUI_ObjectTableSettings.hpp"
|
||||||
|
#include "Widgets/TextInput.hpp"
|
||||||
|
|
||||||
|
class ComboBox;
|
||||||
|
class TextInput;
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
@ -50,11 +54,30 @@ public:
|
||||||
virtual GridCellIconRenderer *Clone() const wxOVERRIDE;
|
virtual GridCellIconRenderer *Clone() const wxOVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
// the editor for string data allowing to choose from the list of strings
|
class GridCellTextEditor : public wxGridCellTextEditor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GridCellTextEditor();
|
||||||
|
~GridCellTextEditor();
|
||||||
|
|
||||||
|
virtual void Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler) wxOVERRIDE;
|
||||||
|
virtual void SetSize(const wxRect &rect) wxOVERRIDE;
|
||||||
|
virtual void BeginEdit(int row, int col, wxGrid *grid) wxOVERRIDE;
|
||||||
|
virtual bool EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval) wxOVERRIDE;
|
||||||
|
virtual void ApplyEdit(int row, int col, wxGrid *grid) wxOVERRIDE;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
::TextInput *Text() const { return (::TextInput *) m_control; }
|
||||||
|
wxDECLARE_NO_COPY_CLASS(GridCellTextEditor);
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxString m_value;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class GridCellFilamentsEditor : public wxGridCellChoiceEditor
|
class GridCellFilamentsEditor : public wxGridCellChoiceEditor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// if !allowOthers, user can't type a string not in choices array
|
|
||||||
GridCellFilamentsEditor(size_t count = 0,
|
GridCellFilamentsEditor(size_t count = 0,
|
||||||
const wxString choices[] = NULL,
|
const wxString choices[] = NULL,
|
||||||
bool allowOthers = false,
|
bool allowOthers = false,
|
||||||
|
@ -78,7 +101,7 @@ public:
|
||||||
virtual void DoActivate(int row, int col, wxGrid* grid) wxOVERRIDE;
|
virtual void DoActivate(int row, int col, wxGrid* grid) wxOVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxBitmapComboBox *Combo() const { return (wxBitmapComboBox *)m_control; }
|
::ComboBox *Combo() const { return (::ComboBox *)m_control; }
|
||||||
void OnComboCloseUp(wxCommandEvent& evt);
|
void OnComboCloseUp(wxCommandEvent& evt);
|
||||||
|
|
||||||
std::vector<wxBitmap*>* m_icons;
|
std::vector<wxBitmap*>* m_icons;
|
||||||
|
@ -108,6 +131,44 @@ public:
|
||||||
virtual GridCellFilamentsRenderer *Clone() const wxOVERRIDE;
|
virtual GridCellFilamentsRenderer *Clone() const wxOVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class GridCellChoiceEditor : public wxGridCellChoiceEditor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GridCellChoiceEditor(size_t count = 0, const wxString choices[] = NULL);
|
||||||
|
GridCellChoiceEditor(const wxArrayString &choices);
|
||||||
|
|
||||||
|
virtual void Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler) wxOVERRIDE;
|
||||||
|
virtual void SetSize(const wxRect &rect) wxOVERRIDE;
|
||||||
|
|
||||||
|
virtual wxGridCellEditor *Clone() const wxOVERRIDE;
|
||||||
|
|
||||||
|
virtual void BeginEdit(int row, int col, wxGrid *grid) wxOVERRIDE;
|
||||||
|
virtual bool EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval) wxOVERRIDE;
|
||||||
|
|
||||||
|
virtual wxGridActivationResult TryActivate(int row, int col, wxGrid *grid, const wxGridActivationSource &actSource) wxOVERRIDE;
|
||||||
|
virtual void DoActivate(int row, int col, wxGrid *grid) wxOVERRIDE;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
::ComboBox *Combo() const { return (::ComboBox *) m_control; }
|
||||||
|
void OnComboCloseUp(wxCommandEvent &evt);
|
||||||
|
wxDECLARE_NO_COPY_CLASS(GridCellChoiceEditor);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_cached_value{-1};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class GridCellComboBoxRenderer : public wxGridCellChoiceRenderer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, const wxRect &rect, int row, int col, bool isSelected) wxOVERRIDE;
|
||||||
|
|
||||||
|
virtual wxSize GetBestSize(wxGrid &WXUNUSED(grid), wxGridCellAttr &attr, wxDC &dc, int WXUNUSED(row), int WXUNUSED(col)) wxOVERRIDE;
|
||||||
|
|
||||||
|
virtual GridCellComboBoxRenderer *Clone() const wxOVERRIDE;
|
||||||
|
};
|
||||||
|
|
||||||
class GridCellSupportEditor : public wxGridCellBoolEditor
|
class GridCellSupportEditor : public wxGridCellBoolEditor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -115,7 +176,6 @@ public:
|
||||||
virtual void DoActivate(int row, int col, wxGrid* grid) wxOVERRIDE;
|
virtual void DoActivate(int row, int col, wxGrid* grid) wxOVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// These functions modify or use m_value.
|
|
||||||
void SetValueFromGrid(int row, int col, wxGrid* grid);
|
void SetValueFromGrid(int row, int col, wxGrid* grid);
|
||||||
void SetGridFromValue(int row, int col, wxGrid* grid) const;
|
void SetGridFromValue(int row, int col, wxGrid* grid) const;
|
||||||
|
|
||||||
|
@ -150,6 +210,7 @@ public:
|
||||||
virtual GridCellSupportRenderer *Clone() const wxOVERRIDE;
|
virtual GridCellSupportRenderer *Clone() const wxOVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//ObjectGrid for the param setting table
|
//ObjectGrid for the param setting table
|
||||||
class ObjectGrid : public wxGrid
|
class ObjectGrid : public wxGrid
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,10 @@ namespace Slic3r
|
||||||
namespace GUI
|
namespace GUI
|
||||||
{
|
{
|
||||||
|
|
||||||
|
wxDEFINE_EVENT(EVT_LOCK_DISABLE, wxCommandEvent);
|
||||||
|
wxDEFINE_EVENT(EVT_LOCK_ENABLE, wxCommandEvent);
|
||||||
|
|
||||||
|
|
||||||
OTG_Settings::OTG_Settings(wxWindow* parent, const bool staticbox) :
|
OTG_Settings::OTG_Settings(wxWindow* parent, const bool staticbox) :
|
||||||
m_parent(parent)
|
m_parent(parent)
|
||||||
{
|
{
|
||||||
|
@ -162,10 +166,23 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_
|
||||||
|
|
||||||
auto btn = new ScalableButton(parent, wxID_ANY, m_bmp_reset);
|
auto btn = new ScalableButton(parent, wxID_ANY, m_bmp_reset);
|
||||||
btn->SetToolTip(_(L("Reset parameter")));
|
btn->SetToolTip(_(L("Reset parameter")));
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
btn->SetBackgroundColour(*wxWHITE);
|
btn->SetBackgroundColour(*wxWHITE);
|
||||||
|
#endif // DEBUG
|
||||||
|
|
||||||
|
|
||||||
btn->SetBitmapFocus(m_bmp_reset_focus.bmp());
|
btn->SetBitmapFocus(m_bmp_reset_focus.bmp());
|
||||||
btn->SetBitmapHover(m_bmp_reset_focus.bmp());
|
btn->SetBitmapHover(m_bmp_reset_focus.bmp());
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
btn->SetBitmapDisabled(m_bmp_reset_disable.bmp());
|
btn->SetBitmapDisabled(m_bmp_reset_disable.bmp());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WXOSX_MAC__
|
||||||
|
btn->Bind(EVT_LOCK_DISABLE, [this, btn](auto &e) { btn->SetBitmap(m_bmp_reset_disable.bmp()); });
|
||||||
|
btn->Bind(EVT_LOCK_ENABLE, [this, btn](auto &e) { btn->SetBitmap(m_bmp_reset_focus.bmp()); });
|
||||||
|
#endif
|
||||||
|
|
||||||
btn->Bind(wxEVT_BUTTON, [btn, opt_key, this, is_object, object, config, group_category](wxEvent &event) {
|
btn->Bind(wxEVT_BUTTON, [btn, opt_key, this, is_object, object, config, group_category](wxEvent &event) {
|
||||||
//wxGetApp().plater()->take_snapshot(from_u8((boost::format(_utf8(L("Reset Option %s"))) % opt_key).str()));
|
//wxGetApp().plater()->take_snapshot(from_u8((boost::format(_utf8(L("Reset Option %s"))) % opt_key).str()));
|
||||||
|
@ -185,6 +202,14 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_
|
||||||
m_current_config.apply(config->get(), true);
|
m_current_config.apply(config->get(), true);
|
||||||
update_config_values(is_object, object, config, group_category);
|
update_config_values(is_object, object, config, group_category);
|
||||||
this->m_parent->Thaw();
|
this->m_parent->Thaw();
|
||||||
|
|
||||||
|
#ifdef __WXOSX_MAC__
|
||||||
|
if (!btn->IsEnabled()) {
|
||||||
|
btn->SetBitmap(m_bmp_reset_disable.bmp());
|
||||||
|
} else {
|
||||||
|
btn->SetBitmap(m_bmp_reset_focus.bmp());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
});
|
});
|
||||||
(const_cast<Line&>(line)).extra_widget_win = btn;
|
(const_cast<Line&>(line)).extra_widget_win = btn;
|
||||||
return btn;
|
return btn;
|
||||||
|
@ -211,7 +236,9 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_
|
||||||
ctrl->SetBitmap_(m_bmp_reset);
|
ctrl->SetBitmap_(m_bmp_reset);
|
||||||
ctrl->SetBitmapFocus(m_bmp_reset_focus.bmp());
|
ctrl->SetBitmapFocus(m_bmp_reset_focus.bmp());
|
||||||
ctrl->SetBitmapHover(m_bmp_reset_focus.bmp());
|
ctrl->SetBitmapHover(m_bmp_reset_focus.bmp());
|
||||||
|
#ifdef __WINDOWS__
|
||||||
ctrl->SetBitmapDisabled(m_bmp_reset_disable.bmp());
|
ctrl->SetBitmapDisabled(m_bmp_reset_disable.bmp());
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
const bool is_extruders_cat = cat.first == "Extruders";
|
const bool is_extruders_cat = cat.first == "Extruders";
|
||||||
|
@ -308,10 +335,22 @@ int ObjectTableSettings::update_extra_column_visible_status(ConfigOptionsGroup*
|
||||||
if (line) {
|
if (line) {
|
||||||
if ((config->has(opt.name)) && reset_window&&reset_window->IsEnabled()) {
|
if ((config->has(opt.name)) && reset_window&&reset_window->IsEnabled()) {
|
||||||
line->extra_widget_win->Enable();
|
line->extra_widget_win->Enable();
|
||||||
|
|
||||||
|
#ifdef __WXOSX_MAC__
|
||||||
|
wxCommandEvent event(EVT_LOCK_ENABLE);
|
||||||
|
event.SetEventObject(line->extra_widget_win);
|
||||||
|
wxPostEvent(line->extra_widget_win, event);
|
||||||
|
#endif
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
line->extra_widget_win->Disable();
|
line->extra_widget_win->Disable();
|
||||||
|
#ifdef __WXOSX_MAC__
|
||||||
|
wxCommandEvent event(EVT_LOCK_DISABLE);
|
||||||
|
event.SetEventObject(line->extra_widget_win);
|
||||||
|
wxPostEvent(line->extra_widget_win, event);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxGridSizer* grid_sizer = option_group->get_grid_sizer();
|
wxGridSizer* grid_sizer = option_group->get_grid_sizer();
|
||||||
|
|
|
@ -76,7 +76,8 @@ public:
|
||||||
void resetAllValues(int row, bool is_object, ModelObject* object, ModelConfig* config, const std::string& category);
|
void resetAllValues(int row, bool is_object, ModelObject* object, ModelConfig* config, const std::string& category);
|
||||||
void msw_rescale();
|
void msw_rescale();
|
||||||
};
|
};
|
||||||
|
wxDECLARE_EVENT(EVT_LOCK_DISABLE, wxCommandEvent);
|
||||||
|
wxDECLARE_EVENT(EVT_LOCK_ENABLE, wxCommandEvent);
|
||||||
}}
|
}}
|
||||||
|
|
||||||
#endif // slic3r_GUI_ObjectTableSettings_hpp_
|
#endif // slic3r_GUI_ObjectTableSettings_hpp_
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue