OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::ObjectGridTable Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/GUI_ObjectTable.hpp>

Inheritance diagram for Slic3r::GUI::ObjectGridTable:
Collaboration diagram for Slic3r::GUI::ObjectGridTable:

Classes

struct  ObjectGridRow
struct  ObjectGridCol

Public Types

enum  GridRowType { row_object = 0 , row_volume = 1 }
enum  GridColType {
  col_printable = 0 , col_printable_reset = 1 , col_plate_index = 2 , col_name = 3 ,
  col_filaments = 4 , col_filaments_reset = 5 , col_layer_height = 6 , col_layer_height_reset = 7 ,
  col_wall_loops = 8 , col_wall_loops_reset = 9 , col_fill_density = 10 , col_fill_density_reset = 11 ,
  col_enable_support = 12 , col_enable_support_reset = 13 , col_brim_type = 14 , col_brim_type_reset = 15 ,
  col_speed_perimeter = 16 , col_speed_perimeter_reset = 17 , col_max
}
typedef std::function< bool(ObjectGridRow *row1, ObjectGridRow *row2)> compare_row_func

Public Member Functions

 ObjectGridTable (ObjectTablePanel *panel)
 ~ObjectGridTable ()
void release_object_configs ()
wxString convert_filament_string (int index, wxString &filament_str)
virtual int GetNumberRows () wxOVERRIDE
virtual int GetNumberCols () wxOVERRIDE
virtual bool IsEmptyCell (int row, int col) wxOVERRIDE
virtual wxString GetTypeName (int row, int col) wxOVERRIDE
virtual bool CanGetValueAs (int row, int col, const wxString &typeName) wxOVERRIDE
virtual bool CanSetValueAs (int row, int col, const wxString &typeName) wxOVERRIDE
virtual wxString GetValue (int row, int col) wxOVERRIDE
virtual void SetValue (int row, int col, const wxString &value) wxOVERRIDE
virtual long GetValueAsLong (int row, int col) wxOVERRIDE
virtual bool GetValueAsBool (int row, int col) wxOVERRIDE
virtual double GetValueAsDouble (int row, int col) wxOVERRIDE
virtual void SetValueAsLong (int row, int col, long value) wxOVERRIDE
virtual void SetValueAsBool (int row, int col, bool value) wxOVERRIDE
virtual void SetValueAsDouble (int row, int col, double value) wxOVERRIDE
void SetColLabelValue (int col, const wxString &) wxOVERRIDE
wxString GetColLabelValue (int col) wxOVERRIDE
template<typename TYPE>
const TYPE * get_object_config_value (const DynamicPrintConfig &global_config, ModelConfig *obj_config, std::string &config_option)
template<typename TYPE>
const TYPE * get_volume_config_value (const DynamicPrintConfig &global_config, ModelConfig *obj_config, ModelConfig *volume_config, std::string &config_option)
int get_row_count ()
int get_col_count ()
ObjectGridCol * get_grid_col (int col)
ObjectGridRow * get_grid_row (int row)
void construct_object_configs (ObjectGrid *object_grid)
void update_value_to_config (ModelConfig *config, std::string &key, ConfigOption &new_value, ConfigOption &ori_value)
void update_filament_to_config (ModelConfig *config, std::string &key, ConfigOption &new_value, ConfigOption &ori_value, bool is_object)
void update_volume_values_from_object (int row, int col)
void update_value_to_object (Model *model, ObjectGridRow *grid_row, int col)
wxBitmap & get_undo_bitmap (bool selected=false)
wxBitmap * get_color_bitmap (int color_index)
bool OnCellLeftClick (int row, int col, ConfigOptionType &type)
void OnSelectCell (int row, int col)
void OnRangeSelected (int row, int col, int row_count, int col_count)
void OnCellValueChanged (int row, int col)
void SetSelection (int object_id, int volume_id)
void sort_by_default ()
void sort_by_col (int col)
void reload_object_data (ObjectGridRow *grid_row, const std::string &category, DynamicPrintConfig &global_config)
void reload_part_data (ObjectGridRow *volume_row, ObjectGridRow *object_row, const std::string &category, DynamicPrintConfig &global_config)
void reload_cell_data (int row, const std::string &category)
void resetValuesInCurrentCell (wxEvent &WXUNUSED(event))
void enable_reset_all_button (bool enable)

Public Attributes

int m_icon_col_width { 0 }
int m_icon_row_height { 0 }
ObjectTablePanel * m_panel { nullptr }

Static Public Attributes

static std::string category_all = "All"
static std::string plate_outside = L("Outside")

Private Member Functions

void init_cols (ObjectGrid *object_grid)
void sort_row_data (compare_row_func sort_func)
void update_row_properties ()

Private Attributes

std::vector< ObjectGridRow * > m_grid_data
std::vector< ObjectGridCol * > m_col_data
bool m_data_valid {false}
std::list< wxGridCellCoords > m_selected_cells
int m_sort_col { -1 }
int m_current_row {-1}
int m_current_col {-1}
wxArrayString m_colLabels

Detailed Description

Member Typedef Documentation

◆ compare_row_func

Member Enumeration Documentation

◆ GridColType

Enumerator
col_printable 
col_printable_reset 
col_plate_index 
col_name 
col_filaments 
col_filaments_reset 
col_layer_height 
col_layer_height_reset 
col_wall_loops 
col_wall_loops_reset 
col_fill_density 
col_fill_density_reset 
col_enable_support 
col_enable_support_reset 
col_brim_type 
col_brim_type_reset 
col_speed_perimeter 
col_speed_perimeter_reset 
col_max 
294 {
295 /* col_plate_index = 0,
296 col_assemble_name = 1,
297 col_name = col_assemble_name + 1,
298 col_printable = col_name + 1,
299 col_printable_reset = col_printable + 1,
300 col_filaments = col_printable_reset + 1,
301 col_filaments_reset = col_filaments + 1,
302 col_layer_height = col_filaments_reset + 1,
303 col_layer_height_reset = col_layer_height + 1,
304 col_wall_loops = col_layer_height_reset + 1,
305 col_wall_loops_reset = col_wall_loops + 1,
306 col_fill_density = col_wall_loops_reset + 1,
307 col_fill_density_reset = col_fill_density + 1,
308 col_enable_support = col_fill_density_reset + 1,
309 col_enable_support_reset = col_enable_support + 1,
310 col_brim_type = col_enable_support_reset + 1,
311 col_brim_type_reset = col_brim_type + 1,
312 col_speed_perimeter = col_brim_type_reset + 1,
313 col_speed_perimeter_reset = col_speed_perimeter + 1,
314 col_max*/
315 col_printable = 0,
317 col_plate_index = 2,
318 //col_assemble_name = 3,
319 col_name = 3,
320 col_filaments = 4,
324 col_wall_loops = 8,
326 col_fill_density = 10,
330 col_brim_type = 14,
334 col_max
335 };
@ col_wall_loops
Definition GUI_ObjectTable.hpp:324
@ col_fill_density
Definition GUI_ObjectTable.hpp:326
@ col_speed_perimeter_reset
Definition GUI_ObjectTable.hpp:333
@ col_printable
Definition GUI_ObjectTable.hpp:315
@ col_brim_type
Definition GUI_ObjectTable.hpp:330
@ col_enable_support_reset
Definition GUI_ObjectTable.hpp:329
@ col_filaments
Definition GUI_ObjectTable.hpp:320
@ col_layer_height
Definition GUI_ObjectTable.hpp:322
@ col_layer_height_reset
Definition GUI_ObjectTable.hpp:323
@ col_fill_density_reset
Definition GUI_ObjectTable.hpp:327
@ col_filaments_reset
Definition GUI_ObjectTable.hpp:321
@ col_printable_reset
Definition GUI_ObjectTable.hpp:316
@ col_plate_index
Definition GUI_ObjectTable.hpp:317
@ col_brim_type_reset
Definition GUI_ObjectTable.hpp:331
@ col_enable_support
Definition GUI_ObjectTable.hpp:328
@ col_max
Definition GUI_ObjectTable.hpp:334
@ col_wall_loops_reset
Definition GUI_ObjectTable.hpp:325
@ col_speed_perimeter
Definition GUI_ObjectTable.hpp:332
@ col_name
Definition GUI_ObjectTable.hpp:319

◆ GridRowType

Enumerator
row_object 
row_volume 
289 {
290 row_object = 0,
291 row_volume = 1
292 };
@ row_object
Definition GUI_ObjectTable.hpp:290
@ row_volume
Definition GUI_ObjectTable.hpp:291

Constructor & Destructor Documentation

◆ ObjectGridTable()

Slic3r::GUI::ObjectGridTable::ObjectGridTable ( ObjectTablePanel * panel)
inline
451: m_panel(panel) { }
ObjectTablePanel * m_panel
Definition GUI_ObjectTable.hpp:538

References m_panel.

◆ ~ObjectGridTable()

Slic3r::GUI::ObjectGridTable::~ObjectGridTable ( )
1226{
1227 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", this %1%, row_data size %2%") %this % m_grid_data.size();
1228 for ( int index = 0; index < m_grid_data.size(); index++ )
1229 {
1230 if (m_grid_data[index])
1231 delete (m_grid_data[index]);
1232 }
1233 m_grid_data.clear();
1234
1235 for ( int index = 0; index < m_col_data.size(); index++ )
1236 {
1237 if (m_col_data[index])
1238 delete (m_col_data[index]);
1239 }
1240
1241 m_selected_cells.clear();
1242}
std::list< wxGridCellCoords > m_selected_cells
Definition GUI_ObjectTable.hpp:545
std::vector< ObjectGridRow * > m_grid_data
Definition GUI_ObjectTable.hpp:541
std::vector< ObjectGridCol * > m_col_data
Definition GUI_ObjectTable.hpp:542

References m_col_data, m_grid_data, and m_selected_cells.

Member Function Documentation

◆ CanGetValueAs()

bool Slic3r::GUI::ObjectGridTable::CanGetValueAs ( int row,
int col,
const wxString & typeName )
virtual
1300{
1301 //row 0 always use string type for label
1302 if (row == 0) {
1303 if ( typeName == wxGRID_VALUE_STRING )
1304 return true;
1305 else
1306 return false;
1307 }
1308
1309 //other rows for data
1310 ObjectGridCol* col_object = m_col_data[col];
1312 ConfigOptionType option_type = col_object->type;
1313
1314 if (col_object->b_icon)
1315 return false;
1316 if (col_object->b_for_object && (row_object->row_type == row_volume))
1317 return false;
1318
1319 if ( typeName == wxGRID_VALUE_STRING )
1320 {
1321 if (option_type == coString)
1322 return true;
1323 else
1324 return false;
1325 }
1326 else if ( typeName == wxGRID_VALUE_BOOL )
1327 {
1328 if (option_type == coBool)
1329 return true;
1330 else
1331 return false;
1332 }
1333 else if ( typeName == wxGRID_VALUE_NUMBER )
1334 {
1335 if (option_type == coInt)
1336 return true;
1337 else
1338 return false;
1339 }
1340 else if ( typeName == wxGRID_VALUE_FLOAT )
1341 {
1342 if ((option_type == coFloat) || (option_type == coPercent))
1343 return true;
1344 else
1345 return false;
1346 }
1347 else if ( typeName == wxGRID_VALUE_CHOICE )
1348 {
1349 if (option_type == coEnum)
1350 return true;
1351 else
1352 return false;
1353 }
1354 else
1355 {
1356 return false;
1357 }
1358}
ConfigOptionType
Definition Config.hpp:180
@ coString
Definition Config.hpp:192
@ coEnum
Definition Config.hpp:214
@ coInt
Definition Config.hpp:188
@ coBool
Definition Config.hpp:210
@ coFloat
Definition Config.hpp:184
@ coPercent
Definition Config.hpp:196
Definition GUI_ObjectTable.hpp:424
Definition GUI_ObjectTable.hpp:338

References Slic3r::GUI::ObjectGridTable::ObjectGridCol::b_for_object, Slic3r::GUI::ObjectGridTable::ObjectGridCol::b_icon, Slic3r::coBool, Slic3r::coEnum, Slic3r::coFloat, Slic3r::coInt, Slic3r::coPercent, Slic3r::coString, m_col_data, m_grid_data, row_object, row_volume, and Slic3r::GUI::ObjectGridTable::ObjectGridCol::type.

Referenced by CanSetValueAs().

Here is the caller graph for this function:

◆ CanSetValueAs()

bool Slic3r::GUI::ObjectGridTable::CanSetValueAs ( int row,
int col,
const wxString & typeName )
virtual
1361{
1362 return CanGetValueAs(row, col, typeName);
1363}
virtual bool CanGetValueAs(int row, int col, const wxString &typeName) wxOVERRIDE
Definition GUI_ObjectTable.cpp:1299

References CanGetValueAs().

Here is the call graph for this function:

◆ construct_object_configs()

