Merge remote-tracking branch 'origin/master' into ys_new_features

This commit is contained in:
YuSanka 2019-06-29 12:38:03 +02:00
commit 125f474f02
32 changed files with 273 additions and 256 deletions

View file

@ -171,7 +171,7 @@ void BonjourDialog::on_reply(BonjourReplyEvent &e)
// Filter replies based on selected technology
const auto model = e.reply.txt_data.find("model");
const bool sl1 = model != e.reply.txt_data.end() && model->second == "SL1";
if (tech == ptFFF && sl1 || tech == ptSLA && !sl1) {
if ((tech == ptFFF && sl1) || (tech == ptSLA && !sl1)) {
return;
}

View file

@ -330,8 +330,8 @@ PagePrinters::PagePrinters(ConfigWizard *parent, wxString title, wxString shortn
const auto families = vendor.families();
for (const auto &family : families) {
const auto filter = [&](const VendorProfile::PrinterModel &model) {
return (model.technology == ptFFF && technology & T_FFF
|| model.technology == ptSLA && technology & T_SLA)
return ((model.technology == ptFFF && technology & T_FFF)
|| (model.technology == ptSLA && technology & T_SLA))
&& model.family == family;
};
@ -810,7 +810,7 @@ void ConfigWizardIndex::on_paint(wxPaintEvent & evt)
const Item& item = items[i];
unsigned x = em_w/2 + item.indent * em_w;
if (i == item_active || item_hover >= 0 && i == (size_t)item_hover) {
if (i == item_active || (item_hover >= 0 && i == (size_t)item_hover)) {
dc.DrawBitmap(bullet_blue.bmp(), x, y + yoff_icon, false);
}
else if (i < item_active) { dc.DrawBitmap(bullet_black.bmp(), x, y + yoff_icon, false); }

View file

@ -442,8 +442,7 @@ void FirmwareDialog::priv::avr109_lookup_port(Avr109Pid usb_pid)
auto ports = Utils::scan_serial_ports_extended();
ports.erase(std::remove_if(ports.begin(), ports.end(), [=](const SerialPortInfo &port ) {
return port.id_vendor != USB_VID_PRUSA ||
port.id_product != usb_pid.boot &&
port.id_product != usb_pid.app;
(port.id_product != usb_pid.boot && port.id_product != usb_pid.app);
}), ports.end());
if (ports.size() == 0) {

View file

@ -141,6 +141,18 @@ GUI_App::GUI_App()
, m_imgui(new ImGuiWrapper())
{}
GUI_App::~GUI_App()
{
if (app_config != nullptr)
delete app_config;
if (preset_bundle != nullptr)
delete preset_bundle;
if (preset_updater != nullptr)
delete preset_updater;
}
bool GUI_App::OnInit()
{
try {

View file

@ -95,6 +95,7 @@ public:
bool initialized() const { return m_initialized; }
GUI_App();
~GUI_App();
static unsigned get_colour_approx_luma(const wxColour &colour);
static bool dark_mode();

View file

@ -15,48 +15,6 @@
namespace Slic3r {
namespace GUI {
class GLGizmoCutPanel : public wxPanel
{
public:
GLGizmoCutPanel(wxWindow *parent);
void display(bool display);
private:
bool m_active;
wxCheckBox *m_cb_rotate;
wxButton *m_btn_cut;
wxButton *m_btn_cancel;
};
GLGizmoCutPanel::GLGizmoCutPanel(wxWindow *parent)
: wxPanel(parent)
, m_active(false)
, m_cb_rotate(new wxCheckBox(this, wxID_ANY, _(L("Rotate lower part upwards"))))
, m_btn_cut(new wxButton(this, wxID_OK, _(L("Perform cut"))))
, m_btn_cancel(new wxButton(this, wxID_CANCEL, _(L("Cancel"))))
{
enum { MARGIN = 5 };
auto *sizer = new wxBoxSizer(wxHORIZONTAL);
auto *label = new wxStaticText(this, wxID_ANY, _(L("Cut object:")));
sizer->Add(label, 0, wxALL | wxALIGN_CENTER, MARGIN);
sizer->Add(m_cb_rotate, 0, wxALL | wxALIGN_CENTER, MARGIN);
sizer->AddStretchSpacer();
sizer->Add(m_btn_cut, 0, wxALL | wxALIGN_CENTER, MARGIN);
sizer->Add(m_btn_cancel, 0, wxALL | wxALIGN_CENTER, MARGIN);
SetSizer(sizer);
}
void GLGizmoCutPanel::display(bool display)
{
Show(display);
GetParent()->Layout();
}
const double GLGizmoCut::Offset = 10.0;
const double GLGizmoCut::Margin = 20.0;
const std::array<float, 3> GLGizmoCut::GrabberColor = { 1.0, 0.5, 0.0 };
@ -188,7 +146,7 @@ void GLGizmoCut::on_render_input_window(float x, float y, float bottom_limit, co
m_imgui->begin(_(L("Cut")), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
ImGui::PushItemWidth(m_imgui->scaled(5.0f));
bool _value_changed = ImGui::InputDouble("Z", &m_cut_z, 0.0f, 0.0f, "%.2f");
ImGui::InputDouble("Z", &m_cut_z, 0.0f, 0.0f, "%.2f");
m_imgui->checkbox(_(L("Keep upper part")), m_keep_upper);
m_imgui->checkbox(_(L("Keep lower part")), m_keep_lower);

View file

@ -326,9 +326,9 @@ bool ImGuiWrapper::combo(const wxString& label, const std::vector<std::string>&
int selection_out = -1;
bool res = false;
const char *selection_str = selection < options.size() ? options[selection].c_str() : "";
const char *selection_str = selection < (int)options.size() ? options[selection].c_str() : "";
if (ImGui::BeginCombo("", selection_str)) {
for (int i = 0; i < options.size(); i++) {
for (int i = 0; i < (int)options.size(); i++) {
if (ImGui::Selectable(options[i].c_str(), i == selection)) {
selection_out = i;
}

View file

@ -615,11 +615,11 @@ struct Sidebar::priv
PresetComboBox *combo_printer;
wxBoxSizer *sizer_params;
FreqChangedParams *frequently_changed_parameters;
ObjectList *object_list;
ObjectManipulation *object_manipulation;
ObjectSettings *object_settings;
ObjectLayers *object_layers;
FreqChangedParams *frequently_changed_parameters{ nullptr };
ObjectList *object_list{ nullptr };
ObjectManipulation *object_manipulation{ nullptr };
ObjectSettings *object_settings{ nullptr };
ObjectLayers *object_layers{ nullptr };
ObjectInfo *object_info;
SlicedInfo *sliced_info;
@ -628,10 +628,26 @@ struct Sidebar::priv
wxButton *btn_send_gcode;
priv(Plater *plater) : plater(plater) {}
~priv();
void show_preset_comboboxes();
};
Sidebar::priv::~priv()
{
if (object_manipulation != nullptr)
delete object_manipulation;
if (object_settings != nullptr)
delete object_settings;
if (frequently_changed_parameters != nullptr)
delete frequently_changed_parameters;
if (object_layers != nullptr)
delete object_layers;
}
void Sidebar::priv::show_preset_comboboxes()
{
const bool showSLA = wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA;
@ -1526,6 +1542,7 @@ struct Plater::priv
static const std::regex pattern_prusa;
priv(Plater *q, MainFrame *main_frame);
~priv();
void update(bool force_full_scene_refresh = false);
void select_view(const std::string& direction);
@ -1795,6 +1812,12 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
camera.set_type(get_config("use_perspective_camera"));
}
Plater::priv::~priv()
{
if (config != nullptr)
delete config;
}
void Plater::priv::update(bool force_full_scene_refresh)
{
// the following line, when enabled, causes flickering on NVIDIA graphics cards