From fd43e53aeb67b6ad0b3e25b25af2702694b45917 Mon Sep 17 00:00:00 2001
From: Vojtech Kral <vojtech@kral.hk>
Date: Fri, 18 May 2018 14:58:24 +0200
Subject: [PATCH 1/2] PresetUpdater: Add some more logging

---
 xs/src/slic3r/Utils/PresetUpdater.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/xs/src/slic3r/Utils/PresetUpdater.cpp b/xs/src/slic3r/Utils/PresetUpdater.cpp
index a5208e3c2..9a4d1048f 100644
--- a/xs/src/slic3r/Utils/PresetUpdater.cpp
+++ b/xs/src/slic3r/Utils/PresetUpdater.cpp
@@ -402,7 +402,11 @@ void PresetUpdater::priv::perform_updates(Updates &&updates, bool snapshot) cons
 			PresetBundle bundle;
 			bundle.load_configbundle(update.target.string(), PresetBundle::LOAD_CFGBNDLE_SYSTEM);
 
+			BOOST_LOG_TRIVIAL(info) << boost::format("Deleting %1% conflicting presets")
+				% (bundle.prints.size() + bundle.filaments.size() + bundle.printers.size());
+
 			auto preset_remover = [](const Preset &preset) {
+				BOOST_LOG_TRIVIAL(info) << '\t' << preset.file;
 				fs::remove(preset.file);
 			};
 
@@ -411,9 +415,14 @@ void PresetUpdater::priv::perform_updates(Updates &&updates, bool snapshot) cons
 			for (const auto &preset : bundle.printers)  { preset_remover(preset); }
 
 			// Also apply the `obsolete_presets` property, removing obsolete ini files
+
+			BOOST_LOG_TRIVIAL(info) << boost::format("Deleting %1% obsolete presets")
+				% (bundle.obsolete_presets.prints.size() + bundle.obsolete_presets.filaments.size() + bundle.obsolete_presets.printers.size());
+
 			auto obsolete_remover = [](const char *subdir, const std::string &preset) {
 				auto path = fs::path(Slic3r::data_dir()) / subdir / preset;
 				path += ".ini";
+				BOOST_LOG_TRIVIAL(info) << '\t' << path.string();
 				fs::remove(path);
 			};
 

From deabeaaa7fc48691c9b778e11a725f7bd93a0458 Mon Sep 17 00:00:00 2001
From: YuSanka <yusanka@gmail.com>
Date: Sun, 20 May 2018 23:39:52 +0200
Subject: [PATCH 2/2] Aligned frequently changing parameters according to
 presets settings on the Plater tab. Fixed missing adding of the Filaments
 preset settings(for multy material case) to the right_panel

---
 lib/Slic3r/GUI/Plater.pm           |  3 ++-
 xs/src/slic3r/GUI/GUI.cpp          |  4 ++--
 xs/src/slic3r/GUI/OptionsGroup.cpp | 10 +++++-----
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm
index e141c7732..a2c3b094e 100644
--- a/lib/Slic3r/GUI/Plater.pm
+++ b/lib/Slic3r/GUI/Plater.pm
@@ -410,6 +410,7 @@ sub new {
                 $presets->Add($text, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxRIGHT, 4);
                 $presets->Add($choice, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxBOTTOM, 1);
             }
+            $presets->Layout;
         }
 
         my $frequently_changed_parameters_sizer = Wx::BoxSizer->new(wxHORIZONTAL);