void Slic3r::GUI::ObjectGridTable::construct_object_configs ( ObjectGrid * object_grid)
1982{
1983 //release first
1985
1986 //init cols
1987 init_cols(object_grid);
1988
1989 if (!m_panel->m_model)
1990 {
1991 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "found invalid m_model, should not happen" << std::endl;
1992 return;
1993 }
1994 int object_count = m_panel->m_model->objects.size();
1995 PartPlateList& partplate_list = m_panel->m_plater->get_partplate_list();
1996 DynamicPrintConfig& global_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
1997 const DynamicPrintConfig* plater_config = m_panel->m_plater->config();
1998 const DynamicPrintConfig& filament_config = *plater_config;
1999
2000 for (int i = 0; i < object_count; i++)
2001 {
2002 ModelObject* object = m_panel->m_model->objects[i];
2003 ObjectGridRow* object_grid = new ObjectGridRow(i, 0, row_object);
2004 int plate_index;
2005
2006 object_grid->config = &(object->config);
2007 object_grid->name.value = object->name;
2008 object_grid->ori_name = object_grid->name;
2009 plate_index = partplate_list.find_instance_belongs(i, 0);
2010 if (plate_index == -1)
2011 object_grid->plate_index.value = ObjectGridTable::plate_outside;
2012 else
2013 object_grid->plate_index.value = /*std::string("Plate ") + */std::to_string(plate_index+1);
2014 /* object_grid->assemble_name.value = object->module_name;
2015 object_grid->ori_assemble_name = object_grid->assemble_name;*/
2016 object_grid->printable.value = object->instances[0]->printable;
2017 object_grid->ori_printable.value = object_grid->printable.value;
2018 //auto extruder_id_ptr = get_object_config_value<ConfigOptionInt>(filament_config, object_grid->config, m_col_data[col_filaments]->key);
2019 auto extruder_id_ptr = static_cast<const ConfigOptionInt*>(object_grid->config->option(m_col_data[col_filaments]->key));
2020 if (extruder_id_ptr) {
2021 object_grid->filaments = *extruder_id_ptr;
2022 if (object_grid->filaments.value == 0) {
2023 object_grid->filaments.value = 1;
2024 object_grid->config->set_key_value(m_col_data[col_filaments]->key, object_grid->filaments.clone());
2025 }
2026 }
2027 else {
2028 object_grid->filaments.value = 1;
2029 object_grid->config->set_key_value(m_col_data[col_filaments]->key, object_grid->filaments.clone());
2030 }
2031 //object_grid->ori_filaments.value = 1;
2032
2033 object_grid->layer_height = *(get_object_config_value<ConfigOptionFloat>(global_config, object_grid->config, m_col_data[col_layer_height]->key));
2034 object_grid->ori_layer_height = *(global_config.option<ConfigOptionFloat>(m_col_data[col_layer_height]->key));
2035 object_grid->wall_loops = *(get_object_config_value<ConfigOptionInt>(global_config, object_grid->config, m_col_data[col_wall_loops]->key));
2036 object_grid->ori_wall_loops = *(global_config.option<ConfigOptionInt>(m_col_data[col_wall_loops]->key));
2037 object_grid->sparse_infill_density = *(get_object_config_value<ConfigOptionPercent>(global_config, object_grid->config, m_col_data[col_fill_density]->key));
2038 object_grid->ori_fill_density = *(global_config.option<ConfigOptionPercent>(m_col_data[col_fill_density]->key));
2039 object_grid->enable_support = *(get_object_config_value<ConfigOptionBool>(global_config, object_grid->config, m_col_data[col_enable_support]->key));
2040 object_grid->ori_enable_support = *(global_config.option<ConfigOptionBool>(m_col_data[col_enable_support]->key));
2041 object_grid->brim_type = *(get_object_config_value<ConfigOptionEnum<BrimType>>(global_config, object_grid->config, m_col_data[col_brim_type]->key));
2042 object_grid->ori_brim_type = *(global_config.option<ConfigOptionEnum<BrimType>>(m_col_data[col_brim_type]->key));
2043 object_grid->speed_perimeter = *(get_object_config_value<ConfigOptionFloatsNullable>(global_config, object_grid->config, m_col_data[col_speed_perimeter]->key));
2044 object_grid->ori_speed_perimeter = *(global_config.option<ConfigOptionFloatsNullable>(m_col_data[col_speed_perimeter]->key));
2045 m_grid_data.push_back(object_grid);
2046
2047 int volume_count = object->volumes.size();
2048 if (volume_count <= 1)
2049 continue;
2050
2051 for (int j = 0; j < volume_count; j++)
2052 {
2053 ModelVolume* volume = object->volumes[j];
2054 ObjectGridRow* volume_grid = new ObjectGridRow(i, j, row_volume);
2055 volume_grid->model_volume_type = volume->type();
2056 volume_grid->config = &(volume->config);
2057 volume_grid->name.value = volume->name;
2058 size_t pos = volume_grid->name.value.find_first_not_of(' ');
2059 if (pos > 0)
2060 volume_grid->name.value.erase(0, pos);
2061 volume_grid->ori_name = volume_grid->name;
2062 plate_index = partplate_list.find_instance_belongs(i, 0);
2063 if (plate_index == -1)
2064 volume_grid->plate_index.value = ObjectGridTable::plate_outside;
2065 else
2066 volume_grid->plate_index.value = /*std::string("Plate ") +*/ std::to_string(plate_index+1);
2067 /* volume_grid->assemble_name.value = object->module_name;
2068 volume_grid->ori_assemble_name = volume_grid->assemble_name;*/
2069 volume_grid->printable.value = object->instances[0]->printable;
2070 volume_grid->ori_printable.value = volume_grid->printable.value;
2071 //auto extruder_id_ptr = get_volume_config_value<ConfigOptionInt>(filament_config, object_grid->config, volume_grid->config, m_col_data[col_filaments]->key);
2072 auto extruder_id_ptr = static_cast<const ConfigOptionInt*>(volume_grid->config->option(m_col_data[col_filaments]->key));
2073 if (extruder_id_ptr) {
2074 volume_grid->filaments = *extruder_id_ptr;
2075 if ((volume_grid->filaments.value == 0) || (volume_grid->filaments == object_grid->filaments)) {
2076 volume_grid->config->erase(m_col_data[col_filaments]->key);
2077 volume_grid->filaments = object_grid->filaments;
2078 }
2079 }
2080 else
2081 volume_grid->filaments = object_grid->filaments;
2082 //volume_grid->ori_filaments = object_grid->filaments;
2083 volume_grid->layer_height = *(get_volume_config_value<ConfigOptionFloat>(global_config, object_grid->config, volume_grid->config, m_col_data[col_layer_height]->key));
2084 volume_grid->ori_layer_height = object_grid->layer_height;
2085 volume_grid->wall_loops = *(get_volume_config_value<ConfigOptionInt>(global_config, object_grid->config, volume_grid->config, m_col_data[col_wall_loops]->key));
2086 volume_grid->ori_wall_loops = object_grid->wall_loops;
2087 volume_grid->sparse_infill_density = *(get_volume_config_value<ConfigOptionPercent>(global_config, object_grid->config, volume_grid->config, m_col_data[col_fill_density]->key));
2088 volume_grid->ori_fill_density = object_grid->sparse_infill_density;
2089 volume_grid->enable_support = *(get_volume_config_value<ConfigOptionBool>(global_config, object_grid->config, volume_grid->config, m_col_data[col_enable_support]->key));
2090 volume_grid->ori_enable_support = object_grid->enable_support;
2091 volume_grid->brim_type = *(get_volume_config_value<ConfigOptionEnum<BrimType>>(global_config, object_grid->config, volume_grid->config, m_col_data[col_brim_type]->key));
2092 volume_grid->ori_brim_type = object_grid->brim_type;
2093 volume_grid->speed_perimeter = *(get_volume_config_value<ConfigOptionFloatsNullable>(global_config, object_grid->config, volume_grid->config, m_col_data[col_speed_perimeter]->key));
2094 volume_grid->ori_speed_perimeter = object_grid->speed_perimeter;
2095 m_grid_data.push_back(volume_grid);
2096 }
2097 }
2098
2099 m_data_valid = true;
2100
2101 return;
2102}
const TYPE * get_object_config_value(const DynamicPrintConfig &global_config, ModelConfig *obj_config, std::string &config_option)
Definition GUI_ObjectTable.hpp:482
void init_cols(ObjectGrid *object_grid)
Definition GUI_ObjectTable.cpp:1876
static std::string plate_outside
Definition GUI_ObjectTable.hpp:287
void release_object_configs()
Definition GUI_ObjectTable.cpp:1824
const TYPE * get_volume_config_value(const DynamicPrintConfig &global_config, ModelConfig *obj_config, ModelConfig *volume_config, std::string &config_option)
Definition GUI_ObjectTable.hpp:493
bool m_data_valid
Definition GUI_ObjectTable.hpp:543
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16
zaa_minimize_perimeter_height ConfigOptionFloat
Definition PrintConfig.hpp:1954
ConfigOptionFloatsTempl< true > ConfigOptionFloatsNullable
Definition Config.hpp:1016

References Slic3r::GUI::ObjectGridTable::ObjectGridRow::brim_type, Slic3r::ConfigOptionInt::clone(), col_brim_type, col_enable_support, col_filaments, col_fill_density, col_layer_height, col_speed_perimeter, col_wall_loops, Slic3r::GUI::ObjectGridTable::ObjectGridRow::config, Slic3r::ModelVolume::config, Slic3r::GUI::ObjectGridTable::ObjectGridRow::enable_support, Slic3r::ModelConfig::erase(), Slic3r::GUI::ObjectGridTable::ObjectGridRow::filaments, Slic3r::GUI::PartPlateList::find_instance_belongs(), get_object_config_value(), get_volume_config_value(), init_cols(), Slic3r::GUI::ObjectGridTable::ObjectGridRow::layer_height, m_col_data, m_data_valid, m_grid_data, m_panel, Slic3r::GUI::ObjectGridTable::ObjectGridRow::model_volume_type, Slic3r::GUI::ObjectGridTable::ObjectGridRow::name, Slic3r::ModelVolume::name, Slic3r::ConfigBase::option(), Slic3r::ModelConfig::option(), Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_brim_type, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_enable_support, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_fill_density, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_layer_height, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_name, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_printable, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_speed_perimeter, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_wall_loops, Slic3r::GUI::ObjectGridTable::ObjectGridRow::plate_index, plate_outside, Slic3r::GUI::ObjectGridTable::ObjectGridRow::printable, release_object_configs(), row_object, row_volume, Slic3r::ModelConfig::set_key_value(), Slic3r::GUI::ObjectGridTable::ObjectGridRow::sparse_infill_density, Slic3r::GUI::ObjectGridTable::ObjectGridRow::speed_perimeter, Slic3r::ModelVolume::type(), Slic3r::ConfigOptionSingle< T >::value, and Slic3r::GUI::ObjectGridTable::ObjectGridRow::wall_loops.

Here is the call graph for this function:

◆ convert_filament_string()

wxString Slic3r::GUI::ObjectGridTable::convert_filament_string ( int index,
wxString & filament_str )
1851{
1852 wxString result_str;
1853 if (filament_str.find("PLA") != wxNOT_FOUND ) {
1854 //PLA
1855 result_str = wxString(std::to_string(index+1) + ": PLA");
1856 }
1857 else if (filament_str.find("ABS") != wxNOT_FOUND ) {
1858 //ABS
1859 result_str = wxString(std::to_string(index+1) + ": ABS");
1860 }
1861 else if (filament_str.find("PETG") != wxNOT_FOUND ) {
1862 //PETG
1863 result_str= wxString(std::to_string(index+1) + ": PETG");
1864 }
1865 else if (filament_str.find("TPU") != wxNOT_FOUND ) {
1866 //TPU
1867 result_str = wxString(std::to_string(index+1) + ": TPU");
1868 }
1869 else
1870 result_str = filament_str;
1871
1872 //result_str = "";
1873 return result_str;
1874}

Referenced by GetValue().

Here is the caller graph for this function:

◆ enable_reset_all_button()

void Slic3r::GUI::ObjectGridTable::enable_reset_all_button ( bool enable)
2750{
2751 //m_panel->m_global_reset->Enable(enable);
2752}

◆ get_col_count()

int Slic3r::GUI::ObjectGridTable::get_col_count ( )
inline
507{ return m_col_data.size(); }

References m_col_data.

◆ get_color_bitmap()

wxBitmap * Slic3r::GUI::ObjectGridTable::get_color_bitmap ( int color_index)
2728{
2729 if (color_index < m_panel->m_color_bitmaps.size())
2730 return m_panel->m_color_bitmaps[color_index];
2731 else
2732 return m_panel->m_color_bitmaps[0];
2733}

References m_panel.

Referenced by Slic3r::GUI::GridCellComboBoxRenderer::Draw(), and Slic3r::GUI::GridCellFilamentsRenderer::Draw().

Here is the caller graph for this function:

◆ get_grid_col()

◆ get_grid_row()

◆ get_object_config_value()

template<typename TYPE>
const TYPE * Slic3r::GUI::ObjectGridTable::get_object_config_value ( const DynamicPrintConfig & global_config,
ModelConfig * obj_config,
std::string & config_option )
inline
483 {
484 if (obj_config->has(config_option))
485 return static_cast<const TYPE*>(obj_config->option(config_option));
486 else {
487 const TYPE* ptr = global_config.option<TYPE>(config_option);
488 //todo: how to deal with nullptr
489 return ptr;
490 }
491 }

References get_object_config_value().

Referenced by construct_object_configs(), get_object_config_value(), and reload_object_data().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_row_count()

