This commit is contained in:
bubnikv 2019-05-17 16:32:01 +02:00
commit c1cb40c4f0
6 changed files with 25 additions and 13 deletions

View File

@ -183,9 +183,8 @@ bool GUI_App::on_init_inner()
// supplied as argument to --datadir; in that case we should still run the wizard
preset_bundle->setup_directories();
app_conf_exists = app_config->exists();
// load settings
if (app_conf_exists)
if (app_config->exists())
app_config->load();
app_config->set("version", SLIC3R_VERSION);
app_config->save();
@ -258,7 +257,7 @@ bool GUI_App::on_init_inner()
}
CallAfter([this] {
if (!config_wizard_startup(app_conf_exists)) {
if (!config_wizard_startup(app_config->exists())) {
// Only notify if there was no wizard so as not to bother too much ...
preset_updater->slic3r_update_notify();
}

View File

@ -72,7 +72,6 @@ static wxString dots("…", wxConvUTF8);
class GUI_App : public wxApp
{
bool m_initialized { false };
bool app_conf_exists{ false };
wxColour m_color_label_modified;
wxColour m_color_label_sys;

View File

@ -533,6 +533,7 @@ void Preview::create_double_slider()
m_slider->Bind(wxEVT_SCROLL_CHANGED, &Preview::on_sliders_scroll_changed, this);
Bind(wxCUSTOMEVT_TICKSCHANGED, [this](wxEvent&) {
auto& config = wxGetApp().preset_bundle->project_config;
((config.option<ConfigOptionFloats>("colorprint_heights"))->values) = (m_slider->GetTicksValues());
@ -823,7 +824,7 @@ void Preview::load_print_as_sla()
}
}
void Preview::on_sliders_scroll_changed(wxEvent& event)
void Preview::on_sliders_scroll_changed(wxCommandEvent& event)
{
if (IsShown())
{
@ -831,7 +832,7 @@ void Preview::on_sliders_scroll_changed(wxEvent& event)
if (tech == ptFFF)
{
m_canvas->set_toolpaths_range(m_slider->GetLowerValueD() - 1e-6, m_slider->GetHigherValueD() + 1e-6);
m_canvas_widget->Refresh();
m_canvas->render();
m_canvas->set_use_clipping_planes(false);
}
else if (tech == ptSLA)
@ -839,10 +840,11 @@ void Preview::on_sliders_scroll_changed(wxEvent& event)
m_canvas->set_clipping_plane(0, ClippingPlane(Vec3d::UnitZ(), -m_slider->GetLowerValueD()));
m_canvas->set_clipping_plane(1, ClippingPlane(-Vec3d::UnitZ(), m_slider->GetHigherValueD()));
m_canvas->set_use_clipping_planes(m_slider->GetHigherValue() != 0);
m_canvas_widget->Refresh();
m_canvas->render();
}
}
}
} // namespace GUI
} // namespace Slic3r

View File

@ -154,7 +154,7 @@ private:
void load_print_as_fff(bool keep_z_range = false);
void load_print_as_sla();
void on_sliders_scroll_changed(wxEvent& event);
void on_sliders_scroll_changed(wxCommandEvent& event);
};

View File

@ -669,7 +669,8 @@ Sidebar::Sidebar(Plater *parent)
auto combo_and_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
combo_and_btn_sizer->Add(*combo, 1, wxEXPAND);
if ((*combo)->edit_btn)
combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxLEFT|wxRIGHT, int(0.3*wxGetApp().em_unit()));
combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT,
int(0.3*wxGetApp().em_unit()));
auto *sizer_presets = this->p->sizer_presets;
auto *sizer_filaments = this->p->sizer_filaments;
@ -775,7 +776,8 @@ void Sidebar::init_filament_combo(PresetComboBox **combo, const int extr_idx) {
auto combo_and_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
combo_and_btn_sizer->Add(*combo, 1, wxEXPAND);
combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxLEFT | wxRIGHT, int(0.3*wxGetApp().em_unit()));
combo_and_btn_sizer->Add((*combo)->edit_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
int(0.3*wxGetApp().em_unit()));
auto /***/sizer_filaments = this->p->sizer_filaments;
sizer_filaments->Add(combo_and_btn_sizer, 1, wxEXPAND | wxBOTTOM, 1);

View File

@ -2235,14 +2235,16 @@ void DoubleSlider::OnMotion(wxMouseEvent& event)
}
else if (m_is_left_down || m_is_right_down) {
if (m_selection == ssLower) {
int current_value = m_lower_value;
m_lower_value = get_value_from_position(pos.x, pos.y);
correct_lower_value();
action = true;
action = (current_value != m_lower_value);
}
else if (m_selection == ssHigher) {
int current_value = m_higher_value;
m_higher_value = get_value_from_position(pos.x, pos.y);
correct_higher_value();
action = true;
action = (current_value != m_higher_value);
}
}
Refresh();
@ -2253,6 +2255,7 @@ void DoubleSlider::OnMotion(wxMouseEvent& event)
{
wxCommandEvent e(wxEVT_SCROLL_CHANGED);
e.SetEventObject(this);
e.SetString("moving");
ProcessWindowEvent(e);
}
}
@ -2654,7 +2657,14 @@ ScalableButton::ScalableButton( wxWindow * parent,
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
#endif // __WXMSW__
SetBitmap(create_scaled_bitmap(parent, icon_name));
/* #FIXME Edit preset Buttons under OSX.
* Because of _strange_ layout of a Button with a scaled Bitmap on nonactive wxWindow,
* there is just temporary workaround.
* Send to create_scaled_bitmap(nullptr,...) for buttons without text =>
* Bitmaps for this Buttons wouldn't be scaled and would be some blurred now, but
* they would be correctly updated on Plater
*/
SetBitmap(create_scaled_bitmap(label.IsEmpty() ? nullptr : parent, icon_name));
}