@@ -1738,7 +1739,7 @@ sub on_extruders_change {
         my @presets = $choices->[0]->GetStrings;
         
         # initialize new choice
-        my $choice = Wx::BitmapComboBox->new($self, -1, "", wxDefaultPosition, wxDefaultSize, [@presets], wxCB_READONLY);
+        my $choice = Wx::BitmapComboBox->new($self->{right_panel}, -1, "", wxDefaultPosition, wxDefaultSize, [@presets], wxCB_READONLY);
         my $extruder_idx = scalar @$choices;
         EVT_LEFT_DOWN($choice, sub { $self->filament_color_box_lmouse_down($extruder_idx, @_); } );
         push @$choices, $choice;
diff --git a/xs/src/slic3r/GUI/GUI.cpp b/xs/src/slic3r/GUI/GUI.cpp
index 4789f4590..a744bb09d 100644
--- a/xs/src/slic3r/GUI/GUI.cpp
+++ b/xs/src/slic3r/GUI/GUI.cpp
@@ -809,8 +809,8 @@ void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFl
 {
 	DynamicPrintConfig*	config = &g_PresetBundle->prints.get_edited_preset().config;
 	m_optgroup = std::make_shared<ConfigOptionsGroup>(parent, "", config);
-//	const wxArrayInt& ar = preset_sizer->GetColWidths();
-// 	m_optgroup->label_width = ar.IsEmpty() ? 100 : ar.front(); // doesn't work
+	const wxArrayInt& ar = preset_sizer->GetColWidths();
+	m_optgroup->label_width = ar.IsEmpty() ? 100 : ar.front()-4; // doesn't work
 	m_optgroup->m_on_change = [config](t_config_option_key opt_key, boost::any value){
 		TabPrint* tab_print = nullptr;
 		for (size_t i = 0; i < g_wxTabPanel->GetPageCount(); ++i) {
diff --git a/xs/src/slic3r/GUI/OptionsGroup.cpp b/xs/src/slic3r/GUI/OptionsGroup.cpp
index 657ad03c0..57659d03d 100644
--- a/xs/src/slic3r/GUI/OptionsGroup.cpp
+++ b/xs/src/slic3r/GUI/OptionsGroup.cpp
@@ -150,11 +150,11 @@ void OptionsGroup::append_line(const Line& line, wxStaticText**	colored_Label/*
     // Build a label if we have it
 	wxStaticText* label=nullptr;
     if (label_width != 0) {
-		label = new wxStaticText(parent(), wxID_ANY, line.label + (line.label.IsEmpty() ? "" : ":  "), 
-							wxDefaultPosition, staticbox ? wxSize(label_width, -1) : wxDefaultSize);
+		label = new wxStaticText(parent(), wxID_ANY, line.label + (line.label.IsEmpty() ? "" : ":"), 
+							wxDefaultPosition, wxSize(label_width, -1), staticbox ? 0 : wxALIGN_RIGHT);
         label->SetFont(label_font);
         label->Wrap(label_width); // avoid a Linux/GTK bug
-		grid_sizer->Add(label, 0, (staticbox ? 0 : wxALIGN_RIGHT) | wxALIGN_CENTER_VERTICAL, 0);
+		grid_sizer->Add(label, 0, (staticbox ? 0 : wxALIGN_RIGHT | wxRIGHT) | wxALIGN_CENTER_VERTICAL, 5);
 		if (line.label_tooltip.compare("") != 0)
 			label->SetToolTip(line.label_tooltip);
     }
@@ -170,7 +170,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText**	colored_Label/*
 	
 	// if we have a single option with no sidetext just add it directly to the grid sizer
 	auto sizer = new wxBoxSizer(wxHORIZONTAL);
-	grid_sizer->Add(sizer, 0, wxEXPAND | wxALL, 0);
+	grid_sizer->Add(sizer, 0, wxEXPAND | (staticbox ? wxALL : wxBOTTOM|wxTOP|wxLEFT), staticbox ? 0 : 1);
 	if (option_set.size() == 1 && option_set.front().opt.sidetext.size() == 0 &&
 		option_set.front().side_widget == nullptr && line.get_extra_widgets().size() == 0) {
 		const auto& option = option_set.front();
@@ -180,7 +180,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText**	colored_Label/*
 		sizer->Add(field->m_Undo_btn, 0, wxALIGN_CENTER_VERTICAL);
 		if (is_window_field(field)) 
 			sizer->Add(field->getWindow(), option.opt.full_width ? 1 : 0, (option.opt.full_width ? wxEXPAND : 0) |
-							wxBOTTOM | wxTOP | wxALIGN_CENTER_VERTICAL, wxOSX ? 0 : 2);
+							wxBOTTOM | wxTOP | wxALIGN_CENTER_VERTICAL, (wxOSX||!staticbox) ? 0 : 2);
 		if (is_sizer_field(field)) 
 			sizer->Add(field->getSizer(), 0, (option.opt.full_width ? wxEXPAND : 0) | wxALIGN_CENTER_VERTICAL, 0);
 		return;