int Slic3r::GUI::ObjectGridTable::get_row_count ( )
inline
506{ return m_grid_data.size() + 1; }

References m_grid_data.

Referenced by update_row_properties().

Here is the caller graph for this function:

◆ get_undo_bitmap()

wxBitmap & Slic3r::GUI::ObjectGridTable::get_undo_bitmap ( bool selected = false)
2723{
2724 return m_panel->m_undo_bitmap;
2725}

References m_panel.

Referenced by Slic3r::GUI::GridCellIconRenderer::Draw().

Here is the caller graph for this function:

◆ get_volume_config_value()

template<typename TYPE>
const TYPE * Slic3r::GUI::ObjectGridTable::get_volume_config_value ( const DynamicPrintConfig & global_config,
ModelConfig * obj_config,
ModelConfig * volume_config,
std::string & config_option )
inline
494 {
495 if (volume_config->has(config_option))
496 return static_cast<const TYPE*>(volume_config->option(config_option));
497 else if (obj_config->has(config_option))
498 return static_cast<const TYPE*>(obj_config->option(config_option));
499 else {
500 const TYPE* ptr = global_config.option<TYPE>(config_option);
501 //todo: how to deal with nullptr
502 return ptr;
503 }
504 }

References Slic3r::ModelConfig::has(), Slic3r::ConfigBase::option(), and Slic3r::ModelConfig::option().

Referenced by construct_object_configs(), and reload_part_data().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetColLabelValue()

wxString Slic3r::GUI::ObjectGridTable::GetColLabelValue ( int col)
1811{
1812 if ( col > (int)(m_colLabels.GetCount()) - 1 )
1813 {
1814 // using default label
1815 //
1816 return wxGridTableBase::GetColLabelValue( col );
1817 }
1818 else
1819 {
1820 return m_colLabels[col];
1821 }
1822}
wxArrayString m_colLabels
Definition GUI_ObjectTable.hpp:557

References m_colLabels.

◆ GetNumberCols()

int Slic3r::GUI::ObjectGridTable::GetNumberCols ( )
virtual
1281{
1282 return m_col_data.size();
1283}

References m_col_data.

◆ GetNumberRows()

int Slic3r::GUI::ObjectGridTable::GetNumberRows ( )
virtual
1276{
1277 return m_grid_data.size() + 1;
1278}

References m_grid_data.

◆ GetTypeName()

wxString Slic3r::GUI::ObjectGridTable::GetTypeName ( int row,
int col )
virtual
1246{
1247 if (row == 0)
1248 return wxGRID_VALUE_STRING;
1249
1250 ObjectGridCol* col_object = m_col_data[col];
1251 ConfigOptionType option_type = col_object->type;
1252 wxString type_name;
1253
1254 switch (option_type)
1255 {
1256 case coString:
1257 return wxGRID_VALUE_STRING;
1258 case coBool:
1259 return wxGRID_VALUE_BOOL;
1260 case coInt:
1261 return wxGRID_VALUE_NUMBER;
1262 case coFloat:
1263 case coPercent:
1264 return wxGRID_VALUE_FLOAT;
1265 case coEnum:
1266 return wxGRID_VALUE_CHOICE;
1267 default:
1268 break;
1269 }
1270
1271 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(", unknown column");
1272 return wxEmptyString;
1273}

References Slic3r::coBool, Slic3r::coEnum, Slic3r::coFloat, Slic3r::coInt, Slic3r::coPercent, Slic3r::coString, m_col_data, and Slic3r::GUI::ObjectGridTable::ObjectGridCol::type.

◆ GetValue()

wxString Slic3r::GUI::ObjectGridTable::GetValue ( int row,
int col )
virtual
1366{
1367 if (!m_data_valid)
1368 return wxString();
1369
1370 //row 0 always use string type for label
1371 if (row == 0) {
1372 switch ((GridColType)col)
1373 {
1374 case col_plate_index:
1375 return "Plate";
1376 /* case col_assemble_name:
1377 return "Module";*/
1378 case col_name:
1379 return "Name";
1380 case col_printable:
1381 return "Printable";
1382 case col_filaments:
1383 return "Filament";
1384 case col_layer_height:
1385 return "Layer height";
1386 case col_wall_loops:
1387 return "Perimeter";
1388 case col_fill_density:
1389 return "Infill density(%)";
1390 case col_enable_support:
1391 return "Support";
1392 case col_brim_type:
1393 return "Brim";
1395 return "Perimeter speed";
1396 default:
1397 return wxString();
1398 }
1399 }
1400
1401 ObjectGridRow* grid_row = m_grid_data[row - 1];
1402 ObjectGridCol* grid_col = m_col_data[(GridColType)col];
1403 if (grid_col->b_for_object && (grid_row->row_type == row_volume))
1404 return wxString();
1405
1406 ConfigOption& option = (*grid_row)[(GridColType)col];
1407 if (grid_col->type == coEnum) {
1408 if (col == col_brim_type) {
1409 ConfigOptionEnum<BrimType>& option_value = dynamic_cast<ConfigOptionEnum<BrimType>&>(option);
1410 if (option_value.value < grid_col->choice_count)
1411 return grid_col->choices[option_value.value];
1412 }
1413 else if (col == col_filaments) {
1414 ConfigOptionInt& option_value = dynamic_cast<ConfigOptionInt&>(option);
1415 if ((option_value.value - 1) < grid_col->choice_count) {
1416 //return grid_col->choices[(option_value.value > 0)?option_value.value - 1: 0];
1417 int index = (option_value.value > 0) ? option_value.value - 1 : 0;
1418 return convert_filament_string(index, grid_col->choices[index]);
1419 //return grid_col->choices[index];
1420 }
1421 }
1422 }
1423 else if (grid_col->type == coBool) {
1424 ConfigOptionBool& option_value = dynamic_cast<ConfigOptionBool&>(option);
1425 return option_value.value?"-":"-";
1426 }
1427 else if (grid_col->type == coInt) {
1428 ConfigOptionInt& option_value = dynamic_cast<ConfigOptionInt&>(option);
1429 return wxString::Format("%d", option_value.value);
1430 } else if (grid_col->type == coFloat) {
1431 if (auto option_values = dynamic_cast<ConfigOptionFloatsNullable*>(&option)) {
1432 return wxString::Format("%.2f", option_values->get_at(0));
1433 }
1434 ConfigOptionFloat& option_value = dynamic_cast<ConfigOptionFloat&>(option);
1435 return wxString::Format("%.2f", option_value.value);
1436 }
1437 else if (grid_col->type == coPercent) {
1438 ConfigOptionPercent& option_value = dynamic_cast<ConfigOptionPercent&>(option);
1439 return wxString::Format("%.2f", option_value.value);
1440 }
1441 else {
1442 try {
1443 if (grid_row->row_type == row_volume){
1444 ConfigOptionString& option_value = dynamic_cast<ConfigOptionString&>(option);
1445 return GUI::from_u8(std::string(" ") + option_value.value);
1446 }
1447 else {
1448 if (option.type() == coInt) {
1449 ConfigOptionInt& option_value = dynamic_cast<ConfigOptionInt&>(option);
1450 return GUI::from_u8(wxString::Format("%d",option_value.value).ToStdString());
1451 }else {
1452 ConfigOptionString& option_value = dynamic_cast<ConfigOptionString&>(option);
1453 return GUI::from_u8(option_value.value);
1454 }
1455
1456 }
1457 }
1458 catch(...) {
1459 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format("row %1%, col %2%, type %3% ")%row %col %grid_col->type;
1460 return wxString();
1461 }
1462 }
1463
1464 return wxString();
1465}
GridColType
Definition GUI_ObjectTable.hpp:294
wxString convert_filament_string(int index, wxString &filament_str)
Definition GUI_ObjectTable.cpp:1850
wxString from_u8(const std::string &str)
Definition GUI.cpp:544
zaa_minimize_perimeter_height ConfigOptionString
Definition PrintConfig.hpp:1702

References Slic3r::GUI::ObjectGridTable::ObjectGridCol::b_for_object, Slic3r::GUI::ObjectGridTable::ObjectGridCol::choice_count, Slic3r::GUI::ObjectGridTable::ObjectGridCol::choices, Slic3r::coBool, Slic3r::coEnum, Slic3r::coFloat, Slic3r::coInt, col_brim_type, col_enable_support, col_filaments, col_fill_density, col_layer_height, col_name, col_plate_index, col_printable, col_speed_perimeter, col_wall_loops, convert_filament_string(), Slic3r::coPercent, Slic3r::GUI::from_u8(), m_col_data, m_data_valid, m_grid_data, Slic3r::GUI::ObjectGridTable::ObjectGridRow::row_type, row_volume, Slic3r::ConfigOption::type(), Slic3r::GUI::ObjectGridTable::ObjectGridCol::type, and Slic3r::ConfigOptionSingle< T >::value.

Referenced by Slic3r::GUI::GridCellTextEditor::BeginEdit(), Slic3r::GUI::GridCellSupportRenderer::Draw(), and Slic3r::GUI::ObjectGrid::OnKeyDown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetValueAsBool()

bool Slic3r::GUI::ObjectGridTable::GetValueAsBool ( int row,
int col )
virtual
1709{
1710 if (!m_data_valid)
1711 return 0;
1712
1713 ObjectGridRow* grid_row = m_grid_data[row - 1];
1714 ConfigOptionBool &option_value = dynamic_cast<ConfigOptionBool &>((*grid_row)[(GridColType)col]);
1715 return option_value.getBool();
1716}

References Slic3r::ConfigOptionBool::getBool(), m_data_valid, and m_grid_data.

Referenced by Slic3r::GUI::ObjectGrid::OnKeyDown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetValueAsDouble()

double Slic3r::GUI::ObjectGridTable::GetValueAsDouble ( int row,
int col )
virtual
1719{
1720 if (!m_data_valid)
1721 return 0;
1722
1723 ObjectGridRow* grid_row = m_grid_data[row - 1];
1724 if (auto option_values = dynamic_cast<ConfigOptionFloatsNullable*>(&(*grid_row)[(GridColType) col])) {
1725 return (double) option_values->get_at(0);
1726 }
1727 ConfigOptionFloat& option_value = dynamic_cast<ConfigOptionFloat&>((*grid_row)[(GridColType) col]);
1728 return (double) option_value.getFloat();
1729}

References Slic3r::ConfigOptionFloat::getFloat(), m_data_valid, and m_grid_data.

Here is the call graph for this function:

◆ GetValueAsLong()

long Slic3r::GUI::ObjectGridTable::GetValueAsLong ( int row,
int col )
virtual
1699{
1700 if (!m_data_valid)
1701 return 0;
1702
1703 ObjectGridRow* grid_row = m_grid_data[row - 1];
1704 ConfigOptionInt &option_value = dynamic_cast<ConfigOptionInt &>((*grid_row)[(GridColType)col]);
1705 return (long)option_value.getInt();
1706}

References Slic3r::ConfigOptionInt::getInt(), m_data_valid, and m_grid_data.

Here is the call graph for this function:

◆ init_cols()

