Merge remote-tracking branch 'remotes/origin/ys_preset_edit_buttons'

This commit is contained in:
bubnikv 2019-03-19 17:37:02 +01:00
commit 4d37c8658d
4 changed files with 19 additions and 3 deletions

View File

@ -741,6 +741,13 @@ wxNotebook* GUI_App::tab_panel() const
return mainframe->m_tabpanel;
}
int GUI_App::extruders_cnt() const
{
const Preset& preset = preset_bundle->printers.get_selected_preset();
return preset.printer_technology() == ptSLA ? 1 :
preset.config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
}
void GUI_App::window_pos_save(wxTopLevelWindow* window, const std::string &name)
{
if (name.empty()) { return; }

View File

@ -158,6 +158,7 @@ public:
Plater* plater_{ nullptr };
wxNotebook* tab_panel() const ;
int extruders_cnt() const;
std::vector<Tab *> tabs_list;

View File

@ -51,8 +51,7 @@ static DynamicPrintConfig& printer_config()
static int extruders_count()
{
return printer_technology() == ptSLA ? 1 :
printer_config().option<ConfigOptionFloats>("nozzle_diameter")->values.size();
return wxGetApp().extruders_cnt();
}
ObjectList::ObjectList(wxWindow* parent) :

View File

@ -295,8 +295,17 @@ wxBitmapComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(15 *
wxGetApp().tab_panel()->ChangeSelection(page_id);
tab->select_preset(GetString(GetSelection()).ToUTF8().data());
/* In a case of a multi-material printing, for editing another Filament Preset
* it's needed to select this preset for the "Filament settings" Tab
*/
if (preset_type == Preset::TYPE_FILAMENT && wxGetApp().extruders_cnt() > 1)
{
const std::string& selected_preset = GetString(GetSelection()).ToUTF8().data();
// Call select_preset() only if there is new preset and not just modified
if ( !boost::algorithm::ends_with(selected_preset, "(modified)") )
tab->select_preset(selected_preset);
}
}));
}