void Slic3r::GUI::ObjectGridTable::init_cols ( ObjectGrid * object_grid)
private
1877{
1878 const float font_size = 1.5f * wxGetApp().em_unit();
1879
1880
1881 // printable for object
1882 ObjectGridCol *col = new ObjectGridCol(coBool, "printable", ObjectGridTable::category_all, true, false, true, false, wxALIGN_CENTRE);
1883 col->size = object_grid->GetTextExtent(L("Printable")).x;
1884 m_col_data.push_back(col);
1885
1886 // reset icon for printable
1887 col = new ObjectGridCol(coBool, "printable_reset", ObjectGridTable::category_all, true, true, false, false, wxALIGN_LEFT);
1888 m_col_data.push_back(col);
1889
1890 //first column for plate_index
1891 col = new ObjectGridCol(coString, "plate_index", " ", true, false, false, false, wxALIGN_CENTRE); //bool only_object, bool icon, bool edit, bool config
1892 m_col_data.push_back(col);
1893
1894 //second column for module name
1895 /*col = new ObjectGridCol(coString, "assemble_name", ObjectGridTable::category_all, true, false, true, false, wxALIGN_CENTRE);
1896 m_col_data.push_back(col);*/
1897
1898 //3th column: for object/volume name
1899 col = new ObjectGridCol(coString, "name", ObjectGridTable::category_all, false, false, true, false, wxALIGN_LEFT);
1900 //col->size = 200;
1901 m_col_data.push_back(col);
1902
1903 //object/volume extruder_id
1904 col = new ObjectGridCol(coEnum, "extruder", ObjectGridTable::category_all, false, false, true, true, wxALIGN_CENTRE);
1905 col->size = 128;
1906 //the spec now guarantees vectors store their elements contiguously
1907 col->choices.assign(m_panel->m_filaments_name.begin(), m_panel->m_filaments_name.end());
1908 col->choice_count = m_panel->m_filaments_count;
1909 m_col_data.push_back(col);
1910
1911 //reset icon for extruder_id
1912 col = new ObjectGridCol(coString, "extruder_reset", ObjectGridTable::category_all, false, false, false, false, wxALIGN_CENTRE);
1913 m_col_data.push_back(col);
1914
1915 //object layer height
1916 col = new ObjectGridCol(coFloat, "layer_height", L("Quality"), true, false, true, true, wxALIGN_LEFT);
1917 col->size = object_grid->GetTextExtent(L("Layer height")).x - 28;
1918 m_col_data.push_back(col);
1919
1920 //reset icon for extruder_id
1921 col = new ObjectGridCol(coFloat, "layer_height_reset", L("Quality"), true, true, false, false, wxALIGN_LEFT);
1922 m_col_data.push_back(col);
1923
1924 //object/volume perimeters
1925 col = new ObjectGridCol(coInt, "wall_loops", L("Strength"), false, false, true, true, wxALIGN_CENTRE);
1926 col->size = object_grid->GetTextExtent(L("Wall loops")).x;
1927 m_col_data.push_back(col);
1928
1929 //reset icon for perimeters
1930 col = new ObjectGridCol(coInt, "wall_loops_reset", L("Strength"), false, true, false, false, wxALIGN_LEFT);
1931 m_col_data.push_back(col);
1932
1933 //object/volume fill density
1934 col = new ObjectGridCol(coPercent, "sparse_infill_density", L("Strength"), false, false, true, true, wxALIGN_CENTRE);
1935 col->size = object_grid->GetTextExtent(L("Infill density(%)")).x;
1936 m_col_data.push_back(col);
1937
1938 //reset icon for fill density
1939 col = new ObjectGridCol(coPercent, "fill_density_reset", L("Strength"), false, true, false, false, wxALIGN_LEFT);
1940 m_col_data.push_back(col);
1941
1942 //support material
1943 col = new ObjectGridCol(coBool, "enable_support", L("Support"), true, false, true, true, wxALIGN_CENTRE);
1944 col->size = object_grid->GetTextExtent(L("Support")).x;
1945 m_col_data.push_back(col);
1946
1947 //reset icon for support material
1948 col = new ObjectGridCol(coBool, "support_reset", L("Support"), true, true, false, false, wxALIGN_CENTRE);
1949 m_col_data.push_back(col);
1950
1951 //Bed Adhesion
1952 col = new ObjectGridCol(coEnum, "brim_type", L("Support"), true, false, true, true, wxALIGN_LEFT);
1953 col->size = object_grid->GetTextExtent(L("Auto Brim")).x + 8; //add 8 for border
1954 col->choices.Add(_L("Auto"));
1955 col->choices.Add(_L("Mouse ear"));
1956 col->choices.Add(_L("Painted"));
1957 col->choices.Add(_L("Outer brim only"));
1958 col->choices.Add(_L("Inner brim only"));
1959 col->choices.Add(_L("Outer and inner brim"));
1960 col->choices.Add(_L("No-brim"));
1961 col->choice_count = col->choices.size();
1962 m_col_data.push_back(col);
1963
1964 //reset icon for Bed Adhesion
1965 col = new ObjectGridCol(coEnum, "brim_type_reset", L("Support"), true, true, false, false, wxALIGN_LEFT);
1966 m_col_data.push_back(col);
1967
1968 // todo mutli_extruders:
1969 //object/volume speed
1970 col = new ObjectGridCol(coFloat, "outer_wall_speed", L("Speed"), false, false, true, true, wxALIGN_LEFT);
1971 col->size = object_grid->GetTextExtent(L("Outer wall speed")).x;
1972 m_col_data.push_back(col);
1973
1974 //reset icon for speed
1975 col = new ObjectGridCol(coFloat, "inner_wall_speed_reset", L("Speed"), false, true, false, false, wxALIGN_LEFT);
1976 m_col_data.push_back(col);
1977
1978 return;
1979}
#define L(s)
Definition ExtrusionEntity.cpp:25
#define _L(s)
Definition OBJ.cpp:34
static std::string category_all
Definition GUI_ObjectTable.hpp:286

References _L, category_all, Slic3r::GUI::ObjectGridTable::ObjectGridCol::choice_count, Slic3r::GUI::ObjectGridTable::ObjectGridCol::choices, Slic3r::coBool, Slic3r::coEnum, Slic3r::coFloat, Slic3r::coInt, Slic3r::coPercent, Slic3r::coString, L, m_col_data, m_panel, and Slic3r::GUI::ObjectGridTable::ObjectGridCol::size.

Referenced by construct_object_configs().

Here is the caller graph for this function:

◆ IsEmptyCell()

bool Slic3r::GUI::ObjectGridTable::IsEmptyCell ( int row,
int col )
virtual
1286{
1287 if (row == 0)
1288 return false;
1289
1290 ObjectGridCol* col_object = m_col_data[col];
1292
1293 if (col_object->b_for_object && (row_object->row_type == row_volume))
1294 return true;
1295
1296 return false;
1297}

References Slic3r::GUI::ObjectGridTable::ObjectGridCol::b_for_object, m_col_data, m_grid_data, row_object, and row_volume.

◆ OnCellLeftClick()

bool Slic3r::GUI::ObjectGridTable::OnCellLeftClick ( int row,
int col,
ConfigOptionType & type )
2556{
2557 bool consumed = false;
2558
2559 if (row == 0) {
2560 sort_by_col(col);
2561 } else if (col >= col_printable_reset) {
2562 ObjectGridRow *grid_row = m_grid_data[row - 1];
2563 ObjectGridCol* grid_col = m_col_data[col];
2564 ObjectGridCol* grid_col_2 = m_col_data[col - 1];
2565
2566 if (grid_col->b_icon) {
2567 ConfigOption& orig_option = (*grid_row)[(GridColType)col];
2568 ConfigOption& cur_option = (*grid_row)[(GridColType)(col-1)];
2569 //reset the value to original one
2570 if (cur_option != orig_option) {
2571 cur_option.set(&orig_option);
2572 if (grid_col_2->b_from_config) {
2573 if (col == col_filaments_reset) {
2574 update_filament_to_config(grid_row->config, grid_col_2->key, cur_option, orig_option, (grid_row->row_type == row_object));
2576 }
2577 else
2578 update_value_to_config(grid_row->config, grid_col_2->key, cur_option, orig_option);
2579 ObjectVolumeID object_volume_id;
2580 object_volume_id.object = m_panel->m_model->objects[grid_row->object_id];
2581 object_volume_id.volume = (grid_row->row_type == row_object) ? nullptr : object_volume_id.object->volumes[grid_row->volume_id];
2582 if (col == col_filaments_reset)
2583 wxGetApp().obj_list()->update_filament_values_for_items(m_panel->m_filaments_count);
2584 else
2585 wxGetApp().obj_list()->object_config_options_changed(object_volume_id);
2586
2587 //update the right side setting list
2588 bool is_object = (grid_row->row_type == row_object);
2589 ModelObject* object = m_panel->m_model->objects[grid_row->object_id];
2590 m_panel->m_side_window->Freeze();
2591 m_panel->m_object_settings->ValueChanged(row, is_object, object, grid_row->config, grid_col_2->category, grid_col_2->key);
2592 m_panel->m_side_window->Thaw();
2593 //m_panel->m_plater->update();
2594 }
2595 else {
2596 update_value_to_object(m_panel->m_model, grid_row, col - 1);
2597 }
2598 m_panel->m_object_grid->ForceRefresh();
2599 }
2600 consumed = true;
2601 }
2602 else
2603 type = grid_col->type;
2604 }
2605 return consumed;
2606}
void sort_by_col(int col)
Definition GUI_ObjectTable.cpp:2433
void update_filament_to_config(ModelConfig *config, std::string &key, ConfigOption &new_value, ConfigOption &ori_value, bool is_object)
Definition GUI_ObjectTable.cpp:1467
void update_value_to_object(Model *model, ObjectGridRow *grid_row, int col)
Definition GUI_ObjectTable.cpp:1535
void update_volume_values_from_object(int row, int col)
Definition GUI_ObjectTable.cpp:1495
void update_value_to_config(ModelConfig *config, std::string &key, ConfigOption &new_value, ConfigOption &ori_value)
Definition GUI_ObjectTable.cpp:1479

References Slic3r::GUI::ObjectGridTable::ObjectGridCol::b_from_config, Slic3r::GUI::ObjectGridTable::ObjectGridCol::b_icon, Slic3r::GUI::ObjectGridTable::ObjectGridCol::category, col_filaments_reset, col_printable_reset, Slic3r::GUI::ObjectGridTable::ObjectGridRow::config, Slic3r::GUI::ObjectGridTable::ObjectGridCol::key, m_col_data, m_grid_data, m_panel, Slic3r::GUI::ObjectVolumeID::object, Slic3r::GUI::ObjectGridTable::ObjectGridRow::object_id, row_object, Slic3r::GUI::ObjectGridTable::ObjectGridRow::row_type, sort_by_col(), Slic3r::GUI::ObjectGridTable::ObjectGridCol::type, update_filament_to_config(), update_value_to_config(), update_value_to_object(), update_volume_values_from_object(), Slic3r::GUI::ObjectVolumeID::volume, Slic3r::GUI::ObjectGridTable::ObjectGridRow::volume_id, and Slic3r::ModelObject::volumes.

Here is the call graph for this function:

◆ OnCellValueChanged()

void Slic3r::GUI::ObjectGridTable::OnCellValueChanged ( int row,
int col )
2676{
2677 if (row == 0) {
2678 //skip it
2679 }
2680 else if (col <= (int)col_filaments_reset) {
2681 //skip it
2682 }
2683 else {
2684 ObjectGridRow* grid_row = m_grid_data[row - 1];
2685 ObjectGridCol* grid_col = m_col_data[col];
2686 bool is_object = (grid_row->row_type == row_object);
2687 ModelObject* object = m_panel->m_model->objects[grid_row->object_id];
2688
2689 m_panel->m_side_window->Freeze();
2690
2691 m_panel->m_object_settings->ValueChanged(row, is_object, object, grid_row->config, grid_col->category, grid_col->key);
2692
2693 m_panel->m_side_window->Thaw();
2694 //update volume cell
2695 /*if (is_object) {
2696 int next_row = row + 1;
2697 DynamicPrintConfig& global_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
2698 while ((next_row - 1) < m_grid_data.size())
2699 {
2700 ObjectGridRow* part_row = m_grid_data[next_row - 1];
2701 if (part_row->row_type == row_volume) {
2702 reload_part_data(part_row, grid_row, grid_col->category, global_config);
2703 next_row++;
2704 }
2705 else
2706 break;
2707 }
2708 }*/
2709 //obj_list->update_extruder_values_for_items(m_panel->m_filaments_count);
2710 if (grid_col->b_from_config) {
2711 if (col != col_filaments) {//for col_filaments, no cellvaluechanged triggered
2712 ObjectVolumeID object_volume_id;
2713 object_volume_id.object = object;
2714 object_volume_id.volume = is_object ? nullptr : object->volumes[grid_row->volume_id];
2715 wxGetApp().obj_list()->object_config_options_changed(object_volume_id);
2716 //m_panel->m_plater->update();
2717 }
2718 }
2719 }
2720}

References Slic3r::GUI::ObjectGridTable::ObjectGridCol::b_from_config, Slic3r::GUI::ObjectGridTable::ObjectGridCol::category, col_filaments, col_filaments_reset, Slic3r::GUI::ObjectGridTable::ObjectGridRow::config, Slic3r::GUI::ObjectGridTable::ObjectGridCol::key, m_col_data, m_grid_data, m_panel, Slic3r::GUI::ObjectVolumeID::object, Slic3r::GUI::ObjectGridTable::ObjectGridRow::object_id, row_object, Slic3r::GUI::ObjectGridTable::ObjectGridRow::row_type, Slic3r::GUI::ObjectVolumeID::volume, and Slic3r::GUI::ObjectGridTable::ObjectGridRow::volume_id.

Referenced by Slic3r::GUI::ObjectGrid::paste_data().

Here is the caller graph for this function:

◆ OnRangeSelected()

void Slic3r::GUI::ObjectGridTable::OnRangeSelected ( int row,
int col,
int row_count,
int col_count )
2672{
2673}

◆ OnSelectCell()

void Slic3r::GUI::ObjectGridTable::OnSelectCell ( int row,
int col )
2609{
2610 m_selected_cells.clear();
2611 if (!m_panel->m_side_window)
2612 return;
2613 m_panel->m_side_window->Freeze();
2614 if (row == 0 || col == col_filaments) {
2615 m_panel->m_object_settings->UpdateAndShowRow(row, false, false, false, nullptr, nullptr, std::string());
2616 }
2617 else {
2618 ObjectGridRow* grid_row = m_grid_data[row - 1];
2619 ObjectGridCol* grid_col = m_col_data[col];
2620 bool is_object = (grid_row->row_type == row_object);
2621 ModelObject* object = m_panel->m_model->objects[grid_row->object_id];
2622
2623 //m_panel->m_object_settings->get_og()->set_name(GUI::from_u8(grid_row->name.value));
2624 //m_panel->m_page_text->SetLabel(GUI::from_u8(grid_row->name.value));
2625 m_panel->m_object_settings->UpdateAndShowRow(row, true, is_object, false, object, grid_row->config, grid_col->category);
2626
2627 std::vector<ObjectVolumeID> object_volume_ids;
2628 ObjectVolumeID object_volume_id;
2629 object_volume_id.object = object;
2630 object_volume_id.volume = (grid_row->row_type == row_object)?nullptr:object->volumes[grid_row->volume_id];
2631 object_volume_ids.push_back(object_volume_id);
2632 //disable multiple selection notify, only notify one selected item to object list
2633 /*wxGridCellCoordsArray cell_array = m_panel->m_object_grid->GetSelectedCells();
2634 int count = cell_array.size();
2635 if (count == 0) {
2636 ObjectVolumeID object_volume_id;
2637 object_volume_id.object = object;
2638 object_volume_id.volume = (grid_row->row_type == row_object)?nullptr:object->volumes[grid_row->volume_id];
2639 object_volume_ids.push_back(object_volume_id);
2640
2641 wxGridCellCoords cell_coord(row, col);
2642 m_selected_cells.push_back(cell_coord);
2643 }
2644 else {
2645 while (count > 0) {
2646 int cel_row = cell_array[count-1].GetRow();
2647 int cel_col = cell_array[count-1].GetCol();
2648 ObjectGridRow* grid_data = m_grid_data[cel_row - 1];
2649 object = m_panel->m_model->objects[grid_data->object_id];
2650 ObjectVolumeID object_volume_id;
2651 object_volume_id.object = object;
2652 object_volume_id.volume = (grid_data->row_type == row_object)?nullptr:object->volumes[grid_data->volume_id];
2653 object_volume_ids.push_back(object_volume_id);
2654 count --;
2655
2656 wxGridCellCoords cell_coord(cel_row, cel_col);
2657 m_selected_cells.push_back(cell_coord);
2658 }
2659 }*/
2660
2661 wxGetApp().obj_list()->select_items(object_volume_ids);
2662 }
2663 m_panel->m_side_window->Layout();
2664 //m_panel->m_side_window->ShowScrollbars(wxSHOW_SB_NEVER, wxSHOW_SB_ALWAYS);
2665 m_panel->m_side_window->Thaw();
2666 m_panel->Layout();
2667 m_current_row = row;
2668 m_current_col = col;
2669}
int m_current_col
Definition GUI_ObjectTable.hpp:555
int m_current_row
Definition GUI_ObjectTable.hpp:554

References Slic3r::GUI::ObjectGridTable::ObjectGridCol::category, col_filaments, Slic3r::GUI::ObjectGridTable::ObjectGridRow::config, m_col_data, m_current_col, m_current_row, m_grid_data, m_panel, m_selected_cells, Slic3r::GUI::ObjectVolumeID::object, Slic3r::GUI::ObjectGridTable::ObjectGridRow::object_id, row_object, Slic3r::GUI::ObjectGridTable::ObjectGridRow::row_type, Slic3r::GUI::ObjectVolumeID::volume, and Slic3r::GUI::ObjectGridTable::ObjectGridRow::volume_id.

◆ release_object_configs()

void Slic3r::GUI::ObjectGridTable::release_object_configs ( )
1825{
1826 if (m_grid_data.size() > 0)
1827 {
1828 for (int i = 0; i < m_grid_data.size(); i ++)
1829 {
1830 delete m_grid_data[i];
1831 }
1832 m_grid_data.clear();
1833 }
1834
1835 if (m_col_data.size() > 0)
1836 {
1837 for (int i = 0; i < m_col_data.size(); i ++)
1838 {
1839 delete m_col_data[i];
1840 }
1841 m_col_data.clear();
1842 }
1843
1844 m_data_valid = false;
1845
1846 return;
1847}

References m_col_data, m_data_valid, and m_grid_data.

Referenced by construct_object_configs().

Here is the caller graph for this function:

◆ reload_cell_data()

void Slic3r::GUI::ObjectGridTable::reload_cell_data ( int row,
const std::string & category )
2226{
2227 if (row == 0)
2228 return;
2229 ObjectGridRow* grid_row = m_grid_data[row - 1];
2230 DynamicPrintConfig& global_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
2231
2232 if (grid_row->row_type == row_object) {
2233 reload_object_data(grid_row, category, global_config);
2234
2235 int next_row = row + 1;
2236 while ((next_row - 1) < m_grid_data.size())
2237 {
2238 ObjectGridRow* part_row = m_grid_data[next_row - 1];
2239 if (part_row->row_type == row_volume) {
2240 reload_part_data(part_row, grid_row, category, global_config);
2241 next_row++;
2242 }
2243 else
2244 break;
2245 }
2246 }
2247 else {
2248 int next_row = row - 1;
2249 ObjectGridRow* object_row = m_grid_data[next_row - 1];
2250 while (object_row->row_type == row_volume)
2251 {
2252 next_row --;
2253 object_row = m_grid_data[next_row - 1];
2254 }
2255 reload_part_data(grid_row, object_row, category, global_config);
2256 }
2257 m_panel->m_object_grid->ForceRefresh();
2258
2259 ObjectVolumeID object_volume_id;
2260 object_volume_id.object = m_panel->m_model->objects[grid_row->object_id];
2261 object_volume_id.volume = (grid_row->row_type == row_object)?nullptr:object_volume_id.object->volumes[grid_row->volume_id];
2262 wxGetApp().obj_list()->object_config_options_changed(object_volume_id);
2263 if (object_volume_id.volume)
2264 dynamic_cast<TabPrintModel*>(wxGetApp().get_model_tab(true))->update_model_config();
2265 else
2266 dynamic_cast<TabPrintModel*>(wxGetApp().get_model_tab())->update_model_config();
2267 //m_panel->m_plater->update();
2268}
void reload_part_data(ObjectGridRow *volume_row, ObjectGridRow *object_row, const std::string &category, DynamicPrintConfig &global_config)
Definition GUI_ObjectTable.cpp:2166
void reload_object_data(ObjectGridRow *grid_row, const std::string &category, DynamicPrintConfig &global_config)
Definition GUI_ObjectTable.cpp:2126

References m_grid_data, m_panel, Slic3r::GUI::ObjectVolumeID::object, Slic3r::GUI::ObjectGridTable::ObjectGridRow::object_id, reload_object_data(), reload_part_data(), row_object, Slic3r::GUI::ObjectGridTable::ObjectGridRow::row_type, row_volume, Slic3r::GUI::ObjectVolumeID::volume, Slic3r::GUI::ObjectGridTable::ObjectGridRow::volume_id, and Slic3r::ModelObject::volumes.

Here is the call graph for this function:

◆ reload_object_data()

void Slic3r::GUI::ObjectGridTable::reload_object_data ( ObjectGridRow * grid_row,
const std::string & category,
DynamicPrintConfig & global_config )
2127{
2128 if (category == ObjectGridTable::category_all) {
2129 grid_row->layer_height = *(get_object_config_value<ConfigOptionFloat>(global_config, grid_row->config, m_col_data[col_layer_height]->key));
2130 grid_row->ori_layer_height = *(global_config.option<ConfigOptionFloat>(m_col_data[col_layer_height]->key));
2131 grid_row->wall_loops = *(get_object_config_value<ConfigOptionInt>(global_config, grid_row->config, m_col_data[col_wall_loops]->key));
2132 grid_row->ori_wall_loops = *(global_config.option<ConfigOptionInt>(m_col_data[col_wall_loops]->key));
2133 grid_row->sparse_infill_density = *(get_object_config_value<ConfigOptionPercent>(global_config, grid_row->config, m_col_data[col_fill_density]->key));
2134 grid_row->ori_fill_density = *(global_config.option<ConfigOptionPercent>(m_col_data[col_fill_density]->key));
2135 grid_row->enable_support = *(get_object_config_value<ConfigOptionBool>(global_config, grid_row->config, m_col_data[col_enable_support]->key));
2136 grid_row->ori_enable_support = *(global_config.option<ConfigOptionBool>(m_col_data[col_enable_support]->key));
2137 grid_row->brim_type = *(get_object_config_value<ConfigOptionEnum<BrimType>>(global_config, grid_row->config, m_col_data[col_brim_type]->key));
2138 grid_row->ori_brim_type = *(global_config.option<ConfigOptionEnum<BrimType>>(m_col_data[col_brim_type]->key));
2139 grid_row->speed_perimeter = *(get_object_config_value<ConfigOptionFloatsNullable>(global_config, grid_row->config, m_col_data[col_speed_perimeter]->key));
2140 grid_row->ori_speed_perimeter = *(global_config.option<ConfigOptionFloatsNullable>(m_col_data[col_speed_perimeter]->key));
2141 }
2142 else if (category == L("Quality")) {
2143 grid_row->layer_height = *(get_object_config_value<ConfigOptionFloat>(global_config, grid_row->config, m_col_data[col_layer_height]->key));
2144 grid_row->ori_layer_height = *(global_config.option<ConfigOptionFloat>(m_col_data[col_layer_height]->key));
2145 }
2146 else if (category == L("Strength")) {
2147 grid_row->wall_loops = *(get_object_config_value<ConfigOptionInt>(global_config, grid_row->config, m_col_data[col_wall_loops]->key));
2148 grid_row->ori_wall_loops = *(global_config.option<ConfigOptionInt>(m_col_data[col_wall_loops]->key));
2149
2150 grid_row->sparse_infill_density = *(get_object_config_value<ConfigOptionPercent>(global_config, grid_row->config, m_col_data[col_fill_density]->key));
2151 grid_row->ori_fill_density = *(global_config.option<ConfigOptionPercent>(m_col_data[col_fill_density]->key));
2152 }
2153 else if (category == L("Support")) {
2154 grid_row->enable_support = *(get_object_config_value<ConfigOptionBool>(global_config, grid_row->config, m_col_data[col_enable_support]->key));
2155 grid_row->ori_enable_support = *(global_config.option<ConfigOptionBool>(m_col_data[col_enable_support]->key));
2156
2157 grid_row->brim_type = *(get_object_config_value<ConfigOptionEnum<BrimType>>(global_config, grid_row->config, m_col_data[col_brim_type]->key));
2158 grid_row->ori_brim_type = *(global_config.option<ConfigOptionEnum<BrimType>>(m_col_data[col_brim_type]->key));
2159 }
2160 else if (category == L("Speed")) {
2161 grid_row->speed_perimeter = *(get_object_config_value<ConfigOptionFloatsNullable>(global_config, grid_row->config, m_col_data[col_speed_perimeter]->key));
2162 grid_row->ori_speed_perimeter = *(global_config.option<ConfigOptionFloatsNullable>(m_col_data[col_speed_perimeter]->key));
2163 }
2164}

References Slic3r::GUI::ObjectGridTable::ObjectGridRow::brim_type, category_all, col_brim_type, col_enable_support, col_fill_density, col_layer_height, col_speed_perimeter, col_wall_loops, Slic3r::GUI::ObjectGridTable::ObjectGridRow::config, Slic3r::GUI::ObjectGridTable::ObjectGridRow::enable_support, get_object_config_value(), L, Slic3r::GUI::ObjectGridTable::ObjectGridRow::layer_height, m_col_data, Slic3r::ConfigBase::option(), Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_brim_type, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_enable_support, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_fill_density, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_layer_height, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_speed_perimeter, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_wall_loops, Slic3r::GUI::ObjectGridTable::ObjectGridRow::sparse_infill_density, Slic3r::GUI::ObjectGridTable::ObjectGridRow::speed_perimeter, and Slic3r::GUI::ObjectGridTable::ObjectGridRow::wall_loops.

Referenced by reload_cell_data().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reload_part_data()

void Slic3r::GUI::ObjectGridTable::reload_part_data ( ObjectGridRow * volume_row,
ObjectGridRow * object_row,
const std::string & category,
DynamicPrintConfig & global_config )
2167{
2168 if (category == ObjectGridTable::category_all) {
2169 volume_row->layer_height = *(get_volume_config_value<ConfigOptionFloat>(global_config, object_row->config, volume_row->config, m_col_data[col_layer_height]->key));
2170 volume_row->ori_layer_height = object_row->layer_height;
2171 volume_row->wall_loops = *(get_volume_config_value<ConfigOptionInt>(global_config, object_row->config, volume_row->config, m_col_data[col_wall_loops]->key));
2172 volume_row->ori_wall_loops = object_row->wall_loops;
2173 volume_row->sparse_infill_density = *(get_volume_config_value<ConfigOptionPercent>(global_config, object_row->config, volume_row->config, m_col_data[col_fill_density]->key));
2174 volume_row->ori_fill_density = object_row->sparse_infill_density;
2175 volume_row->enable_support = *(get_volume_config_value<ConfigOptionBool>(global_config, object_row->config, volume_row->config, m_col_data[col_enable_support]->key));
2176 volume_row->ori_enable_support = object_row->enable_support;
2177 volume_row->brim_type = *(get_volume_config_value<ConfigOptionEnum<BrimType>>(global_config, object_row->config, volume_row->config, m_col_data[col_brim_type]->key));
2178 volume_row->ori_brim_type = object_row->brim_type;
2179 volume_row->speed_perimeter = *(get_volume_config_value<ConfigOptionFloatsNullable>(global_config, object_row->config, volume_row->config, m_col_data[col_speed_perimeter]->key));
2180 volume_row->ori_speed_perimeter = object_row->speed_perimeter;
2181 }
2182 else if (category == L("Quality")) {
2183 volume_row->layer_height = *(get_volume_config_value<ConfigOptionFloat>(global_config, object_row->config, volume_row->config, m_col_data[col_layer_height]->key));
2184 if (volume_row->layer_height == object_row->layer_height) {
2185 volume_row->config->erase(m_col_data[col_layer_height]->key);
2186 }
2187 volume_row->ori_layer_height = object_row->layer_height;
2188 }
2189 else if (category == L("Strength")) {
2190 volume_row->wall_loops = *(get_volume_config_value<ConfigOptionInt>(global_config, object_row->config, volume_row->config, m_col_data[col_wall_loops]->key));
2191 if (volume_row->wall_loops == object_row->wall_loops) {
2192 volume_row->config->erase(m_col_data[col_wall_loops]->key);
2193 }
2194 volume_row->ori_wall_loops = object_row->wall_loops;
2195
2196 volume_row->sparse_infill_density = *(get_volume_config_value<ConfigOptionPercent>(global_config, object_row->config, volume_row->config, m_col_data[col_fill_density]->key));
2197 if (volume_row->sparse_infill_density == object_row->sparse_infill_density) {
2198 volume_row->config->erase(m_col_data[col_fill_density]->key);
2199 }
2200 volume_row->ori_fill_density = object_row->sparse_infill_density;
2201 }
2202 else if (category == L("Support")) {
2203 volume_row->enable_support = *(get_volume_config_value<ConfigOptionBool>(global_config, object_row->config, volume_row->config, m_col_data[col_enable_support]->key));
2204 if (volume_row->enable_support == object_row->enable_support) {
2205 volume_row->config->erase(m_col_data[col_enable_support]->key);
2206 }
2207 volume_row->ori_enable_support = object_row->enable_support;
2208
2209 volume_row->brim_type = *(get_volume_config_value<ConfigOptionEnum<BrimType>>(global_config, object_row->config, volume_row->config, m_col_data[col_brim_type]->key));
2210 if (volume_row->brim_type == object_row->brim_type) {
2211 volume_row->config->erase(m_col_data[col_brim_type]->key);
2212 }
2213 volume_row->ori_brim_type = object_row->brim_type;
2214 }
2215 else if (category == L("Speed")) {
2216 volume_row->speed_perimeter = *(get_volume_config_value<ConfigOptionFloatsNullable>(global_config, object_row->config, volume_row->config, m_col_data[col_speed_perimeter]->key));
2217 if (volume_row->speed_perimeter == object_row->speed_perimeter) {
2218 volume_row->config->erase(m_col_data[col_speed_perimeter]->key);
2219 }
2220 volume_row->ori_speed_perimeter = object_row->speed_perimeter;
2221 }
2222}

References Slic3r::GUI::ObjectGridTable::ObjectGridRow::brim_type, category_all, col_brim_type, col_enable_support, col_fill_density, col_layer_height, col_speed_perimeter, col_wall_loops, Slic3r::GUI::ObjectGridTable::ObjectGridRow::config, Slic3r::GUI::ObjectGridTable::ObjectGridRow::enable_support, Slic3r::ModelConfig::erase(), get_volume_config_value(), L, Slic3r::GUI::ObjectGridTable::ObjectGridRow::layer_height, m_col_data, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_brim_type, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_enable_support, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_fill_density, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_layer_height, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_speed_perimeter, Slic3r::GUI::ObjectGridTable::ObjectGridRow::ori_wall_loops, Slic3r::GUI::ObjectGridTable::ObjectGridRow::sparse_infill_density, Slic3r::GUI::ObjectGridTable::ObjectGridRow::speed_perimeter, and Slic3r::GUI::ObjectGridTable::ObjectGridRow::wall_loops.

Referenced by reload_cell_data(), and update_volume_values_from_object().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetValuesInCurrentCell()

void Slic3r::GUI::ObjectGridTable::resetValuesInCurrentCell ( wxEvent & WXUNUSEDevent)
2736{
2737 //return for the first row
2738 if (m_current_row <= 0)
2739 return;
2740
2741 ObjectGridRow* grid_row = m_grid_data[m_current_row - 1];
2743 bool is_object = (grid_row->row_type == row_object);
2744 ModelObject* object = m_panel->m_model->objects[grid_row->object_id];
2745
2746 m_panel->resetAllValuesInSideWindow(m_current_row, is_object, object, grid_row->config, grid_col->category);
2747}

References Slic3r::GUI::ObjectGridTable::ObjectGridCol::category, Slic3r::GUI::ObjectGridTable::ObjectGridRow::config, m_col_data, m_current_col, m_current_row, m_grid_data, m_panel, Slic3r::GUI::ObjectGridTable::ObjectGridRow::object_id, row_object, and Slic3r::GUI::ObjectGridTable::ObjectGridRow::row_type.

◆ SetColLabelValue()

void Slic3r::GUI::ObjectGridTable::SetColLabelValue ( int col,
const wxString & value )
1795{
1796 if ( col > (int)(m_colLabels.GetCount()) - 1 )
1797 {
1798 int n = m_colLabels.GetCount();
1799 int i;
1800
1801 for ( i = n; i <= col; i++ )
1802 {
1803 m_colLabels.Add( wxGridTableBase::GetColLabelValue(i) );
1804 }
1805 }
1806
1807 m_colLabels[col] = value;
1808}

References m_colLabels.

◆ SetSelection()

void Slic3r::GUI::ObjectGridTable::SetSelection ( int object_id,
int volume_id )
2105{
2106 BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(", set selection to object %1% part %2%") %object_id %volume_id;
2107 //invalid object, skip
2108 if ((object_id == -1)&&(volume_id == -1))
2109 return;
2110
2111 for (int index = 0; index < m_grid_data.size(); index++)
2112 {
2113 ObjectGridRow* row = m_grid_data[index];
2114 if (row->object_id == object_id) {
2115 if ((volume_id == -1) || ((volume_id == row->volume_id)&&(row->row_type == row_volume))) {
2116 m_panel->m_object_grid->SelectRow(index+1);
2117 m_panel->m_object_grid->MakeCellVisible(index + 1, 0);
2118 BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(", found row %1%") %index;
2119 break;
2120 }
2121 }
2122 }
2123 BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(", can not find row");
2124}

References m_grid_data, m_panel, Slic3r::GUI::ObjectGridTable::ObjectGridRow::object_id, Slic3r::GUI::ObjectGridTable::ObjectGridRow::row_type, row_volume, and Slic3r::GUI::ObjectGridTable::ObjectGridRow::volume_id.

◆ SetValue()

void Slic3r::GUI::ObjectGridTable::SetValue ( int row,
int col,
const wxString & value )
virtual
1582{
1583 if (row == 0)
1584 return;
1585 ObjectGridRow* grid_row = m_grid_data[row - 1];
1586 ObjectGridCol* grid_col = m_col_data[col];
1587 ObjectList* obj_list = wxGetApp().obj_list();
1588 if (grid_col->type == coEnum) {
1589 int enum_value = 0;
1590 for (int i = 0; i < grid_col->choice_count; i++)
1591 {
1592 if (grid_col->choices[i] == value) {
1593 enum_value = i;
1594 break;
1595 }
1596 else if ((col == col_filaments)&&(value.substr(0,2) == grid_col->choices[i].substr(0,2))){
1597 enum_value = i;
1598 break;
1599 }
1600 }
1601 if (col == col_brim_type) {
1602 ConfigOptionEnum<BrimType>& option_value = dynamic_cast<ConfigOptionEnum<BrimType>&>((*grid_row)[(GridColType)col]);
1603 ConfigOptionEnum<BrimType>& option_ori_value = dynamic_cast<ConfigOptionEnum<BrimType>&>((*grid_row)[(GridColType)(col + 1)]);
1604
1605 option_value.value = (BrimType)enum_value;
1606 update_value_to_config(grid_row->config, grid_col->key, option_value, option_ori_value);
1607 }
1608 else if (col == col_filaments) {
1609 ConfigOptionInt& option_value = dynamic_cast<ConfigOptionInt&>((*grid_row)[(GridColType)col]);
1610 ConfigOptionInt& option_ori_value = dynamic_cast<ConfigOptionInt&>((*grid_row)[(GridColType)(col + 1)]);
1611
1612 option_value.value = enum_value + 1;
1613 update_filament_to_config(grid_row->config, grid_col->key, option_value, option_ori_value, (grid_row->row_type == row_object));
1615 wxGetApp().obj_list()->update_filament_values_for_items(m_panel->m_filaments_count);
1616 //m_panel->m_plater->update();
1617 }
1618 }
1619 else if (grid_col->type == coBool) {
1620 ConfigOptionBool &option_value = dynamic_cast<ConfigOptionBool &>((*grid_row)[(GridColType)col]);
1621 ConfigOptionBool &option_ori_value = dynamic_cast<ConfigOptionBool &>((*grid_row)[(GridColType)(col+1)]);
1622
1623 option_value.value = (wxAtoi(value) == 1)?true:false;
1624
1625 if (grid_col->b_from_config) {
1626 update_value_to_config(grid_row->config, grid_col->key, option_value, option_ori_value);
1627 }
1628 else {
1629 update_value_to_object(m_panel->m_model, grid_row, col);
1630 }
1631 } else if (grid_col->type == coFloat) {
1632 if (auto option_values = dynamic_cast<ConfigOptionFloatsNullable*>(&(*grid_row)[(GridColType) col])) {
1633 ConfigOptionFloatsNullable& option_ori_values = dynamic_cast<ConfigOptionFloatsNullable&>((*grid_row)[(GridColType) (col + 1)]);
1634
1635 double double_value;
1636 value.ToDouble(&double_value);
1637 option_values->values.at(0) = (float) double_value;
1638
1639 update_value_to_config(grid_row->config, grid_col->key, *option_values, option_ori_values);
1640 } else {
1641 ConfigOptionFloat& option_value = dynamic_cast<ConfigOptionFloat&>((*grid_row)[(GridColType) col]);
1642 ConfigOptionFloat& option_ori_value = dynamic_cast<ConfigOptionFloat&>((*grid_row)[(GridColType) (col + 1)]);
1643
1644 double double_value;
1645 value.ToDouble(&double_value);
1646 option_value.value = (float) double_value;
1647
1648 update_value_to_config(grid_row->config, grid_col->key, option_value, option_ori_value);
1649 }
1650 }
1651 else if (grid_col->type == coInt) {
1652 ConfigOptionInt &option_value = dynamic_cast<ConfigOptionInt &>((*grid_row)[(GridColType)col]);
1653 ConfigOptionInt &option_ori_value = dynamic_cast<ConfigOptionInt &>((*grid_row)[(GridColType)(col+1)]);
1654 long int_value;
1655 value.ToLong(&int_value);
1656
1657 option_value.value = (int) int_value;
1658 update_value_to_config(grid_row->config, grid_col->key, option_value, option_ori_value);
1659 }
1660 else if (grid_col->type == coPercent) {
1661 double double_value;
1662 value.ToDouble(&double_value);
1663 if ((double_value > 100.f) || (double_value < 0.f))
1664 return;
1665 ConfigOptionFloat &option_value = dynamic_cast<ConfigOptionFloat &>((*grid_row)[(GridColType)col]);
1666 ConfigOptionFloat &option_ori_value = dynamic_cast<ConfigOptionFloat &>((*grid_row)[(GridColType)(col+1)]);
1667
1668 option_value.value = (float)double_value;
1669
1670 update_value_to_config(grid_row->config, grid_col->key, option_value, option_ori_value);
1671 }
1672 else {
1673 if (grid_col->b_from_config) {
1674 ConfigOptionString& option_value = dynamic_cast<ConfigOptionString&>((*grid_row)[(GridColType)col]);
1675 ConfigOptionString& option_ori_value = dynamic_cast<ConfigOptionString&>((*grid_row)[(GridColType)(col + 1)]);
1676
1677 option_value.value = into_u8(value);
1678 update_value_to_config(grid_row->config, grid_col->key, option_value, option_ori_value);
1679 }
1680 else {
1681 ConfigOptionString& option_value = dynamic_cast<ConfigOptionString&>((*grid_row)[(GridColType)col]);
1682
1683 if (grid_row->row_type == row_volume) {
1684 //std::string new_value = value.ToStdString();
1685 std::string new_value = into_u8(value);
1686 size_t pos = new_value.find_first_not_of(' ');
1687 if (pos > 0)
1688 new_value.erase(0, pos);
1689 option_value.value = new_value;
1690 }
1691 else
1692 option_value.value = into_u8(value);
1693 update_value_to_object(m_panel->m_model, grid_row, col);
1694 }
1695 }
1696}
std::vector< double > values
Definition Config.hpp:418
static ObjectList * obj_list()
Definition GUI_Factories.cpp:405
std::string into_u8(const wxString &str)
Definition GUI.cpp:549
@ ObjectList
Definition Shortcuts.hpp:21
BrimType
Definition PrintConfig.hpp:454

References Slic3r::GUI::ObjectGridTable::ObjectGridCol::b_from_config, Slic3r::GUI::ObjectGridTable::ObjectGridCol::choice_count, Slic3r::GUI::ObjectGridTable::ObjectGridCol::choices, Slic3r::coBool, Slic3r::coEnum, Slic3r::coFloat, Slic3r::coInt, col_brim_type, col_filaments, Slic3r::GUI::ObjectGridTable::ObjectGridRow::config, Slic3r::coPercent, Slic3r::GUI::into_u8(), Slic3r::GUI::ObjectGridTable::ObjectGridCol::key, m_col_data, m_grid_data, m_panel, Slic3r::GUI::obj_list(), row_object, Slic3r::GUI::ObjectGridTable::ObjectGridRow::row_type, row_volume, Slic3r::GUI::ObjectGridTable::ObjectGridCol::type, update_filament_to_config(), update_value_to_config(), update_value_to_object(), update_volume_values_from_object(), and Slic3r::ConfigOptionSingle< T >::value.

Referenced by Slic3r::GUI::GridCellChoiceEditor::DoActivate(), Slic3r::GUI::GridCellFilamentsEditor::DoActivate(), and Slic3r::GUI::ObjectGrid::paste_data().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetValueAsBool()

void Slic3r::GUI::ObjectGridTable::SetValueAsBool ( int row,
int col,
bool value )
virtual
1745{
1746 ObjectGridRow* grid_row = m_grid_data[row - 1];
1747 ObjectGridCol* grid_col = m_col_data[col];
1748 ConfigOptionBool &option_value = dynamic_cast<ConfigOptionBool &>((*grid_row)[(GridColType)col]);
1749 ConfigOptionBool &option_ori_value = dynamic_cast<ConfigOptionBool &>((*grid_row)[(GridColType)(col+1)]);
1750
1751 option_value.value = (int) value;
1752
1753 if (grid_col->b_from_config) {
1754 update_value_to_config(grid_row->config, grid_col->key, option_value, option_ori_value);
1755 }
1756 else {
1757 update_value_to_object(m_panel->m_model, grid_row, col);
1758 }
1759 m_panel->m_object_grid->ForceRefresh();
1760
1761 return;
1762}

References Slic3r::GUI::ObjectGridTable::ObjectGridCol::b_from_config, Slic3r::GUI::ObjectGridTable::ObjectGridRow::config, Slic3r::GUI::ObjectGridTable::ObjectGridCol::key, m_col_data, m_grid_data, m_panel, update_value_to_config(), update_value_to_object(), and Slic3r::ConfigOptionSingle< T >::value.

Here is the call graph for this function:

◆ SetValueAsDouble()

void Slic3r::GUI::ObjectGridTable::SetValueAsDouble ( int row,
int col,
double value )
virtual
1765{
1766 ObjectGridRow* grid_row = m_grid_data[row - 1];
1767 ObjectGridCol* grid_col = m_col_data[col];
1768
1769 if (grid_col->type == coPercent) {
1770 if ((value > 100.f) || (value < 0.f))
1771 return;
1772 }
1773
1774 if (auto option_values = dynamic_cast<ConfigOptionFloatsNullable *>(&(*grid_row)[(GridColType) col])) {
1775 ConfigOptionFloatsNullable &option_ori_values = dynamic_cast<ConfigOptionFloatsNullable &>((*grid_row)[(GridColType) (col + 1)]);
1776
1777 option_values->values.at(0) = (float) value;
1778
1779 update_value_to_config(grid_row->config, grid_col->key, *option_values, option_ori_values);
1780
1781 return;
1782 }
1783
1784 ConfigOptionFloat &option_value = dynamic_cast<ConfigOptionFloat &>((*grid_row)[(GridColType)col]);
1785 ConfigOptionFloat &option_ori_value = dynamic_cast<ConfigOptionFloat &>((*grid_row)[(GridColType)(col+1)]);
1786
1787 option_value.value = (float)value;
1788
1789 update_value_to_config(grid_row->config, grid_col->key, option_value, option_ori_value);
1790
1791 return;
1792}

References Slic3r::GUI::ObjectGridTable::ObjectGridRow::config, Slic3r::coPercent, Slic3r::GUI::ObjectGridTable::ObjectGridCol::key, m_col_data, m_grid_data, Slic3r::GUI::ObjectGridTable::ObjectGridCol::type, update_value_to_config(), and Slic3r::ConfigOptionSingle< T >::value.

Here is the call graph for this function:

◆ SetValueAsLong()

void Slic3r::GUI::ObjectGridTable::SetValueAsLong ( int row,
int col,
long value )
virtual
1732{
1733 ObjectGridRow* grid_row = m_grid_data[row - 1];
1734 ObjectGridCol* grid_col = m_col_data[col];
1735 ConfigOptionInt &option_value = dynamic_cast<ConfigOptionInt &>((*grid_row)[(GridColType)col]);
1736 ConfigOptionInt &option_ori_value = dynamic_cast<ConfigOptionInt &>((*grid_row)[(GridColType)(col+1)]);
1737
1738 option_value.value = (int) value;
1739 update_value_to_config(grid_row->config, grid_col->key, option_value, option_ori_value);
1740
1741 return;
1742}

References Slic3r::GUI::ObjectGridTable::ObjectGridRow::config, Slic3r::GUI::ObjectGridTable::ObjectGridCol::key, m_col_data, m_grid_data, update_value_to_config(), and Slic3r::ConfigOptionSingle< T >::value.

Here is the call graph for this function:

◆ sort_by_col()

void Slic3r::GUI::ObjectGridTable::sort_by_col ( int col)
2434{
2435 //handle the sort logic
2436 if (col == col_name) {
2437 if (m_sort_col == col) {
2438 auto sort_func = [](ObjectGridRow* row1, ObjectGridRow* row2) {
2439 return (row2->name.value.compare(row1->name.value) < 0);
2440 };
2441 //sort_by_name();
2442 sort_row_data(sort_func);
2443 m_sort_col = -1;
2444 }
2445 else {
2446 auto sort_func = [](ObjectGridRow* row1, ObjectGridRow* row2) {
2447 return (row1->name.value.compare(row2->name.value) < 0);
2448 };
2449 //sort_by_name();
2450 sort_row_data(sort_func);
2451 m_sort_col = col;
2452 }
2453 }
2454 else if (col == col_filaments) {
2455 if (m_sort_col == col) {
2456 auto sort_func = [](ObjectGridRow* row1, ObjectGridRow* row2) {
2457 return (std::to_string(row2->filaments.value).compare(std::to_string(row1->filaments.value)) < 0);
2458 };
2459 sort_row_data(sort_func);
2460 m_sort_col = -1;
2461 }
2462 else {
2463 auto sort_func = [](ObjectGridRow* row1, ObjectGridRow* row2) {
2464 return (std::to_string(row1->filaments.value).compare(std::to_string(row2->filaments.value)) < 0);
2465 };
2466 sort_row_data(sort_func);
2467 m_sort_col = col;
2468 }
2469 }
2470 //else if (col == col_assemble_name) {
2471 // if (m_sort_col == col) {
2472 // compare_row_func sort_func = [](ObjectGridRow* row1, ObjectGridRow* row2) {
2473 // //wxString string1 = GUI::from_u8(row1->assemble_name.value);
2474 // //wxString string2 = GUI::from_u8(row2->assemble_name.value);
2475 // //return (string1.compare(string2) <= 0);
2476 // return (row2->assemble_name.value.compare(row1->assemble_name.value) < 0);
2477 // };
2478 // sort_row_data(sort_func);
2479 // m_sort_col = -1;
2480 // }
2481 // else {
2482 // compare_row_func sort_func = [](ObjectGridRow* row1, ObjectGridRow* row2) {
2483 // //wxString string1 = GUI::from_u8(row1->assemble_name.value);
2484 // //wxString string2 = GUI::from_u8(row2->assemble_name.value);
2485 // //return (string1.compare(string2) <= 0);
2486 // return (row1->assemble_name.value.compare(row2->assemble_name.value) < 0);
2487 // };
2488 // sort_row_data(sort_func);
2489 // m_sort_col = col;
2490 // }
2491 //}
2492 else if (col == col_plate_index) {
2493 if (m_sort_col == col) {
2494 compare_row_func sort_func = [](ObjectGridRow* row1, ObjectGridRow* row2) {
2495 int plate_1, plate_2;
2496 std::string row1_plate = row1->plate_index.value;
2497 std::string row2_plate = row2->plate_index.value;
2498 bool result = false;
2499
2500 if (row1_plate == ObjectGridTable::plate_outside)
2501 plate_1 = 100;
2502 else
2503 plate_1 = std::atoi(row1_plate.c_str());
2504 if (row2_plate == ObjectGridTable::plate_outside)
2505 plate_2 = 100;
2506 else
2507 plate_2 = std::atoi(row2_plate.c_str());
2508
2509 if (plate_2 < plate_1)
2510 result = true;
2511 else if (plate_1 == plate_2) {
2512 std::string row1_name = row1->name.value;
2513 std::string row2_name = row2->name.value;
2514 result = (row2_name < row1_name);
2515 }
2516 return result;
2517 };
2518 sort_row_data(sort_func);
2519 m_sort_col = -1;
2520 }
2521 else {
2522 compare_row_func sort_func = [](ObjectGridRow* row1, ObjectGridRow* row2) {
2523 int plate_1, plate_2;
2524 std::string row1_plate = row1->plate_index.value;
2525 std::string row2_plate = row2->plate_index.value;
2526 bool result = false;
2527
2528 if (row1_plate == ObjectGridTable::plate_outside)
2529 plate_1 = 100;
2530 else
2531 plate_1 = std::atoi(row1_plate.c_str());
2532 if (row2_plate == ObjectGridTable::plate_outside)
2533 plate_2 = 100;
2534 else
2535 plate_2 = std::atoi(row2_plate.c_str());
2536
2537 if (plate_1 < plate_2)
2538 result = true;
2539 else if (plate_1 == plate_2) {
2540 std::string row1_name = row1->name.value;
2541 std::string row2_name = row2->name.value;
2542 result = (row1_name < row2_name);
2543 }
2544 return result;
2545 };
2546 sort_row_data(sort_func);
2547 m_sort_col = col;
2548 }
2549 }
2550
2551 return;
2552}
int m_sort_col
Definition GUI_ObjectTable.hpp:547
std::function< bool(ObjectGridRow *row1, ObjectGridRow *row2)> compare_row_func
Definition GUI_ObjectTable.hpp:421
void sort_row_data(compare_row_func sort_func)
Definition GUI_ObjectTable.cpp:2390

References col_filaments, col_name, col_plate_index, Slic3r::GUI::ObjectGridTable::ObjectGridRow::filaments, m_sort_col, Slic3r::GUI::ObjectGridTable::ObjectGridRow::name, Slic3r::GUI::ObjectGridTable::ObjectGridRow::plate_index, plate_outside, sort_row_data(), and Slic3r::ConfigOptionSingle< T >::value.

Referenced by OnCellLeftClick(), and Slic3r::GUI::ObjectGrid::OnColHeadLeftClick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sort_by_default()

void Slic3r::GUI::ObjectGridTable::sort_by_default ( )
2361{
2362 compare_row_func sort_func = [](ObjectGridRow* row1, ObjectGridRow* row2) {
2363 int plate_1, plate_2;
2364 std::string row1_plate = row1->plate_index.value;
2365 std::string row2_plate = row2->plate_index.value;
2366 bool result = false;
2367
2368 if (row1_plate == ObjectGridTable::plate_outside)
2369 plate_1 = 100;
2370 else
2371 plate_1 = std::atoi(row1_plate.c_str());
2372 if (row2_plate == ObjectGridTable::plate_outside)
2373 plate_2 = 100;
2374 else
2375 plate_2 = std::atoi(row2_plate.c_str());
2376
2377 if (plate_1 < plate_2)
2378 result = true;
2379 else if (row1_plate == row2_plate) {
2380 std::string row1_name = row1->name.value;
2381 std::string row2_name = row2->name.value;
2382 result = (row1_name < row2_name);
2383 }
2384 return result;
2385 };
2386 sort_row_data(sort_func);
2387 m_sort_col = 0;
2388}

References m_sort_col, Slic3r::GUI::ObjectGridTable::ObjectGridRow::name, Slic3r::GUI::ObjectGridTable::ObjectGridRow::plate_index, plate_outside, sort_row_data(), and Slic3r::ConfigOptionSingle< T >::value.

Here is the call graph for this function:

◆ sort_row_data()

void Slic3r::GUI::ObjectGridTable::sort_row_data ( compare_row_func sort_func)
private
2391{
2392 int size = m_grid_data.size();
2393 if (!size)
2394 return;
2395
2396 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" enter, this %1%, row_data size %2%") %this % m_grid_data.size();
2397 std::list<ObjectGridRow*> new_grid_rows;
2398 for ( auto it = m_grid_data.begin(); it != m_grid_data.end(); it++ )
2399 {
2400 if ((*it)->row_type == row_object)
2401 new_grid_rows.push_back(*it);
2402 }
2403 new_grid_rows.sort(sort_func);
2404 //std::sort(new_grid_rows.begin(), new_grid_rows.end(), sort_func);
2405 auto it = new_grid_rows.begin();
2406 while( it != new_grid_rows.end() )
2407 {
2408 if ((*it)->row_type != row_object) {
2409 ++it;
2410 continue;
2411 }
2412 auto origin_it = find(m_grid_data.begin(), m_grid_data.end(), *it);
2413 //move it to next for insert
2414 ++it;
2415 if (origin_it == m_grid_data.end()) //should not happen, finished
2416 break;
2417 ++origin_it;
2418 while (origin_it != m_grid_data.end() && ((*origin_it)->row_type != row_object))
2419 {
2420 new_grid_rows.insert(it, *origin_it);
2421 ++origin_it;
2422 }
2423 }
2424 m_grid_data.clear();
2425 m_grid_data.resize(size);
2426 std::copy(new_grid_rows.begin(), new_grid_rows.end(), m_grid_data.begin());
2427 new_grid_rows.clear();
2428
2429 //update_row_properties();
2430 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" finished, this %1%, row_data size %2%") %this % m_grid_data.size();
2431}
RaycastManager::TrItems::iterator find(RaycastManager::TrItems &items, const RaycastManager::TrKey &key)
Definition RaycastManager.cpp:298

References m_grid_data, and row_object.

Referenced by sort_by_col(), and sort_by_default().

Here is the caller graph for this function:

◆ update_filament_to_config()

void Slic3r::GUI::ObjectGridTable::update_filament_to_config ( ModelConfig * config,
std::string & key,
ConfigOption & new_value,
ConfigOption & ori_value,
bool is_object )
1468{
1469 if (!is_object)
1470 update_value_to_config(config, key, new_value, ori_value);
1471 else {
1472 //always create extruder in object config
1473 config->set_key_value(key, new_value.clone());
1474 config->touch();
1475 }
1476}

References Slic3r::ConfigOption::clone(), Slic3r::ModelConfig::set_key_value(), Slic3r::ModelConfig::touch(), and update_value_to_config().

Referenced by OnCellLeftClick(), and SetValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_row_properties()

void Slic3r::GUI::ObjectGridTable::update_row_properties ( )
private
2271{
2272 ObjectGrid* grid_table = m_panel->m_object_grid;
2273 //col 0 no need to update, always uneditable
2274 for (int col = 1; col < col_speed_perimeter_reset; col++)
2275 {
2276 ObjectGridTable::ObjectGridCol* grid_col = get_grid_col(col);
2277 //grid_table->SetColSize(col, grid_col->size);
2278
2279 //row 0 no need to update, always for headers
2280 for (int row = 1; row < get_row_count(); row++)
2281 {
2282 ObjectGridTable::ObjectGridRow* grid_row = get_grid_row(row-1);
2283
2284 if ((!grid_col->b_icon) && (grid_col->b_for_object)) {
2285 if (grid_row->row_type == ObjectGridTable::row_volume) {
2286 grid_table->SetReadOnly(row, col);
2287 //FIXME: recycle the old editor and renders
2288 grid_table->SetCellEditor(row, col, new wxGridCellAutoWrapStringEditor());
2289 grid_table->SetCellRenderer(row, col, new wxGridCellAutoWrapStringRenderer());
2290 }
2291 else {
2292 grid_table->SetReadOnly(row, col, false);
2293
2294 switch (grid_col->type)
2295 {
2296 case coString:
2298 grid_table->SetReadOnly(row, col);
2299 grid_table->SetCellEditor(row, col, new GridCellTextEditor());
2300 //grid_table->SetCellRenderer(row, col, new wxGridCellAutoWrapStringRenderer());
2301 grid_table->SetCellFitMode(row, col, wxGridFitMode::Ellipsize());
2302 break;
2303 case coBool:
2304 grid_table->SetCellEditor(row, col, new GridCellSupportEditor());
2305 //grid_table->SetCellEditor(row, col, new wxGridCellBoolEditor());
2306 //grid_table->SetCellRenderer(row, col, new GridCellSupportRenderer());
2307 grid_table->SetCellRenderer(row, col, new GridCellSupportRenderer());
2308 break;
2309 case coInt:
2310 grid_table->SetCellEditor(row, col, new GridCellTextEditor());
2311 grid_table->SetCellRenderer(row, col, new wxGridCellNumberRenderer());
2312 break;
2313 case coEnum:
2314 if (col == ObjectGridTable::col_filaments) {
2315 GridCellFilamentsEditor *filament_editor = new GridCellFilamentsEditor(grid_col->choices, false, &m_panel->m_color_bitmaps);
2316 grid_table->SetCellEditor(row, col, filament_editor);
2317 grid_table->SetCellRenderer(row, col, new GridCellFilamentsRenderer());
2318 } else {
2319 GridCellChoiceEditor *combo_editor = new GridCellChoiceEditor(grid_col->choices);
2320 grid_table->SetCellEditor(row, col, combo_editor);
2321 grid_table->SetCellRenderer(row, col, new wxGridCellChoiceRenderer());
2322 //new wxGridCellChoiceEditor(grid_col->choice_count, grid_col->choices));
2323 }
2324 break;
2325 case coFloat: {
2326 grid_table->SetCellEditor(row, col, new GridCellTextEditor());
2328 grid_table->SetCellRenderer(row, col, new wxGridCellFloatRenderer(6, 0));
2329 }
2330 else {
2331 grid_table->SetCellRenderer(row, col, new wxGridCellFloatRenderer(6, 2));
2332 }
2333
2334 break;
2335 }
2336 case coPercent:
2337 {
2338 grid_table->SetCellEditor(row, col, new GridCellTextEditor());
2339 grid_table->SetCellRenderer(row, col, new wxGridCellFloatRenderer(6,1));
2340 break;
2341 }
2342 default:
2343 break;
2344 }
2345 }
2346 }
2347 else if (col == ObjectGridTable::col_name) {
2348 grid_table->SetCellFont(row, col, Label::Body_12);
2349 /*if (grid_row->row_type == ObjectGridTable::row_object)
2350 grid_table->SetCellFont(row, col, Label::Head_14);
2351 else
2352 grid_table->SetCellFont(row, col, Label::Body_14);*/
2353 }
2354 }
2355 }
2356
2357 return;
2358}
static wxFont Body_12
Definition Label.hpp:55
ObjectGridRow * get_grid_row(int row)
Definition GUI_ObjectTable.hpp:509
ObjectGridCol * get_grid_col(int col)
Definition GUI_ObjectTable.hpp:508
int get_row_count()
Definition GUI_ObjectTable.hpp:506

References Slic3r::GUI::ObjectGridTable::ObjectGridCol::b_for_object, Slic3r::GUI::ObjectGridTable::ObjectGridCol::b_icon, Label::Body_12, Slic3r::GUI::ObjectGridTable::ObjectGridCol::choices, Slic3r::coBool, Slic3r::coEnum, Slic3r::coFloat, Slic3r::coInt, col_filaments, col_name, col_plate_index, col_speed_perimeter, col_speed_perimeter_reset, Slic3r::coPercent, Slic3r::coString, get_grid_col(), get_grid_row(), get_row_count(), m_panel, Slic3r::GUI::ObjectGridTable::ObjectGridRow::row_type, row_volume, and Slic3r::GUI::ObjectGridTable::ObjectGridCol::type.

Here is the call graph for this function:

◆ update_value_to_config()

void Slic3r::GUI::ObjectGridTable::update_value_to_config ( ModelConfig * config,
std::string & key,
ConfigOption & new_value,
ConfigOption & ori_value )
1480{
1481 if (!config->has(key))
1482 {
1483 if (ori_value != new_value)
1484 config->set_key_value(key, new_value.clone());
1485 }
1486 else {
1487 if (ori_value != new_value)
1488 config->set_key_value(key, new_value.clone());
1489 else
1490 config->erase(key);
1491 }
1492 config->touch();
1493}

References Slic3r::ConfigOption::clone(), Slic3r::ModelConfig::erase(), Slic3r::ModelConfig::has(), Slic3r::ModelConfig::set_key_value(), and Slic3r::ModelConfig::touch().

Referenced by OnCellLeftClick(), SetValue(), SetValueAsBool(), SetValueAsDouble(), SetValueAsLong(), and update_filament_to_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_value_to_object()

void Slic3r::GUI::ObjectGridTable::update_value_to_object ( Model * model,
ObjectGridRow * grid_row,
int col )
1536{
1537 ModelObject* object = model->objects[grid_row->object_id];
1538 ModelVolume* volume = nullptr;
1539 std::string* name_ptr = nullptr;
1540 std::string name_value;
1541
1542 if (!object) {
1543 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(", object_id %1%, volume_id %2%, can not find modelObject anymore!")%grid_row->object_id %grid_row->volume_id;
1544 return;
1545 }
1546 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", object_id %1%, volume_id %2%, col %3%, row_type %4%")%grid_row->object_id %grid_row->volume_id %col %grid_row->row_type;
1547
1548 if (grid_row->row_type != row_object) {
1549 volume = object->volumes[grid_row->volume_id];
1550 if (col == col_name) {
1551 name_ptr = &(volume->name);
1552 name_value = grid_row->name.value;
1553 }
1554 }
1555 else {
1556 if (col == col_name) {
1557 name_ptr = &(object->name);
1558 name_value = grid_row->name.value;
1559 }
1560 /* else if (col == col_assemble_name) {
1561 name_ptr = &(object->module_name);
1562 name_value = grid_row->assemble_name.value;
1563 }*/
1564 else if (col == col_printable) {
1565 object->printable = grid_row->printable.value;
1566 object->instances[0]->printable = object->printable;
1567
1568 wxGetApp().obj_list()->printable_state_changed({object});
1569 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", change object %1%'s printable to %2%")%object->module_name %object->printable;
1570 }
1571 }
1572
1573 if ((name_ptr) && (*name_ptr != name_value)) {
1574 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", change name from %1% to %2%!")%name_ptr->c_str() %name_value.c_str();
1575 *name_ptr = name_value;
1576 //notify object list
1577 wxGetApp().obj_list()->update_name_for_items();
1578 }
1579}

References col_name, col_printable, Slic3r::GUI::ObjectGridTable::ObjectGridRow::name, Slic3r::ModelVolume::name, Slic3r::GUI::ObjectGridTable::ObjectGridRow::object_id, Slic3r::Model::objects, Slic3r::GUI::ObjectGridTable::ObjectGridRow::printable, row_object, Slic3r::GUI::ObjectGridTable::ObjectGridRow::row_type, Slic3r::ConfigOptionSingle< T >::value, and Slic3r::GUI::ObjectGridTable::ObjectGridRow::volume_id.

Referenced by OnCellLeftClick(), SetValue(), and SetValueAsBool().

Here is the caller graph for this function:

◆ update_volume_values_from_object()

void Slic3r::GUI::ObjectGridTable::update_volume_values_from_object ( int row,
int col )
1496{
1497 ObjectGridRow* grid_row = m_grid_data[row - 1];
1498 bool need_refresh = false;
1499 DynamicPrintConfig& global_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
1500 if (grid_row->row_type == row_object) {
1501 int next_row = row + 1;
1502 while ((next_row - 1) < m_grid_data.size())
1503 {
1504 ObjectGridRow* part_row = m_grid_data[next_row - 1];
1505 if (part_row->row_type == row_volume) {
1506 if (col == col_filaments) {
1507 auto extruder_id_ptr = static_cast<const ConfigOptionInt*>(part_row->config->option(m_col_data[col]->key));
1508 if (extruder_id_ptr) {
1509 part_row->filaments = *extruder_id_ptr;
1510 if (part_row->filaments == grid_row->filaments) {
1511 part_row->config->erase(m_col_data[col_filaments]->key);
1512 }
1513 }
1514 else
1515 part_row->filaments = grid_row->filaments;
1516 //part_row->ori_filaments = grid_row->filaments;
1517 }
1518 else
1519 reload_part_data(part_row, grid_row, m_col_data[col]->category, global_config);
1520 next_row++;
1521 need_refresh = true;
1522 }
1523 else
1524 break;
1525 }
1526 }
1527
1528 if (need_refresh)
1529 m_panel->m_object_grid->ForceRefresh();
1530
1531 return;
1532}

References col_filaments, Slic3r::GUI::ObjectGridTable::ObjectGridRow::config, Slic3r::ModelConfig::erase(), Slic3r::GUI::ObjectGridTable::ObjectGridRow::filaments, m_col_data, m_grid_data, m_panel, Slic3r::ModelConfig::option(), reload_part_data(), row_object, Slic3r::GUI::ObjectGridTable::ObjectGridRow::row_type, and row_volume.

Referenced by OnCellLeftClick(), and SetValue().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ category_all

◆ m_col_data

◆ m_colLabels

wxArrayString Slic3r::GUI::ObjectGridTable::m_colLabels
private

◆ m_current_col

int Slic3r::GUI::ObjectGridTable::m_current_col {-1}
private
555{-1};

Referenced by OnSelectCell(), and resetValuesInCurrentCell().

◆ m_current_row

int Slic3r::GUI::ObjectGridTable::m_current_row {-1}
private
554{-1};

Referenced by OnSelectCell(), and resetValuesInCurrentCell().

◆ m_data_valid

bool Slic3r::GUI::ObjectGridTable::m_data_valid {false}
private

◆ m_grid_data

◆ m_icon_col_width

int Slic3r::GUI::ObjectGridTable::m_icon_col_width { 0 }

◆ m_icon_row_height

int Slic3r::GUI::ObjectGridTable::m_icon_row_height { 0 }

◆ m_panel

◆ m_selected_cells

std::list<wxGridCellCoords> Slic3r::GUI::ObjectGridTable::m_selected_cells
private

Referenced by ~ObjectGridTable(), and OnSelectCell().

◆ m_sort_col

int Slic3r::GUI::ObjectGridTable::m_sort_col { -1 }
private
547{ -1 };

Referenced by sort_by_col(), and sort_by_default().

◆ plate_outside

std::string Slic3r::GUI::ObjectGridTable::plate_outside = L("Outside")
static

The documentation for this class was generated from the following files: