Merge branch 'main' into feature/show-extruder-values-on-filament-overrides-tab

This commit is contained in:
Victor Usoltsev 2024-08-28 20:22:40 +12:00 committed by GitHub
commit b34ac2bda3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
336 changed files with 14249 additions and 11440 deletions

View file

@ -241,7 +241,7 @@ float GLVolume::last_explosion_ratio = 1.0;
void GLVolume::set_render_color()
{
// bool outside = is_outside || is_below_printbed();
bool outside = is_outside || is_below_printbed();
if (force_native_color || force_neutral_color) {
#ifdef ENABBLE_OUTSIDE_COLOR
@ -859,6 +859,7 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
return;
GLShaderProgram* sink_shader = GUI::wxGetApp().get_shader("flat");
GLShaderProgram* edges_shader = GUI::wxGetApp().get_shader("flat");
if (type == ERenderType::Transparent) {
glsafe(::glEnable(GL_BLEND));
@ -1022,6 +1023,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
GUI::PartPlate* curr_plate = GUI::wxGetApp().plater()->get_partplate_list().get_selected_plate();
const Pointfs& pp_bed_shape = curr_plate->get_shape();
BuildVolume plate_build_volume(pp_bed_shape, build_volume.printable_height());
const std::vector<BoundingBoxf3>& exclude_areas = curr_plate->get_exclude_areas();
for (GLVolume* volume : this->volumes)
{

View file

@ -331,6 +331,7 @@ void AMSMaterialsSetting::create_panel_kn(wxWindow* parent)
kn_val_sizer->Add(m_input_k_val, 0, wxALL | wxEXPAND | wxALIGN_CENTER_VERTICAL, FromDIP(0));
// n params input
wxBoxSizer* n_sizer = new wxBoxSizer(wxHORIZONTAL);
m_n_param = new wxStaticText(parent, wxID_ANY, _L("Factor N"), wxDefaultPosition, wxDefaultSize, 0);
m_n_param->SetFont(::Label::Body_13);
m_n_param->SetForegroundColour(wxColour(50, 58, 61));
@ -356,7 +357,7 @@ void AMSMaterialsSetting::paintEvent(wxPaintEvent &evt)
{
auto size = GetSize();
wxPaintDC dc(this);
dc.SetPen(wxPen(StateColor::darkModeColorFor(wxColour("#000000")), 1, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(StateColor::darkModeColorFor(wxColour("#000000")), 1, wxSOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
dc.DrawRectangle(0, 0, size.x, size.y);
}

View file

@ -366,6 +366,7 @@ void MaterialItem::doRender(wxDC &dc)
wxString out_txt = m_msg;
wxString count_txt = "";
int new_line_pos = 0;
for (int i = 0; i < m_msg.length(); i++) {
auto text_size = m_warning_text->GetTextExtent(count_txt);
@ -401,6 +402,7 @@ void AmsMapingPopup::on_left_down(wxMouseEvent &evt)
auto pos = ClientToScreen(evt.GetPosition());
for (MappingItem *item : m_mapping_item_list) {
auto p_rect = item->ClientToScreen(wxPoint(0, 0));
auto left = item->GetSize();
if (pos.x > p_rect.x && pos.y > p_rect.y && pos.x < (p_rect.x + item->GetSize().x) && pos.y < (p_rect.y + item->GetSize().y)) {
if (item->m_tray_data.type == TrayType::NORMAL && !is_match_material(item->m_tray_data.filament_type)) return;
@ -1522,6 +1524,9 @@ void AmsRMGroup::on_mouse_move(wxMouseEvent& evt)
std::string tray_name = iter->first;
wxColour tray_color = iter->second;
int x = size.x / 2;
int y = size.y / 2;
int radius = size.x / 2;
endAngle += ev_angle;
if (click_angle >= startAngle && click_angle < endAngle) {

View file

@ -989,7 +989,7 @@ void AuxiliaryPanel::create_folder(wxString name)
fs::path bfs_path((m_root_dir + "/" + folder_name).ToStdWstring());
if (fs::exists(bfs_path)) {
try {
fs::remove_all(bfs_path);
bool is_done = fs::remove_all(bfs_path);
} catch (...) {
BOOST_LOG_TRIVIAL(error) << "Failed removing the auxiliary directory " << m_root_dir.c_str();
}

View file

@ -337,7 +337,7 @@ wxDataViewItemArray AuxiliaryModel::ImportFile(AuxiliaryModelNode* sel, wxArrayS
dir_path += "\\" + src_bfs_path.filename().generic_wstring();
boost::system::error_code ec;
if (!fs::copy_file(src_bfs_path, fs::path(dir_path.ToStdWstring()), fs::copy_options::overwrite_existing, ec))
if (!fs::copy_file(src_bfs_path, fs::path(dir_path.ToStdWstring()), fs::copy_option::overwrite_if_exists, ec))
continue;
// Update model data

View file

@ -3,6 +3,8 @@
#include <wx/timer.h>
#include <wx/gauge.h>
#include <wx/button.h>
#include <wx/statusbr.h>
#include <wx/frame.h>
#include "GUI_App.hpp"

View file

@ -230,7 +230,7 @@ void BBLTopbar::Init(wxFrame* parent)
this->AddSpacer(FromDIP(10));
wxBitmap save_bitmap = create_scaled_bitmap("topbar_save", nullptr, TOPBAR_ICON_SIZE);
this->AddTool(wxID_SAVE, "", save_bitmap);
wxAuiToolBarItem* save_btn = this->AddTool(wxID_SAVE, "", save_bitmap);
this->AddSpacer(FromDIP(10));
@ -278,7 +278,7 @@ void BBLTopbar::Init(wxFrame* parent)
this->AddSpacer(FromDIP(4));
wxBitmap iconize_bitmap = create_scaled_bitmap("topbar_min", nullptr, TOPBAR_ICON_SIZE);
this->AddTool(wxID_ICONIZE_FRAME, "", iconize_bitmap);
wxAuiToolBarItem* iconize_btn = this->AddTool(wxID_ICONIZE_FRAME, "", iconize_bitmap);
this->AddSpacer(FromDIP(4));
@ -294,7 +294,7 @@ void BBLTopbar::Init(wxFrame* parent)
this->AddSpacer(FromDIP(4));
wxBitmap close_bitmap = create_scaled_bitmap("topbar_close", nullptr, TOPBAR_ICON_SIZE);
this->AddTool(wxID_CLOSE_FRAME, "", close_bitmap);
wxAuiToolBarItem* close_btn = this->AddTool(wxID_CLOSE_FRAME, "", close_bitmap);
Realize();
// m_toolbar_h = this->GetSize().GetHeight();
@ -466,6 +466,7 @@ void BBLTopbar::UpdateToolbarWidth(int width)
}
void BBLTopbar::Rescale() {
int em = em_unit(this);
wxAuiToolBarItem* item;
/*item = this->FindTool(ID_LOGO);
@ -495,7 +496,7 @@ void BBLTopbar::Rescale() {
item->SetBitmap(create_scaled_bitmap("calib_sf", nullptr, TOPBAR_ICON_SIZE));
item->SetDisabledBitmap(create_scaled_bitmap("calib_sf_inactive", nullptr, TOPBAR_ICON_SIZE));
// item = this->FindTool(ID_TITLE);
item = this->FindTool(ID_TITLE);
/*item = this->FindTool(ID_PUBLISH);
item->SetBitmap(create_scaled_bitmap("topbar_publish", this, TOPBAR_ICON_SIZE));
@ -547,14 +548,14 @@ void BBLTopbar::OnCloseFrame(wxAuiToolBarEvent& event)
void BBLTopbar::OnMouseLeftDClock(wxMouseEvent& mouse)
{
wxPoint mouse_pos = ::wxGetMousePosition();
// check whether mouse is not on any tool item
if (this->FindToolByCurrentPosition() != NULL &&
this->FindToolByCurrentPosition() != m_title_item) {
mouse.Skip();
return;
}
#ifdef __WXMSW__
wxPoint mouse_pos = ::wxGetMousePosition();
#ifdef __W1XMSW__
::PostMessage((HWND) m_frame->GetHandle(), WM_NCLBUTTONDBLCLK, HTCAPTION, MAKELPARAM(mouse_pos.x, mouse_pos.y));
return;
#endif // __WXMSW__
@ -636,6 +637,7 @@ void BBLTopbar::OnMouseLeftDown(wxMouseEvent& event)
void BBLTopbar::OnMouseLeftUp(wxMouseEvent& event)
{
wxPoint mouse_pos = ::wxGetMousePosition();
if (HasCapture())
{
ReleaseMouse();

View file

@ -5,9 +5,13 @@
#include "format.hpp"
#include <wx/app.h>
#include <wx/panel.h>
#include <wx/stdpaths.h>
// For zipped archive creation
#include <wx/stdstream.h>
#include <wx/wfstream.h>
#include <wx/zipstrm.h>
#include <miniz.h>
@ -16,18 +20,23 @@
#include "libslic3r/SLAPrint.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/GCode/PostProcessor.hpp"
#include "libslic3r/Format/SL1.hpp"
#include "libslic3r/Thread.hpp"
#include "libslic3r/libslic3r.h"
#include <cassert>
#include <stdexcept>
#include <cctype>
#include <boost/format/format_fwd.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/log/trivial.hpp>
#include <boost/nowide/cstdio.hpp>
#include "I18N.hpp"
//#include "RemovableDriveManager.hpp"
#include "slic3r/GUI/Plater.hpp"
namespace Slic3r {
bool SlicingProcessCompletedEvent::critical_error() const

View file

@ -67,6 +67,7 @@ PingCodeBindDialog::PingCodeBindDialog(Plater* plater /*= nullptr*/)
SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
SetBackgroundColour(*wxWHITE);
wxBoxSizer* m_sizer_main = new wxBoxSizer(wxVERTICAL);
auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
m_line_top->SetBackgroundColour(wxColour(166, 169, 170));

View file

@ -226,7 +226,7 @@ SelectMObjectPopup::SelectMObjectPopup(wxWindow* parent)
m_refresh_timer = new wxTimer();
m_refresh_timer->SetOwner(this);
Bind(EVT_UPDATE_USER_MLIST, &SelectMObjectPopup::update_machine_list, this);
Bind(wxEVT_TIMER, [this](wxTimerEvent&) { on_timer(); });
Bind(wxEVT_TIMER, &SelectMObjectPopup::on_timer, this);
Bind(EVT_DISSMISS_MACHINE_LIST, &SelectMObjectPopup::on_dissmiss_win, this);
}
@ -265,7 +265,7 @@ void SelectMObjectPopup::Popup(wxWindow* WXUNUSED(focus))
}
}
on_timer();
wxPostEvent(this, wxTimerEvent());
PopupWindow::Popup();
}
@ -304,7 +304,7 @@ bool SelectMObjectPopup::Show(bool show) {
return PopupWindow::Show(show);
}
void SelectMObjectPopup::on_timer()
void SelectMObjectPopup::on_timer(wxTimerEvent& event)
{
BOOST_LOG_TRIVIAL(trace) << "SelectMObjectPopup on_timer";
wxGetApp().reset_to_active();
@ -459,7 +459,7 @@ CalibrationPanel::CalibrationPanel(wxWindow* parent, wxWindowID id, const wxPoin
Layout();
init_timer();
Bind(wxEVT_TIMER, [this](wxTimerEvent&) { on_timer(); });
Bind(wxEVT_TIMER, &CalibrationPanel::on_timer, this);
}
void CalibrationPanel::init_tabpanel() {
@ -502,10 +502,10 @@ void CalibrationPanel::init_timer()
m_refresh_timer = new wxTimer();
m_refresh_timer->SetOwner(this);
m_refresh_timer->Start(REFRESH_INTERVAL);
on_timer();
wxPostEvent(this, wxTimerEvent());
}
void CalibrationPanel::on_timer() {
void CalibrationPanel::on_timer(wxTimerEvent& event) {
update_all();
}
@ -644,7 +644,7 @@ bool CalibrationPanel::Show(bool show) {
m_refresh_timer->Stop();
m_refresh_timer->SetOwner(this);
m_refresh_timer->Start(REFRESH_INTERVAL);
on_timer();
wxPostEvent(this, wxTimerEvent());
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (dev) {
@ -670,6 +670,9 @@ bool CalibrationPanel::Show(bool show) {
void CalibrationPanel::on_printer_clicked(wxMouseEvent& event)
{
auto mouse_pos = ClientToScreen(event.GetPosition());
wxPoint rect = m_side_tools->ClientToScreen(wxPoint(0, 0));
if (!m_side_tools->is_in_interval()) {
wxPoint pos = m_side_tools->ClientToScreen(wxPoint(0, 0));
pos.y += m_side_tools->GetRect().height;

View file

@ -94,7 +94,7 @@ private:
private:
void OnLeftUp(wxMouseEvent& event);
void on_timer();
void on_timer(wxTimerEvent& event);
void update_user_devices();
void on_dissmiss_win(wxCommandEvent& event);
};
@ -117,7 +117,7 @@ public:
protected:
void init_tabpanel();
void init_timer();
void on_timer();
void on_timer(wxTimerEvent& event);
int last_status;

View file

@ -1126,6 +1126,7 @@ void FlowRateWizard::on_cali_save()
}
std::string old_preset_name;
CalibrationPresetPage* preset_page = (static_cast<CalibrationPresetPage*>(preset_step->page));
std::map<int, Preset*> selected_filaments = get_cached_selected_filament(curr_obj);
if (!selected_filaments.empty()) {
old_preset_name = selected_filaments.begin()->second->name;
@ -1172,6 +1173,7 @@ void FlowRateWizard::on_cali_save()
return;
std::string old_preset_name;
CalibrationPresetPage* preset_page = (static_cast<CalibrationPresetPage*>(preset_step->page));
std::map<int, Preset*> selected_filaments = get_cached_selected_filament(curr_obj);
if (!selected_filaments.empty()) {
old_preset_name = selected_filaments.begin()->second->name;
@ -1441,6 +1443,7 @@ void MaxVolumetricSpeedWizard::on_cali_save()
std::string old_preset_name;
std::string new_preset_name;
CalibrationPresetPage *preset_page = (static_cast<CalibrationPresetPage *>(preset_step->page));
std::map<int, Preset *> selected_filaments = get_cached_selected_filament(curr_obj);
if (!selected_filaments.empty()) {
old_preset_name = selected_filaments.begin()->second->name;

View file

@ -790,6 +790,7 @@ wxString CalibrationPresetPage::format_text(wxString& m_msg)
wxString out_txt = m_msg;
wxString count_txt = "";
int new_line_pos = 0;
for (int i = 0; i < m_msg.length(); i++) {
auto text_size = m_statictext_printer_msg->GetTextExtent(count_txt);

View file

@ -282,6 +282,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
}
double sparse_infill_density = config->option<ConfigOptionPercent>("sparse_infill_density")->value;
auto timelapse_type = config->opt_enum<TimelapseType>("timelapse_type");
if (!is_plate_config &&
config->opt_bool("spiral_mode") &&
@ -297,6 +298,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
{
DynamicPrintConfig new_conf = *config;
auto answer = show_spiral_mode_settings_dialog(is_object_config);
bool support = true;
if (answer == wxID_YES) {
new_conf.set_key_value("wall_loops", new ConfigOptionInt(1));
new_conf.set_key_value("top_shell_layers", new ConfigOptionInt(0));
@ -308,6 +310,8 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
new_conf.set_key_value("wall_direction", new ConfigOptionEnum<WallDirection>(WallDirection::Auto));
new_conf.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
sparse_infill_density = 0;
timelapse_type = TimelapseType::tlTraditional;
support = false;
}
else {
new_conf.set_key_value("spiral_mode", new ConfigOptionBool(false));
@ -511,11 +515,6 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
apply(config, &new_conf);
}
// Orca: Hide the filter out tiny gaps field when gap fill target is nowhere as no gap fill will be applied.
bool have_gap_fill = config->opt_enum<GapFillTarget>("gap_fill_target") != gftNowhere;
toggle_line("filter_out_gap_fill", have_gap_fill);
bool have_perimeters = config->opt_int("wall_loops") > 0;
for (auto el : { "extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "detect_thin_wall", "detect_overhang_wall",
"seam_position", "staggered_inner_seams", "wall_sequence", "outer_wall_line_width",

View file

@ -2438,7 +2438,7 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
header = _L_PLURAL("A new vendor was installed and one of its printers will be activated", "New vendors were installed and one of theirs printers will be activated", install_bundles.size());
// Decide whether to create snapshot based on run_reason and the reset profile checkbox
/*bool snapshot = true;
bool snapshot = true;
Snapshot::Reason snapshot_reason = Snapshot::SNAPSHOT_UPGRADE;
switch (run_reason) {
case ConfigWizard::RR_DATA_EMPTY:
@ -2456,7 +2456,7 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
snapshot = false;
snapshot_reason = Snapshot::SNAPSHOT_USER;
break;
}*/
}
//BBS: remove snapshot logic
/*if (snapshot && ! take_config_snapshot_cancel_on_error(*app_config, snapshot_reason, "", _u8L("Do you want to continue changing the configuration?")))
@ -2701,7 +2701,8 @@ ConfigWizard::ConfigWizard(wxWindow *parent)
//BBS: add BBL as default
const auto bbl_it = p->bundles.find("BBL");
wxCHECK_RET(bbl_it != p->bundles.cend(), "Vendor BambooLab not found");
const VendorProfile * vendor_bbl = bbl_it->second.vendor_profile;
p->only_sla_mode = false;
p->any_sla_selected = p->check_sla_selected();
if (p->only_sla_mode)

View file

@ -277,7 +277,7 @@ static wxArrayString get_exist_vendor_choices(VendorMap& vendors)
vendors[users_models.name] = users_models;
}
for (const pair<std::string, VendorProfile> &vendor : vendors) {
for (const auto& vendor : vendors) {
if (vendor.second.models.empty() || vendor.second.id.empty()) continue;
choices.Add(vendor.first);
}
@ -315,7 +315,7 @@ static wxBoxSizer *create_preset_tree(wxWindow *parent, std::pair<std::string, s
int row = 1;
for (std::shared_ptr<Preset> preset : printer_and_preset.second) {
wxString preset_name = wxString::FromUTF8(preset->name);
treeCtrl->AppendItem(rootId, preset_name);
wxTreeItemId childId1 = treeCtrl->AppendItem(rootId, preset_name);
row++;
}
@ -658,11 +658,11 @@ void CreateFilamentPresetDialog::on_dpi_changed(const wxRect &suggested_rect) {
bool CreateFilamentPresetDialog::is_check_box_selected()
{
for (const std::pair<::CheckBox *, std::pair<std::string, Preset *>> &checkbox_preset : m_filament_preset) {
for (const auto& checkbox_preset : m_filament_preset) {
if (checkbox_preset.first->GetValue()) { return true; }
}
for (const std::pair<::CheckBox *, std::pair<std::string, Preset *>> &checkbox_preset : m_machint_filament_preset) {
for (const auto& checkbox_preset : m_machint_filament_preset) {
if (checkbox_preset.first->GetValue()) { return true; }
}
@ -671,6 +671,8 @@ bool CreateFilamentPresetDialog::is_check_box_selected()
wxBoxSizer *CreateFilamentPresetDialog::create_item(FilamentOptionType option_type)
{
wxSizer *item = nullptr;
switch (option_type) {
case VENDOR: return create_vendor_item();
case TYPE: return create_type_item();
@ -691,7 +693,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_vendor_item()
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
wxArrayString choices;
for (const wxString &vendor : filament_vendors) {
for (const wxString vendor : filament_vendors) {
choices.push_back(vendor);
}
choices.Sort();
@ -773,7 +775,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_type_item()
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
wxArrayString filament_type;
for (const wxString &filament : m_system_filament_types_set) {
for (const wxString filament : m_system_filament_types_set) {
filament_type.Add(filament);
}
filament_type.Sort();
@ -1048,7 +1050,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item()
if (curr_create_type == m_create_type.base_filament) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":clone filament create type filament ";
for (const std::pair<::CheckBox *, std::pair<std::string, Preset *>> &checkbox_preset : m_filament_preset) {
for (const auto& checkbox_preset : m_filament_preset) {
if (checkbox_preset.first->GetValue()) {
std::string compatible_printer_name = checkbox_preset.second.first;
std::vector<std::string> failures;
@ -1075,7 +1077,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item()
}
} else if (curr_create_type == m_create_type.base_filament_preset) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":clone filament presets create type filament preset";
for (const std::pair<::CheckBox *, std::pair<std::string, Preset *>> &checkbox_preset : m_machint_filament_preset) {
for (const auto& checkbox_preset : m_machint_filament_preset) {
if (checkbox_preset.first->GetValue()) {
std::string compatible_printer_name = checkbox_preset.second.first;
std::vector<std::string> failures;
@ -1153,7 +1155,7 @@ wxArrayString CreateFilamentPresetDialog::get_filament_preset_choices()
}
int suffix = 0;
for (const pair<std::string, std::vector<Preset *>> &preset : m_filament_choice_map) {
for (const auto& preset : m_filament_choice_map) {
if (preset.second.empty()) continue;
std::set<wxString> preset_name_set;
for (Preset* filament_preset : preset.second) {
@ -1750,7 +1752,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_nozzle_diameter_item(wxWindow *par
wxBoxSizer *comboBoxSizer = new wxBoxSizer(wxVERTICAL);
m_nozzle_diameter = new ComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, OPTION_SIZE, 0, nullptr, wxCB_READONLY);
wxArrayString nozzle_diameters;
for (const std::string nozzle : nozzle_diameter_vec) {
for (const std::string& nozzle : nozzle_diameter_vec) {
nozzle_diameters.Add(nozzle + " mm");
}
m_nozzle_diameter->Set(nozzle_diameters);
@ -3090,6 +3092,10 @@ bool CreatePrinterPresetDialog::check_printable_area() {
if (x == 0 || y == 0) {
return false;
}
double x0 = 0.0;
double y0 = 0.0;
double x1 = x;
double y1 = y;
if (dx >= x || dy >= y) {
return false;
}
@ -3893,7 +3899,7 @@ ExportConfigsDialog::ExportCase ExportConfigsDialog::archive_filament_bundle_to_
BOOST_LOG_TRIVIAL(info) << "Filament preset json add successful: " << filament_preset->name;
}
for (const std::pair<std::string, json>& vendor_name_to_json : vendor_structure) {
for (const auto& vendor_name_to_json : vendor_structure) {
json j;
std::string printer_vendor = vendor_name_to_json.first;
j["vendor"] = printer_vendor;
@ -4116,13 +4122,13 @@ wxBoxSizer *ExportConfigsDialog::create_select_printer(wxWindow *parent)
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
m_scrolled_preset_window = new wxScrolledWindow(parent);
m_scrolled_preset_window->SetScrollRate(5, 5);
m_scrolled_preset_window->SetBackgroundColour(PRINTER_LIST_COLOUR);
m_scrolled_preset_window->SetBackgroundColour(*wxWHITE);
m_scrolled_preset_window->SetMaxSize(wxSize(FromDIP(660), FromDIP(400)));
m_scrolled_preset_window->SetSize(wxSize(FromDIP(660), FromDIP(400)));
wxBoxSizer *scrolled_window = new wxBoxSizer(wxHORIZONTAL);
m_presets_window = new wxPanel(m_scrolled_preset_window, wxID_ANY);
m_presets_window->SetBackgroundColour(PRINTER_LIST_COLOUR);
m_presets_window->SetBackgroundColour(*wxWHITE);
wxBoxSizer *select_printer_sizer = new wxBoxSizer(wxVERTICAL);
m_preset_sizer = new wxGridSizer(3, FromDIP(5), FromDIP(5));
@ -4627,6 +4633,7 @@ wxBoxSizer *EditFilamentPresetDialog::create_button_sizer()
WarningDialog dlg(this, _L("All the filament presets belong to this filament would be deleted. \nIf you are using this filament on your printer, please reset the filament information for that slot."), _L("Delete filament"), wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxCENTRE);
int res = dlg.ShowModal();
if (wxID_YES == res) {
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
std::set<std::shared_ptr<Preset>> inherit_preset_names;
std::set<std::shared_ptr<Preset>> root_preset_names;
for (std::pair<std::string, std::vector<std::shared_ptr<Preset>>> printer_and_preset : m_printer_compatible_presets) {

View file

@ -89,6 +89,7 @@ void DailyTipsDataRenderer::open_wiki() const
void DailyTipsDataRenderer::render(const ImVec2& pos, const ImVec2& size) const
{
ImGuiWrapper& imgui = *wxGetApp().imgui();
ImGuiWindow* parent_window = ImGui::GetCurrentWindow();
int window_flags = parent_window->Flags;
window_flags &= ~ImGuiWindowFlags_NoScrollbar;
@ -189,6 +190,7 @@ void DailyTipsDataRenderer::render_text(const ImVec2& start_pos, const ImVec2& s
std::string tips_line = _u8L("For more information, please check out Wiki");
std::string wiki_part_text = _u8L("Wiki");
std::string first_part_text = tips_line.substr(0, tips_line.find(wiki_part_text));
ImVec2 wiki_part_size = ImGui::CalcTextSize(wiki_part_text.c_str());
ImVec2 first_part_size = ImGui::CalcTextSize(first_part_text.c_str());
//text
@ -198,6 +200,7 @@ void DailyTipsDataRenderer::render_text(const ImVec2& start_pos, const ImVec2& s
ImColor HyperColor = ImColor(31, 142, 234, (int)(255 * m_fade_opacity)).Value;
ImVec2 wiki_part_rect_min = ImVec2(link_start_pos.x + first_part_size.x, link_start_pos.y);
ImVec2 wiki_part_rect_max = wiki_part_rect_min + wiki_part_size;
ImGui::PushStyleColor(ImGuiCol_Text, HyperColor.Value);
ImGui::SetCursorScreenPos(wiki_part_rect_min);
imgui.text(wiki_part_text.c_str());
@ -261,6 +264,9 @@ ImVec2 DailyTipsPanel::get_size()
void DailyTipsPanel::render()
{
ImGuiWrapper& imgui = *wxGetApp().imgui();
float scale = imgui.get_font_size() / 15.0f;
if (!m_first_enter) {
retrieve_data_from_hint_database(HintDataNavigation::Curr);
m_first_enter = true;

View file

@ -1007,17 +1007,17 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
reset_mapping_result(result);
try {
// try to use ordering ams mapping
// bool order_mapping_result = true;
bool order_mapping_result = true;
for (int i = 0; i < filaments.size(); i++) {
if (i >= tray_info_list.size()) {
// order_mapping_result = false;
order_mapping_result = false;
break;
}
if (tray_info_list[i].tray_id == -1) {
result[i].tray_id = tray_info_list[i].tray_id;
} else {
if (!tray_info_list[i].type.empty() && tray_info_list[i].type != filaments[i].type) {
// order_mapping_result = false;
order_mapping_result = false;
break;
} else {
result[i].tray_id = tray_info_list[i].tray_id;
@ -1319,6 +1319,7 @@ wxString MachineObject::get_curr_stage()
int MachineObject::get_curr_stage_idx()
{
int result = -1;
for (int i = 0; i < stage_list_info.size(); i++) {
if (stage_list_info[i] == stage_curr) {
return i;
@ -2348,6 +2349,8 @@ int MachineObject::command_xcam_control(std::string module_name, bool on_off, st
int MachineObject::command_xcam_control_ai_monitoring(bool on_off, std::string lvl)
{
bool print_halt = (lvl == "never_halt") ? false:true;
xcam_ai_monitoring = on_off;
xcam_ai_monitoring_hold_count = HOLD_COUNT_MAX;
xcam_ai_monitoring_sensitivity = lvl;
@ -5659,7 +5662,9 @@ void DeviceManager::parse_user_print_info(std::string body)
}
}
}
catch (std::exception&) {}
catch (std::exception&) {
;
}
}
void DeviceManager::update_user_machine_list_info()

View file

@ -128,6 +128,7 @@ wxString DownloadProgressDialog::format_text(wxStaticText* st, wxString str, int
wxString out_txt = str;
wxString count_txt = "";
int new_line_pos = 0;
for (int i = 0; i < str.length(); i++) {
auto text_size = st->GetTextExtent(count_txt);

View file

@ -626,6 +626,7 @@ void ExtrusionCalibration::update_combobox_filaments()
{
m_comboBox_filament->SetValue(wxEmptyString);
user_filaments.clear();
int selection_idx = -1;
int filament_index = -1;
int curr_selection = -1;
wxArrayString filament_items;

View file

@ -1951,6 +1951,7 @@ void PointCtrl::BUILD()
y_textctrl->Bind(wxEVT_KILL_FOCUS, ([this](wxEvent& e) { e.Skip(); propagate_value(y_textctrl); }), y_textctrl->GetId());
// // recast as a wxWindow to fit the calling convention
window = dynamic_cast<wxWindow*>(x_input);
sizer = dynamic_cast<wxSizer*>(temp);
x_textctrl->SetToolTip(get_tooltip_text(X+", "+Y));

View file

@ -512,6 +512,7 @@ public:
TextInput* x_input{nullptr};
TextInput* y_input{nullptr};
wxWindow* window{nullptr};
void BUILD() override;
bool value_was_changed(wxTextCtrl* win);
// Propagate value from field to the OptionGroupe and Config after kill_focus/ENTER
@ -530,7 +531,7 @@ public:
x_textctrl->Disable();
y_textctrl->Disable(); }
wxSizer* getSizer() override { return sizer; }
wxWindow* getWindow() override { return dynamic_cast<wxWindow*>(x_textctrl); }
wxWindow* getWindow() override { return window; }
};
class StaticText : public Field {

View file

@ -2,6 +2,7 @@
#include "I18N.hpp"
#include "GUI_App.hpp"
#include "GUI.hpp"
#include "MainFrame.hpp"
#include "ExtraRenderers.hpp"
#include "format.hpp"

View file

@ -1447,6 +1447,9 @@ void GCodeViewer::_render_calibration_thumbnail_internal(ThumbnailData& thumbnai
//shader->set_uniform("emission_factor", 0.0f);
}
else {
switch (buffer.render_primitive_type) {
default: break;
}
int uniform_color = shader->get_uniform_location("uniform_color");
auto it_path = buffer.render_paths.begin();
for (unsigned int ibuffer_id = 0; ibuffer_id < static_cast<unsigned int>(buffer.indices.size()); ++ibuffer_id) {
@ -1744,10 +1747,10 @@ void GCodeViewer::update_layers_slider_mode()
// true -> single-extruder printer profile OR
// multi-extruder printer profile , but whole model is printed by only one extruder
// false -> multi-extruder printer profile , and model is printed by several extruders
// bool one_extruder_printed_model = true;
bool one_extruder_printed_model = true;
// extruder used for whole model for multi-extruder printer profile
// int only_extruder = -1;
int only_extruder = -1;
// BBS
if (wxGetApp().filaments_cnt() > 1) {
@ -1770,10 +1773,10 @@ void GCodeViewer::update_layers_slider_mode()
return true;
};
// if (is_one_extruder_printed_model())
// only_extruder = extruder;
// else
// one_extruder_printed_model = false;
if (is_one_extruder_printed_model())
only_extruder = extruder;
else
one_extruder_printed_model = false;
}
}
@ -3244,6 +3247,12 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
return in_layers_range(path.sub_paths.front().first.s_id) && in_layers_range(path.sub_paths.back().last.s_id);
};
//BBS
auto is_extruder_in_layer_range = [this](const Path& path, size_t extruder_id) {
return path.extruder_id == extruder_id;
};
auto is_travel_in_layers_range = [this](size_t path_id, size_t min_id, size_t max_id) {
const TBuffer& buffer = m_buffers[buffer_id(EMoveType::Travel)];
if (path_id >= buffer.paths.size())
@ -4088,6 +4097,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
std::vector<double> support_used_filaments_g_all_plates;
float total_time_all_plates = 0.0f;
float total_cost_all_plates = 0.0f;
bool show_detailed_statistics_page = false;
struct ColumnData {
enum {
Model = 1,
@ -4389,6 +4399,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
const float icon_size = ImGui::GetTextLineHeight() * 0.7;
//BBS GUI refactor
//const float percent_bar_size = 2.0f * ImGui::GetTextLineHeight();
const float percent_bar_size = 0;
bool imperial_units = wxGetApp().app_config->get("use_inches") == "1";
ImDrawList* draw_list = ImGui::GetWindowDrawList();
@ -4500,6 +4511,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
append_range_item(0, range.min, decimals);
}
else {
const float step_size = range.step_size();
for (int i = static_cast<int>(Range_Colors.size()) - 1; i >= 0; --i) {
append_range_item(i, range.get_value_at_step(i), decimals);
}
@ -4548,7 +4560,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
return ret;
};
/*auto color_print_ranges = [this](unsigned char extruder_id, const std::vector<CustomGCode::Item>& custom_gcode_per_print_z) {
auto color_print_ranges = [this](unsigned char extruder_id, const std::vector<CustomGCode::Item>& custom_gcode_per_print_z) {
std::vector<std::pair<ColorRGBA, std::pair<double, double>>> ret;
ret.reserve(custom_gcode_per_print_z.size());
@ -4577,7 +4589,27 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
}
return ret;
};*/
};
auto upto_label = [](double z) {
char buf[64];
::sprintf(buf, "%.2f", z);
return _u8L("up to") + " " + std::string(buf) + " " + _u8L("mm");
};
auto above_label = [](double z) {
char buf[64];
::sprintf(buf, "%.2f", z);
return _u8L("above") + " " + std::string(buf) + " " + _u8L("mm");
};
auto fromto_label = [](double z1, double z2) {
char buf1[64];
::sprintf(buf1, "%.2f", z1);
char buf2[64];
::sprintf(buf2, "%.2f", z2);
return _u8L("from") + " " + std::string(buf1) + " " + _u8L("to") + " " + std::string(buf2) + " " + _u8L("mm");
};
auto role_time_and_percent = [time_mode](ExtrusionRole role) {
auto it = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [role](const std::pair<ExtrusionRole, float>& item) { return role == item.first; });
@ -5074,7 +5106,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
ImGuiWindow* window = ImGui::GetCurrentWindow();
const ImRect separator(ImVec2(window->Pos.x + window_padding * 3, window->DC.CursorPos.y), ImVec2(window->Pos.x + window->Size.x - window_padding * 3, window->DC.CursorPos.y + 1.0f));
ImGui::ItemSize(ImVec2(0.0f, 0.0f));
ImGui::ItemAdd(separator, 0);
const bool item_visible = ImGui::ItemAdd(separator, 0);
window->DrawList->AddLine(separator.Min, ImVec2(separator.Max.x, separator.Min.y), ImGui::GetColorU32(ImGuiCol_Separator));
std::vector<std::pair<std::string, float>> columns_offsets;
@ -5196,7 +5228,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
return items;
};
/*auto append_color_change = [&imgui](const ColorRGBA& color1, const ColorRGBA& color2, const std::array<float, 4>& offsets, const Times& times) {
auto append_color_change = [&imgui](const ColorRGBA& color1, const ColorRGBA& color2, const std::array<float, 4>& offsets, const Times& times) {
imgui.text(_u8L("Color change"));
ImGui::SameLine();
@ -5213,9 +5245,9 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
ImGui::SameLine(offsets[0]);
imgui.text(short_time(get_time_dhms(times.second - times.first)));
};*/
};
/*auto append_print = [&imgui, imperial_units](const ColorRGBA& color, const std::array<float, 4>& offsets, const Times& times, std::pair<double, double> used_filament) {
auto append_print = [&imgui, imperial_units](const ColorRGBA& color, const std::array<float, 4>& offsets, const Times& times, std::pair<double, double> used_filament) {
imgui.text(_u8L("Print"));
ImGui::SameLine();
@ -5241,7 +5273,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
::sprintf(buffer, "%.2f g", used_filament.second);
imgui.text(buffer);
}
};*/
};
PartialTimes partial_times = generate_partial_times(time_mode.custom_gcode_times, m_print_statistics.volumes_per_color_change);
if (!partial_times.empty()) {
@ -5348,7 +5380,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
// }
//}
/* auto any_option_available = [this]() {
auto any_option_available = [this]() {
auto available = [this](EMoveType type) {
const TBuffer& buffer = m_buffers[buffer_id(type)];
return buffer.visible && buffer.has_data();
@ -5361,7 +5393,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
available(EMoveType::Tool_change) ||
available(EMoveType::Unretract) ||
available(EMoveType::Seam);
};*/
};
//auto add_option = [this, append_item](EMoveType move_type, EOptionsColors color, const std::string& text) {
// const TBuffer& buffer = m_buffers[buffer_id(move_type)];

View file

@ -2773,7 +2773,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
ModelInstanceEPrintVolumeState state;
const bool contained_min_one = m_volumes.check_outside_state(m_bed.build_volume(), &state);
const bool partlyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Partly_Outside);
// const bool fullyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Fully_Outside);
const bool fullyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Fully_Outside);
_set_warning_notification(EWarning::ObjectClashed, partlyOut);
//BBS: turn off the warning when fully outside
@ -4080,12 +4080,12 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
// Set focus in order to remove it from sidebar fields
if (m_canvas != nullptr) {
// Only set focus, if the top level window of this canvas is active.
// auto p = dynamic_cast<wxWindow*>(evt.GetEventObject());
// while (p->GetParent())
// p = p->GetParent();
// auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p);
// if (top_level_wnd && top_level_wnd->IsActive() && !wxGetApp().get_side_menu_popup_status())
// m_canvas->SetFocus();
auto p = dynamic_cast<wxWindow*>(evt.GetEventObject());
while (p->GetParent())
p = p->GetParent();
auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p);
if (top_level_wnd && top_level_wnd->IsActive() && !wxGetApp().get_side_menu_popup_status())
;// m_canvas->SetFocus();
m_mouse.position = pos.cast<double>();
m_tooltip_enabled = false;
// 1) forces a frame render to ensure that m_hover_volume_idxs is updated even when the user right clicks while
@ -5093,6 +5093,7 @@ std::vector<Vec2f> GLCanvas3D::get_empty_cells(const Vec2f start_point, const Ve
}
for (size_t i = 0; i < m_model->objects.size(); ++i) {
ModelObject* model_object = m_model->objects[i];
auto id = model_object->id().id;
ModelInstance* model_instance0 = model_object->instances.front();
Polygon hull_2d = model_object->convex_hull_2d(Geometry::assemble_transform({ 0.0, 0.0, model_instance0->get_offset().z() }, model_instance0->get_rotation(),
model_instance0->get_scaling_factor(), model_instance0->get_mirror()));
@ -5363,6 +5364,7 @@ void GLCanvas3D::update_sequential_clearance()
for (int i = k+1; i < bounding_box_count; i++)
{
Polygon& next_convex = convex_and_bounding_boxes[i].hull_polygon;
BoundingBox& next_bbox = convex_and_bounding_boxes[i].bounding_box;
auto py1 = next_bbox.min.y();
auto py2 = next_bbox.max.y();
@ -5423,6 +5425,7 @@ bool GLCanvas3D::_render_orient_menu(float left, float right, float bottom, floa
ImGuiWrapper* imgui = wxGetApp().imgui();
auto canvas_w = float(get_canvas_size().get_width());
auto canvas_h = float(get_canvas_size().get_height());
//BBS: GUI refactor: move main toolbar to the right
//original use center as {0.0}, and top is (canvas_h/2), bottom is (-canvas_h/2), also plus inv_camera
//now change to left_up as {0,0}, and top is 0, bottom is canvas_h
@ -5431,7 +5434,6 @@ bool GLCanvas3D::_render_orient_menu(float left, float right, float bottom, floa
ImGuiWrapper::push_toolbar_style(get_scale());
imgui->set_next_window_pos(x, m_main_toolbar.get_height(), ImGuiCond_Always, 0.5f, 0.0f);
#else
auto canvas_h = float(get_canvas_size().get_height());
const float x = canvas_w - m_main_toolbar.get_width();
const float y = 0.5f * canvas_h - top * float(wxGetApp().plater()->get_camera().get_zoom());
imgui->set_next_window_pos(x, y, ImGuiCond_Always, 1.0f, 0.0f);
@ -5446,13 +5448,13 @@ bool GLCanvas3D::_render_orient_menu(float left, float right, float bottom, floa
PrinterTechnology ptech = current_printer_technology();
bool settings_changed = false;
// float angle_min = 45.f;
float angle_min = 45.f;
std::string angle_key = "overhang_angle", rot_key = "enable_rotation";
std::string key_min_area = "min_area";
std::string postfix = "_fff";
if (ptech == ptSLA) {
// angle_min = 45.f;
angle_min = 45.f;
postfix = "_sla";
}
@ -5508,6 +5510,7 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo
ImGuiWrapper *imgui = wxGetApp().imgui();
auto canvas_w = float(get_canvas_size().get_width());
auto canvas_h = float(get_canvas_size().get_height());
//BBS: GUI refactor: move main toolbar to the right
//original use center as {0.0}, and top is (canvas_h/2), bottom is (-canvas_h/2), also plus inv_camera
//now change to left_up as {0,0}, and top is 0, bottom is canvas_h
@ -5515,8 +5518,8 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo
float left_pos = m_main_toolbar.get_item("arrange")->render_left_pos;
const float x = (1 + left_pos) * canvas_w / 2;
imgui->set_next_window_pos(x, m_main_toolbar.get_height(), ImGuiCond_Always, 0.0f, 0.0f);
#else
auto canvas_h = float(get_canvas_size().get_height());
const float x = canvas_w - m_main_toolbar.get_width();
const float y = 0.5f * canvas_h - top * float(wxGetApp().plater()->get_camera().get_zoom());
imgui->set_next_window_pos(x, y, ImGuiCond_Always, 1.0f, 0.0f);
@ -8096,13 +8099,16 @@ void GLCanvas3D::_render_return_toolbar() const
ImVec2 button_icon_size = ImVec2(font_size * 1.3, font_size * 1.3);
ImGuiWrapper& imgui = *wxGetApp().imgui();
Size cnv_size = get_canvas_size();
auto canvas_w = float(cnv_size.get_width());
auto canvas_h = float(cnv_size.get_height());
float window_width = real_size.x + button_icon_size.x + imgui.scaled(2.0f);
float window_height = button_icon_size.y + imgui.scaled(2.0f);
float window_pos_x = 30.0f + (is_collapse_toolbar_on_left() ? (get_collapse_toolbar_width() + 5.f) : 0);
float window_pos_y = 14.0f;
imgui.set_next_window_pos(window_pos_x, window_pos_y, ImGuiCond_Always, 0, 0);
#ifdef __WINDOWS__
float window_width = real_size.x + button_icon_size.x + imgui.scaled(2.0f);
float window_height = button_icon_size.y + imgui.scaled(2.0f);
imgui.set_next_window_size(window_width, window_height, ImGuiCond_Always);
#endif
@ -8116,6 +8122,9 @@ void GLCanvas3D::_render_return_toolbar() const
imgui.begin(_L("Assembly Return"), ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBackground
| ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse);
float button_width = 20;
float button_height = 20;
ImVec2 size = ImVec2(button_width, button_height); // Size of the image we want to make visible
ImVec2 uv0 = ImVec2(0.0f, 0.0f);
ImVec2 uv1 = ImVec2(1.0f, 1.0f);
@ -8391,11 +8400,11 @@ void GLCanvas3D::_render_assemble_control() const
ImGui::SameLine(window_padding.x + 2 * text_size_x + slider_width + item_spacing * 7 + value_size);
ImGui::PushItemWidth(slider_width);
imgui->bbl_slider_float_style("##ratio_slider", &m_explosion_ratio, 1.0f, 3.0f, "%1.2f");
bool explosion_slider_changed = imgui->bbl_slider_float_style("##ratio_slider", &m_explosion_ratio, 1.0f, 3.0f, "%1.2f");
ImGui::SameLine(window_padding.x + 2 * text_size_x + 2 * slider_width + item_spacing * 8 + value_size);
ImGui::PushItemWidth(value_size);
ImGui::BBLDragFloat("##ratio_input", &m_explosion_ratio, 0.1f, 1.0f, 3.0f, "%1.2f");
bool explosion_input_changed = ImGui::BBLDragFloat("##ratio_input", &m_explosion_ratio, 0.1f, 1.0f, 3.0f, "%1.2f");
}
imgui->end();

View file

@ -1466,6 +1466,7 @@ void GLToolbar::render_vertical(const GLCanvas3D& parent)
int tex_width, tex_height;
if (item->is_action_with_text_image()) {
float scaled_text_size = m_layout.text_size * m_layout.scale * inv_cnv_w;
float scaled_text_width = item->get_extra_size_ratio() * icons_size_x;
float scaled_text_border = 2.5 * m_layout.scale * inv_cnv_h;
float scaled_text_height = icons_size_y / 2.0f;
item->render_text(left, left + scaled_text_size, top - scaled_text_border - scaled_text_height, top - scaled_text_border);

View file

@ -547,7 +547,7 @@ void desktop_open_datadir_folder()
#endif
}
void desktop_open_any_folder( const std::string path )
void desktop_open_any_folder( const std::string& path )
{
// Execute command to open a file explorer, platform dependent.
// FIXME: The const_casts aren't needed in wxWidgets 3.1, remove them when we upgrade.
@ -558,7 +558,14 @@ void desktop_open_any_folder( const std::string path )
#elif __APPLE__
openFolderForFile(from_u8(path));
#else
const char *argv[] = {"xdg-open", path.data(), nullptr};
// Orca#6449: Open containing dir instead of opening the file directly.
std::string new_path = path;
boost::filesystem::path p(new_path);
if (!fs::is_directory(p)) {
new_path = p.parent_path().string();
}
const char* argv[] = {"xdg-open", new_path.data(), nullptr};
// Check if we're running in an AppImage container, if so, we need to remove AppImage's env vars,
// because they may mess up the environment expected by the file manager.

View file

@ -83,7 +83,7 @@ extern void login();
// Ask the destop to open the datadir using the default file explorer.
extern void desktop_open_datadir_folder();
// Ask the destop to open one folder
extern void desktop_open_any_folder(const std::string path);
extern void desktop_open_any_folder(const std::string& path);
} // namespace GUI
} // namespace Slic3r

View file

@ -301,6 +301,7 @@ public:
memDC.SetTextForeground(StateColor::darkModeColorFor(wxColour(144, 144, 144)));
int width = bitmap.GetWidth();
int text_height = memDC.GetTextExtent(text).GetHeight();
int text_width = memDC.GetTextExtent(text).GetWidth();
wxRect text_rect(wxPoint(0, m_action_line_y_position), wxPoint(width, m_action_line_y_position + text_height));
memDC.DrawLabel(text, text_rect, wxALIGN_CENTER);
@ -962,7 +963,7 @@ void GUI_App::post_init()
// Neither wxShowEvent nor wxWindowCreateEvent work reliably.
if (this->preset_updater) { // G-Code Viewer does not initialize preset_updater.
CallAfter([this] {
this->config_wizard_startup();
bool cw_showed = this->config_wizard_startup();
std::string http_url = get_http_url(app_config->get_country_code());
std::string language = GUI::into_u8(current_language_code());
@ -1025,7 +1026,8 @@ void GUI_App::post_init()
try {
std::time_t lw_t = boost::filesystem::last_write_time(temp_path) ;
files_vec.push_back({ lw_t, temp_path.filename().string() });
} catch (std::exception&) {}
} catch (const std::exception &) {
}
}
std::sort(files_vec.begin(), files_vec.end(), [](
std::pair<time_t, std::string> &a, std::pair<time_t, std::string> &b) {
@ -1315,6 +1317,7 @@ int GUI_App::download_plugin(std::string name, std::string package_name, Install
.on_complete([&pro_fn, tmp_path, target_file_path](std::string body, unsigned status) {
BOOST_LOG_TRIVIAL(info) << "[download_plugin 2] completed";
bool cancel = false;
int percent = 0;
fs::fstream file(tmp_path, std::ios::out | std::ios::binary | std::ios::trunc);
file.write(body.c_str(), body.size());
file.close();
@ -1924,13 +1927,8 @@ void GUI_App::init_app_config()
boost::filesystem::create_directory(data_dir_path);
}
// Change current directory of application
auto path = encode_path((Slic3r::data_dir() + "/log").c_str());
#ifdef _WIN32
_chdir(path.c_str());
#else
chdir(path.c_str());
#endif
// Change current dirtory of application
chdir(encode_path((Slic3r::data_dir() + "/log").c_str()).c_str());
} else {
m_datadir_redefined = true;
}
@ -3367,7 +3365,7 @@ if (res) {
mainframe->refresh_plugin_tips();
// BBS: remove SLA related message
}
} catch (std::exception&) {
} catch (std::exception &) {
// wxMessageBox(e.what(), "", MB_OK);
}
}
@ -3381,7 +3379,9 @@ void GUI_App::ShowDownNetPluginDlg() {
return;
DownloadProgressDialog dlg(_L("Downloading Bambu Network Plug-in"));
dlg.ShowModal();
} catch (std::exception&) {}
} catch (std::exception &) {
;
}
}
void GUI_App::ShowUserLogin(bool show)
@ -3396,7 +3396,9 @@ void GUI_App::ShowUserLogin(bool show)
login_dlg = new ZUserLogin();
}
login_dlg->ShowModal();
} catch (std::exception&) {}
} catch (std::exception &) {
;
}
} else {
if (login_dlg)
login_dlg->EndModal(wxID_OK);
@ -3416,7 +3418,7 @@ void GUI_App::ShowOnlyFilament() {
// BBS: remove SLA related message
}
} catch (std::exception&) {
} catch (std::exception &) {
// wxMessageBox(e.what(), "", MB_OK);
}
}
@ -3828,10 +3830,10 @@ std::string GUI_App::handle_web_request(std::string cmd)
auto keyCode = key_event_node.get<int>("key");
auto ctrlKey = key_event_node.get<bool>("ctrl");
auto shiftKey = key_event_node.get<bool>("shift");
auto cmdKey = key_event_node.get<bool>("cmd");
wxKeyEvent e(wxEVT_CHAR_HOOK);
#ifdef __APPLE__
auto cmdKey = key_event_node.get<bool>("cmd");
e.SetControlDown(cmdKey);
e.SetRawControlDown(ctrlKey);
#else
@ -4787,6 +4789,8 @@ void GUI_App::start_sync_user_preset(bool with_progress_dlg)
});
}
unsigned int http_code = 200;
/* get list witch need to be deleted*/
std::vector<string> delete_cache_presets = get_delete_cache_presets_lock();
for (auto it = delete_cache_presets.begin(); it != delete_cache_presets.end();) {
@ -5470,7 +5474,7 @@ void GUI_App::show_ip_address_enter_dialog_handler(wxCommandEvent& evt)
void GUI_App::open_preferences(size_t open_on_tab, const std::string& highlight_option)
{
// bool app_layout_changed = false;
bool app_layout_changed = false;
{
// the dialog needs to be destroyed before the call to recreate_GUI()
// or sometimes the application crashes into wxDialogBase() destructor

View file

@ -3,6 +3,8 @@
#include "I18N.hpp"
#include "wxExtensions.hpp"
#include <boost/filesystem.hpp>
#include "GUI_App.hpp"
#include "Plater.hpp"
#include "libslic3r/Model.hpp"

View file

@ -711,9 +711,9 @@ wxMenuItem* MenuFactory::append_menu_item_settings(wxMenu* menu_)
// Create new items for settings popupmenu
// if (printer_technology() == ptFFF ||
// (menu->GetMenuItems().size() > 0 && !menu->GetMenuItems().back()->IsSeparator()))
// menu->SetFirstSeparator();
if (printer_technology() == ptFFF ||
(menu->GetMenuItems().size() > 0 && !menu->GetMenuItems().back()->IsSeparator()))
;// menu->SetFirstSeparator();
// detect itemm for adding of the setting
ObjectList* object_list = obj_list();
@ -1341,7 +1341,7 @@ void MenuFactory::create_extra_object_menu()
m_object_menu.AppendSeparator();
// Set filament insert menu item here
// Set Printable
append_menu_item_printable(&m_object_menu);
wxMenuItem* menu_item_printable = append_menu_item_printable(&m_object_menu);
append_menu_item_per_object_process(&m_object_menu);
// Enter per object parameters
append_menu_item_per_object_settings(&m_object_menu);
@ -1496,6 +1496,8 @@ void MenuFactory::create_plate_menu()
// arrange objects on current plate
append_menu_item(menu, wxID_ANY, _L("Arrange"), _L("arrange current plate"),
[](wxCommandEvent&) {
PartPlate* plate = plater()->get_partplate_list().get_selected_plate();
assert(plate);
plater()->set_prepare_state(Job::PREPARE_STATE_MENU);
plater()->arrange();
}, "", nullptr,
@ -1508,6 +1510,8 @@ void MenuFactory::create_plate_menu()
append_menu_item(
menu, wxID_ANY, _L("Reload All"), _L("reload all from disk"),
[](wxCommandEvent&) {
PartPlate* plate = plater()->get_partplate_list().get_selected_plate();
assert(plate);
plater()->set_prepare_state(Job::PREPARE_STATE_MENU);
plater()->reload_all_from_disk();
},
@ -1516,6 +1520,8 @@ void MenuFactory::create_plate_menu()
// orient objects on current plate
append_menu_item(menu, wxID_ANY, _L("Auto Rotate"), _L("auto rotate current plate"),
[](wxCommandEvent&) {
PartPlate* plate = plater()->get_partplate_list().get_selected_plate();
assert(plate);
//BBS TODO call auto rotate for current plate
plater()->set_prepare_state(Job::PREPARE_STATE_MENU);
plater()->orient();
@ -1800,7 +1806,7 @@ void MenuFactory::append_menu_item_clone(wxMenu* menu)
void MenuFactory::append_menu_item_simplify(wxMenu* menu)
{
append_menu_item(menu, wxID_ANY, _L("Simplify Model"), "",
wxMenuItem* menu_item = append_menu_item(menu, wxID_ANY, _L("Simplify Model"), "",
[](wxCommandEvent&) { obj_list()->simplify(); }, "", menu,
[]() {return plater()->can_simplify(); }, m_parent);
}
@ -1913,16 +1919,16 @@ void MenuFactory::append_menu_item_change_filament(wxMenu* menu)
wxMenu* extruder_selection_menu = new wxMenu();
const wxString& name = sels.Count() == 1 ? names[0] : names[1];
// int initial_extruder = -1; // negative value for multiple object/part selection
// if (sels.Count() == 1) {
// const ModelConfig& config = obj_list()->get_item_config(sels[0]);
// // BBS
// const auto sel_vol = obj_list()->get_selected_model_volume();
// if (sel_vol && sel_vol->type() == ModelVolumeType::PARAMETER_MODIFIER)
// initial_extruder = config.has("extruder") ? config.extruder() : 0;
// else
// initial_extruder = config.has("extruder") ? config.extruder() : 1;
// }
int initial_extruder = -1; // negative value for multiple object/part selection
if (sels.Count() == 1) {
const ModelConfig& config = obj_list()->get_item_config(sels[0]);
// BBS
const auto sel_vol = obj_list()->get_selected_model_volume();
if (sel_vol && sel_vol->type() == ModelVolumeType::PARAMETER_MODIFIER)
initial_extruder = config.has("extruder") ? config.extruder() : 0;
else
initial_extruder = config.has("extruder") ? config.extruder() : 1;
}
// BBS
bool has_modifier = false;
@ -1963,6 +1969,7 @@ void MenuFactory::append_menu_item_change_filament(wxMenu* menu)
void MenuFactory::append_menu_item_set_printable(wxMenu* menu)
{
const Selection& selection = plater()->canvas3D()->get_selection();
bool all_printable = true;
ObjectList* list = obj_list();
wxDataViewItemArray sels;
@ -2012,8 +2019,8 @@ void MenuFactory::append_menu_item_locked(wxMenu* menu)
}, "", nullptr, []() { return true; }, m_parent);
m_parent->Bind(wxEVT_UPDATE_UI, [](wxUpdateUIEvent& evt) {
// PartPlate* plate = plater()->get_partplate_list().get_selected_plate();
// assert(plate);
PartPlate* plate = plater()->get_partplate_list().get_selected_plate();
assert(plate);
//bool check = plate->is_locked();
//evt.Check(check);
plater()->set_current_canvas_as_dirty();
@ -2049,6 +2056,8 @@ void MenuFactory::append_menu_item_plate_name(wxMenu *menu)
m_parent->Bind(
wxEVT_UPDATE_UI,
[](wxUpdateUIEvent &evt) {
PartPlate *plate = plater()->get_partplate_list().get_selected_plate();
assert(plate);
plater()->set_current_canvas_as_dirty();
},
item->GetId());

View file

@ -713,6 +713,7 @@ void ObjectList::update_plate_values_for_items()
Unselect(item);
bool is_old_parent_expanded = IsExpanded(old_parent);
bool is_expanded = IsExpanded(item);
m_objects_model->OnPlateChange(plate_idx, item);
if (is_old_parent_expanded)
Expand(old_parent);
@ -738,6 +739,7 @@ void ObjectList::object_config_options_changed(const ObjectVolumeID& ov_id)
if (ov_id.object == nullptr)
return;
ModelObjectPtrs& objects = wxGetApp().model().objects;
ModelObject* mo = ov_id.object;
ModelVolume* mv = ov_id.volume;
@ -844,6 +846,8 @@ void ObjectList::update_filament_colors()
void ObjectList::update_name_column_width() const
{
wxSize client_size = this->GetClientSize();
bool p_vbar = this->GetParent()->HasScrollbar(wxVERTICAL);
bool p_hbar = this->GetParent()->HasScrollbar(wxHORIZONTAL);
auto em = em_unit(const_cast<ObjectList*>(this));
// BBS: walkaround for wxDataViewCtrl::HasScrollbar() does not return correct status
@ -932,6 +936,7 @@ void ObjectList::update_name_in_model(const wxDataViewItem& item) const
if (m_objects_model->GetItemType(item) & itPlate) {
std::string name = m_objects_model->GetName(item).ToUTF8().data();
int plate_idx = -1;
const ItemType type0 = m_objects_model->GetItemType(item, plate_idx);
if (plate_idx >= 0) {
auto plate = wxGetApp().plater()->get_partplate_list().get_plate(plate_idx);
if (plate->get_plate_name() != name) {
@ -1346,7 +1351,8 @@ void ObjectList::show_context_menu(const bool evt_context_menu)
plater->SetPlateIndexByRightMenuInLeftUI(-1);
if (type & itPlate) {
int plate_idx = -1;
if (plate_idx >= 0) {
const ItemType type0 = m_objects_model->GetItemType(item, plate_idx);
if (plate_idx >= 0) {
plater->SetPlateIndexByRightMenuInLeftUI(plate_idx);
}
}
@ -2899,7 +2905,7 @@ void ObjectList::boolean()
new_object->config.assign_config(object->config);
if (new_object->instances.empty())
new_object->add_instance();
new_object->add_volume(mesh);
ModelVolume* new_volume = new_object->add_volume(mesh);
// BBS: ensure on bed but no need to ensure locate in the center around origin
new_object->ensure_on_bed();
@ -2946,9 +2952,9 @@ DynamicPrintConfig ObjectList::get_default_layer_config(const int obj_idx)
wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_float("layer_height");
config.set_key_value("layer_height",new ConfigOptionFloat(layer_height));
// BBS
// int extruder = object(obj_idx)->config.has("extruder") ?
// object(obj_idx)->config.opt_int("extruder") :
// wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_float("extruder");
int extruder = object(obj_idx)->config.has("extruder") ?
object(obj_idx)->config.opt_int("extruder") :
wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_float("extruder");
config.set_key_value("extruder", new ConfigOptionInt(0));
return config;
@ -3170,8 +3176,8 @@ void ObjectList::part_selection_changed()
bool update_and_show_settings = false;
bool update_and_show_layers = false;
// bool enable_manipulation{true}; Orca: Removed because not used
// bool disable_ss_manipulation{false}; Orca: Removed because not used
bool enable_manipulation{true};
bool disable_ss_manipulation{false};
bool disable_ununiform_scale{false};
const auto item = GetSelection();
@ -3179,7 +3185,7 @@ void ObjectList::part_selection_changed()
og_name = _L("Cut Connectors information");
update_and_show_manipulations = true;
// enable_manipulation = false;
enable_manipulation = false;
disable_ununiform_scale = true;
}
else if (item && (m_objects_model->GetItemType(item) & itPlate)) {
@ -3196,7 +3202,7 @@ void ObjectList::part_selection_changed()
obj_idx = selection.get_object_idx();
ModelObject *object = (*m_objects)[obj_idx];
m_config = &object->config;
// disable_ss_manipulation = object->is_cut();
disable_ss_manipulation = object->is_cut();
}
else {
og_name = _L("Group manipulation");
@ -3205,17 +3211,17 @@ void ObjectList::part_selection_changed()
update_and_show_manipulations = !selection.is_single_full_instance();
if (int obj_idx = selection.get_object_idx(); obj_idx >= 0) {
// if (selection.is_any_volume() || selection.is_any_modifier())
// enable_manipulation = !(*m_objects)[obj_idx]->is_cut();
// else // if (item && m_objects_model->GetItemType(item) == itInstanceRoot)
// disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
if (selection.is_any_volume() || selection.is_any_modifier())
enable_manipulation = !(*m_objects)[obj_idx]->is_cut();
else // if (item && m_objects_model->GetItemType(item) == itInstanceRoot)
disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
}
else {
wxDataViewItemArray sels;
GetSelections(sels);
if (selection.is_single_full_object() || selection.is_multiple_full_instance()) {
// int obj_idx = m_objects_model->GetObjectIdByItem(sels.front());
// disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
int obj_idx = m_objects_model->GetObjectIdByItem(sels.front());
disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
} else if (selection.is_mixed() || selection.is_multiple_full_object()) {
std::map<CutObjectBase, std::set<int>> cut_objects;
@ -3234,7 +3240,7 @@ void ObjectList::part_selection_changed()
// check if selected cut objects are "full selected"
for (auto cut_object : cut_objects)
if (cut_object.first.check_sum() != cut_object.second.size()) {
// disable_ss_manipulation = true;
disable_ss_manipulation = true;
break;
}
disable_ununiform_scale = !cut_objects.empty();
@ -3282,7 +3288,7 @@ void ObjectList::part_selection_changed()
// BBS: select object to edit config
m_config = &(*m_objects)[obj_idx]->config;
update_and_show_settings = true;
// disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
}
}
else {
@ -3310,8 +3316,8 @@ void ObjectList::part_selection_changed()
m_config = &(*m_objects)[obj_idx]->volumes[volume_id]->config;
update_and_show_settings = true;
// const ModelVolume *volume = (*m_objects)[obj_idx]->volumes[volume_id];
// enable_manipulation = !((*m_objects)[obj_idx]->is_cut() && (volume->is_cut_connector() || volume->is_model_part()));
const ModelVolume *volume = (*m_objects)[obj_idx]->volumes[volume_id];
enable_manipulation = !((*m_objects)[obj_idx]->is_cut() && (volume->is_cut_connector() || volume->is_model_part()));
}
else if (type & itInstance) {
og_name = _L("Instance manipulation");
@ -3319,7 +3325,7 @@ void ObjectList::part_selection_changed()
// fill m_config by object's values
m_config = &(*m_objects)[obj_idx]->config;
// disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
}
else if (type & (itLayerRoot | itLayer)) {
og_name = type & itLayerRoot ? _L("Height ranges") : _L("Settings for height range");
@ -3362,7 +3368,7 @@ void ObjectList::part_selection_changed()
if (printer_technology() == ptSLA)
update_and_show_layers = false;
else if (update_and_show_layers) {
//wxGetApp().obj_layers()->get_og()->set_name(" " + og_name + " ");
;//wxGetApp().obj_layers()->get_og()->set_name(" " + og_name + " ");
}
update_min_height();
@ -3394,6 +3400,7 @@ wxDataViewItem ObjectList::add_settings_item(wxDataViewItem parent_item, const D
return ret;
const bool is_object_settings = m_objects_model->GetItemType(parent_item) == itObject;
const bool is_volume_settings = m_objects_model->GetItemType(parent_item) == itVolume;
const bool is_layer_settings = m_objects_model->GetItemType(parent_item) == itLayer;
if (!is_object_settings) {
ModelVolumeType volume_type = m_objects_model->GetVolumeType(parent_item);
@ -4682,6 +4689,8 @@ void ObjectList::select_item(const ObjectVolumeID& ov_id)
void ObjectList::select_items(const std::vector<ObjectVolumeID>& ov_ids)
{
ModelObjectPtrs& objects = wxGetApp().model().objects;
wxDataViewItemArray sel_items;
for (auto ov_id : ov_ids) {
if (ov_id.object == nullptr)
@ -5686,7 +5695,7 @@ void ObjectList::set_extruder_for_selected_items(const int extruder)
void ObjectList::on_plate_added(PartPlate* part_plate)
{
m_objects_model->AddPlate(part_plate);
wxDataViewItem plate_item = m_objects_model->AddPlate(part_plate);
}
void ObjectList::on_plate_deleted(int plate_idx)

View file

@ -205,7 +205,7 @@ bool ObjectSettings::update_settings_list()
bool is_object_settings = false;
bool is_volume_settings = false;
bool is_layer_range_settings = false;
// bool is_layer_root = false;
bool is_layer_root = false;
ModelObject * parent_object = nullptr;
for (auto item : items) {
auto type = objects_model->GetItemType(item);
@ -255,9 +255,9 @@ bool ObjectSettings::update_settings_list()
t_layer_height_range height_range = objects_model->GetLayerRangeByItem(item);
object_configs.emplace( (ObjectBase*)(&object->layer_config_ranges.at(height_range)), &object->layer_config_ranges.at(height_range) );
}
// else if (type == itLayerRoot) {
// is_layer_root = true;
// }
else if (type == itLayerRoot) {
is_layer_root = true;
}
}
auto tab_plate = dynamic_cast<TabPrintPlate*>(wxGetApp().get_plate_tab());

View file

@ -280,6 +280,7 @@ wxGridActivationResult GridCellFilamentsEditor::TryActivate(int row, int col, wx
{
ObjectGridTable *table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
ObjectGridTable::ObjectGridCol* grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow* grid_row = table->get_grid_row(row - 1);
if ( actSource.GetOrigin() == wxGridActivationSource::Key ) {
const wxKeyEvent& key_event = actSource.GetKeyEvent();
@ -315,6 +316,7 @@ void GridCellFilamentsEditor::DoActivate(int row, int col, wxGrid* grid)
if (m_cached_value != -1) {
ObjectGridTable *table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
ObjectGridTable::ObjectGridCol* grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow* grid_row = table->get_grid_row(row - 1);
if (m_cached_value <= grid_col->choice_count) {
wxString choice = grid_col->choices[m_cached_value-1];
table->SetValue(row, col, choice);
@ -330,6 +332,7 @@ void GridCellFilamentsRenderer::Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &d
wxRect text_rect = rect;
if (table) {
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
ConfigOptionInt & cur_option = dynamic_cast<ConfigOptionInt &>((*grid_row)[(ObjectGridTable::GridColType) col]);
@ -469,6 +472,7 @@ wxGridActivationResult GridCellChoiceEditor::TryActivate(int row, int col, wxGri
{
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
if (actSource.GetOrigin() == wxGridActivationSource::Key) {
const wxKeyEvent &key_event = actSource.GetKeyEvent();
@ -501,6 +505,7 @@ void GridCellChoiceEditor::DoActivate(int row, int col, wxGrid *grid)
if (m_cached_value != -1) {
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
if (m_cached_value <= grid_col->choice_count) {
wxString choice = grid_col->choices[m_cached_value - 1];
table->SetValue(row, col, choice);
@ -516,6 +521,7 @@ void GridCellComboBoxRenderer::Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc
wxRect text_rect = rect;
if (table) {
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
ConfigOptionInt & cur_option = dynamic_cast<ConfigOptionInt &>((*grid_row)[(ObjectGridTable::GridColType) col]);
@ -555,6 +561,7 @@ wxString GridCellSupportEditor::ms_stringValues[2] = { wxT(""), wxT("") };
void GridCellSupportEditor::DoActivate(int row, int col, wxGrid* grid)
{
ObjectGrid* local_table = dynamic_cast<ObjectGrid*>(grid);
wxGridBlocks cell_array = grid->GetSelectedBlocks();
auto left_col = cell_array.begin()->GetLeftCol();
@ -684,6 +691,7 @@ void GridCellSupportRenderer::Draw(wxGrid& grid,
//wxGridCellBoolRenderer::Draw(grid, attr, dc, rect, row, col, isSelected);
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid.GetTable());
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
ConfigOptionBool & cur_option = dynamic_cast<ConfigOptionBool &>((*grid_row)[(ObjectGridTable::GridColType) col]);
@ -883,6 +891,7 @@ void ObjectGrid::OnKeyDown( wxKeyEvent& event )
// see include/wx/defs.h enum wxKeyCode
int keyCode = event.GetKeyCode();
int ctrlMask = wxMOD_CONTROL;
int shiftMask = wxMOD_SHIFT;
// Coordinates of the selected block to copy to clipboard.
wxGridBlockCoords selection;
wxTextDataObject text_data;
@ -1535,6 +1544,7 @@ void ObjectGridTable::SetValue( int row, int col, const wxString& value )
return;
ObjectGridRow* grid_row = m_grid_data[row - 1];
ObjectGridCol* grid_col = m_col_data[col];
ObjectList* obj_list = wxGetApp().obj_list();
if (grid_col->type == coEnum) {
int enum_value = 0;
for (int i = 0; i < grid_col->choice_count; i++)
@ -1802,6 +1812,9 @@ wxString ObjectGridTable::convert_filament_string(int index, wxString& filament_
void ObjectGridTable::init_cols(ObjectGrid *object_grid)
{
const float font_size = 1.5f * wxGetApp().em_unit();
// printable for object
ObjectGridCol *col = new ObjectGridCol(coBool, "printable", ObjectGridTable::category_all, true, false, true, false, wxALIGN_CENTRE);
col->size = object_grid->GetTextExtent(L("Printable")).x;
@ -1897,6 +1910,7 @@ void ObjectGridTable::init_cols(ObjectGrid *object_grid)
col = new ObjectGridCol(coFloat, "inner_wall_speed_reset", L("Speed"), false, true, false, false, wxALIGN_LEFT);
m_col_data.push_back(col);
return;
}
void ObjectGridTable::construct_object_configs(ObjectGrid *object_grid)
@ -1915,8 +1929,8 @@ void ObjectGridTable::construct_object_configs(ObjectGrid *object_grid)
int object_count = m_panel->m_model->objects.size();
PartPlateList& partplate_list = m_panel->m_plater->get_partplate_list();
DynamicPrintConfig& global_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
// const DynamicPrintConfig* plater_config = m_panel->m_plater->config();
// const DynamicPrintConfig& filament_config = *plater_config;
const DynamicPrintConfig* plater_config = m_panel->m_plater->config();
const DynamicPrintConfig& filament_config = *plater_config;
for (int i = 0; i < object_count; i++)
{
@ -2812,7 +2826,7 @@ int ObjectTablePanel::init_filaments_and_colors()
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", invalid color count:%1%, extruder count: %2%") %color_count %m_filaments_count;
}
int i = 0;
unsigned int i = 0;
ColorRGB rgb;
while (i < m_filaments_count) {
const std::string& txt_color = global_config->opt_string("filament_colour", i);
@ -3018,6 +3032,7 @@ void ObjectTablePanel::load_data()
{
ObjectGridTable::ObjectGridCol *grid_col = m_object_grid_table->get_grid_col(i);
if (grid_col->size > 0) {
int fit_size1 = m_object_grid->GetColSize(i);
m_object_grid->SetColSize(i, grid_col->size);
}
}
@ -3158,7 +3173,7 @@ void ObjectTablePanel::OnRowSize( wxGridSizeEvent& ev)
g_dialog_max_height =(panel_size.GetHeight() > g_max_size_from_parent.GetHeight())?g_max_size_from_parent.GetHeight():panel_size.GetHeight();
this->SetMaxSize(wxSize(g_dialog_max_width, g_dialog_max_height));
// wxSize current_size = GetParent()->GetSize();
wxSize current_size = GetParent()->GetSize();
//if (current_size.GetHeight() < g_dialog_max_height)
GetParent()->SetMaxSize(wxSize(g_dialog_max_width, g_dialog_max_height));
GetParent()->SetSize(wxSize(g_dialog_max_width, g_dialog_max_height));
@ -3172,7 +3187,7 @@ void ObjectTablePanel::OnColSize( wxGridSizeEvent& ev)
g_dialog_max_height =(panel_size.GetHeight() > g_max_size_from_parent.GetHeight())?g_max_size_from_parent.GetHeight():panel_size.GetHeight();
this->SetMaxSize(wxSize(g_dialog_max_width, g_dialog_max_height));
// wxSize current_size = GetParent()->GetSize();
wxSize current_size = GetParent()->GetSize();
//if (current_size.GetWidth() < g_dialog_max_width)
GetParent()->SetMaxSize(wxSize(g_dialog_max_width, g_dialog_max_height));
GetParent()->SetSize(wxSize(g_dialog_max_width, g_dialog_max_height));
@ -3456,6 +3471,8 @@ void GridCellTextEditor::SetSize(const wxRect &rect) { wxGridCellTextEditor::Set
void GridCellTextEditor::BeginEdit(int row, int col, wxGrid *grid)
{
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
auto val = table->GetValue(row, col);
@ -3489,6 +3506,10 @@ void GridCellTextEditor::BeginEdit(int row, int col, wxGrid *grid)
bool GridCellTextEditor::EndEdit(int row, int col, const wxGrid *grid, const wxString &WXUNUSED(oldval), wxString *newval)
{
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
wxCHECK_MSG(m_control, false, "wxGridCellTextEditor must be created first!");
const wxString value = Text()->GetTextCtrl()->GetValue();

View file

@ -108,6 +108,7 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_
//SettingsFactory::Bundle cat_options = SettingsFactory::get_bundle(&config->get(), is_object);
std::map<std::string, std::vector<SimpleSettingData>> cat_options;
std::vector<SimpleSettingData> category_settings = SettingsFactory::get_visible_options(category, !is_object);
bool display_multiple = false;
auto is_option_modified = [this](std::string key) {
ConfigOption* config_option1 = m_origin_config.option(key);
ConfigOption* config_option2 = m_current_config.option(key);
@ -146,6 +147,7 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_
else
it1 = cat_options.erase(it1);
}
display_multiple = true;
}
else {
cat_options.emplace(category, category_settings);

View file

@ -6,6 +6,7 @@
#include "GUI_App.hpp"
#include "GUI.hpp"
#include "I18N.hpp"
#include "3DScene.hpp"
#include "BackgroundSlicingProcess.hpp"
#include "OpenGLManager.hpp"
#include "GLCanvas3D.hpp"
@ -14,11 +15,19 @@
#include "MainFrame.hpp"
#include "format.hpp"
#include <wx/listbook.h>
#include <wx/notebook.h>
#include <wx/glcanvas.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/choice.h>
#include <wx/combo.h>
#include <wx/combobox.h>
#include <wx/checkbox.h>
// this include must follow the wxWidgets ones or it won't compile on Windows -> see http://trac.wxwidgets.org/ticket/2421
#include "libslic3r/Print.hpp"
#include "libslic3r/SLAPrint.hpp"
#include "NotificationManager.hpp"
#ifdef _WIN32
@ -533,6 +542,7 @@ void Preview::update_layers_slider_from_canvas(wxKeyEvent &event)
const auto key = event.GetKeyCode();
IMSlider *m_layers_slider = m_canvas->get_gcode_viewer().get_layers_slider();
IMSlider *m_moves_slider = m_canvas->get_gcode_viewer().get_moves_slider();
if (key == 'L') {
if(!m_layers_slider->switch_one_layer_mode())
event.Skip();

View file

@ -3057,7 +3057,7 @@ bool GLGizmoEmboss::choose_font_by_wxdialog()
}
#endif // ALLOW_ADD_FONT_BY_OS_SELECTOR
#if defined(ALLOW_ADD_FONT_BY_FILE) || defined(ALLOW_DEBUG_MODE)
#if defined ALLOW_ADD_FONT_BY_FILE or defined ALLOW_DEBUG_MODE
namespace priv {
static std::string get_file_name(const std::string &file_path)
{
@ -3693,6 +3693,7 @@ GuiCfg create_gui_configuration()
cfg.height_of_volume_type_selector = separator_height + line_height_with_spacing + input_height;
int max_style_image_width = static_cast<int>(std::round(cfg.max_style_name_width/2 - 2 * style.FramePadding.x));
int max_style_image_height = static_cast<int>(std::round(input_height));
cfg.max_style_image_size = Vec2i32(max_style_image_width, line_height);
cfg.face_name_size = Vec2i32(cfg.input_width, line_height_with_spacing);
cfg.face_name_texture_offset_x = cfg.face_name_size.x() + space;

View file

@ -245,10 +245,17 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
const float gap_fill_slider_left = m_imgui->calc_text_size(m_desc.at("gap_fill")).x + m_imgui->scaled(1.5f);
const float highlight_slider_left = m_imgui->calc_text_size(m_desc.at("highlight_by_angle")).x + m_imgui->scaled(1.5f);
const float reset_button_slider_left = m_imgui->calc_text_size(m_desc.at("reset_direction")).x + m_imgui->scaled(1.5f) + ImGui::GetStyle().FramePadding.x * 2;
const float on_overhangs_only_width = m_imgui->calc_text_size(m_desc["on_overhangs_only"]).x + m_imgui->scaled(1.5f);
const float remove_btn_width = m_imgui->calc_text_size(m_desc.at("remove_all")).x + m_imgui->scaled(1.5f);
const float filter_btn_width = m_imgui->calc_text_size(m_desc.at("perform")).x + m_imgui->scaled(1.5f);
const float gap_area_txt_width = m_imgui->calc_text_size(m_desc.at("gap_area")).x + m_imgui->scaled(1.5f);
const float smart_fill_angle_txt_width = m_imgui->calc_text_size(m_desc.at("smart_fill_angle")).x + m_imgui->scaled(1.5f);
const float buttons_width = remove_btn_width + filter_btn_width + m_imgui->scaled(1.5f);
const float empty_button_width = m_imgui->calc_button_size("").x;
const float tips_width = m_imgui->calc_text_size(_L("Auto support threshold angle: ") + " 90 ").x + m_imgui->scaled(1.5f);
const float minimal_slider_width = m_imgui->scaled(4.f);
float caption_max = 0.f;
float total_text_max = 0.f;
for (const auto &t : std::array<std::string, 5>{"enforce", "block", "remove", "cursor_size", "clipping_of_view"}) {
@ -265,6 +272,8 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
const float sliders_width = m_imgui->scaled(7.0f);
const float drag_left_width = ImGui::GetStyle().WindowPadding.x + sliders_left_width + sliders_width - space_size;
float drag_pos_times = 0.7;
ImGui::AlignTextToFramePadding();
m_imgui->text(m_desc.at("tool_type"));
std::array<wchar_t, 4> tool_ids = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon, ImGui::FillButtonIcon, ImGui::GapFillIcon };
@ -688,6 +697,7 @@ wxString GLGizmoFdmSupports::handle_snapshot_action_name(bool shift_down, GLGizm
void GLGizmoFdmSupports::init_print_instance()
{
const PrintObject* print_object = NULL;
PrintInstance print_instance = { 0 };
const Print *print = m_parent.fff_print();
if (!m_c->selection_info() || (m_print_instance.print_object))

View file

@ -138,6 +138,8 @@ void GLGizmoMeshBoolean::on_render()
BoundingBoxf3 src_bb;
BoundingBoxf3 tool_bb;
const ModelObject* mo = m_c->selection_info()->model_object();
const ModelInstance* mi = mo->instances[m_parent.get_selection().get_instance_idx()];
const Selection& selection = m_parent.get_selection();
const Selection::IndicesList& idxs = selection.get_volume_idxs();
for (unsigned int i : idxs) {
@ -161,12 +163,16 @@ void GLGizmoMeshBoolean::on_set_state()
if (m_state == EState::On) {
m_src.reset();
m_tool.reset();
bool m_diff_delete_input = false;
bool m_inter_delete_input = false;
m_operation_mode = MeshBooleanOperation::Union;
m_selecting_state = MeshBooleanSelectingState::SelectSource;
}
else if (m_state == EState::Off) {
m_src.reset();
m_tool.reset();
bool m_diff_delete_input = false;
bool m_inter_delete_input = false;
m_operation_mode = MeshBooleanOperation::Undef;
m_selecting_state = MeshBooleanSelectingState::Undef;
wxGetApp().notification_manager()->close_plater_warning_notification(warning_text);

View file

@ -403,6 +403,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
const float filter_btn_width = m_imgui->calc_text_size(m_desc.at("perform")).x + m_imgui->scaled(1.f);
const float buttons_width = remove_btn_width + filter_btn_width + m_imgui->scaled(1.f);
const float minimal_slider_width = m_imgui->scaled(4.f);
const float color_button_width = m_imgui->calc_text_size(std::string_view{""}).x + m_imgui->scaled(1.75f);
float caption_max = 0.f;
float total_text_max = 0.f;
@ -443,6 +444,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
float start_pos_x = ImGui::GetCursorPos().x;
const ImVec2 max_label_size = ImGui::CalcTextSize("99", NULL, true);
const float item_spacing = m_imgui->scaled(0.8f);
size_t n_extruder_colors = std::min((size_t)EnforcerBlockerType::ExtruderMax, m_extruders_colors.size());
for (int extruder_idx = 0; extruder_idx < n_extruder_colors; extruder_idx++) {
const ColorRGBA &extruder_color = m_extruders_colors[extruder_idx];

View file

@ -527,10 +527,21 @@ std::vector<GLGizmoPainterBase::ProjectedHeightRange> GLGizmoPainterBase::get_pr
if (m_rr.mesh_id == -1)
return hit_triangles_by_mesh;
ProjectedMousePosition mesh_hit_point = { m_rr.hit, m_rr.mesh_id, m_rr.facet };
float z_bot_world= (trafo_matrices[m_rr.mesh_id] * Vec3d(m_rr.hit(0), m_rr.hit(1), m_rr.hit(2))).z();
float z_top_world = z_bot_world+ m_cursor_height;
hit_triangles_by_mesh.push_back({ z_bot_world, m_rr.mesh_id, size_t(m_rr.facet) });
const Selection& selection = m_parent.get_selection();
const ModelObject* mo = m_c->selection_info()->model_object();
const ModelInstance* mi = mo->instances[selection.get_instance_idx()];
const Transform3d instance_trafo = m_parent.get_canvas_type() == GLCanvas3D::CanvasAssembleView ?
mi->get_assemble_transformation().get_matrix() :
mi->get_transformation().get_matrix();
const Transform3d instance_trafo_not_translate = m_parent.get_canvas_type() == GLCanvas3D::CanvasAssembleView ?
mi->get_assemble_transformation().get_matrix_no_offset() :
mi->get_transformation().get_matrix_no_offset();
for (int mesh_idx = 0; mesh_idx < part_volumes.size(); mesh_idx++) {
if (mesh_idx == m_rr.mesh_id)
continue;
@ -701,6 +712,7 @@ bool GLGizmoPainterBase::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
// The mouse button click detection is enabled when there is a valid hit.
// Missing the object entirely
// shall not capture the mouse.
const bool dragging_while_painting = (action == SLAGizmoEventType::Dragging && m_button_down != Button::None);
if (mesh_idx != -1 && m_button_down == Button::None)
m_button_down = ((action == SLAGizmoEventType::LeftDown) ? Button::Left : Button::Right);
@ -1051,7 +1063,7 @@ void GLGizmoPainterBase::on_set_state()
if (m_state == On && m_old_state != On) { // the gizmo was just turned on
on_opening();
// const Selection& selection = m_parent.get_selection();
const Selection& selection = m_parent.get_selection();
//Camera& camera = wxGetApp().plater()->get_camera();
//Vec3d rotate_target = selection.get_bounding_box().center();
//rotate_target(2) = 0.f;

View file

@ -186,7 +186,7 @@ bool GLGizmosManager::init()
// Order of gizmos in the vector must match order in EType!
//BBS: GUI refactor: add obj manipulation
m_gizmos.clear();
// unsigned int sprite_id = 0;
unsigned int sprite_id = 0;
m_gizmos.emplace_back(new GLGizmoMove3D(m_parent, m_is_dark ? "toolbar_move_dark.svg" : "toolbar_move.svg", EType::Move, &m_object_manipulation));
m_gizmos.emplace_back(new GLGizmoRotate3D(m_parent, m_is_dark ? "toolbar_rotate_dark.svg" : "toolbar_rotate.svg", EType::Rotate, &m_object_manipulation));
m_gizmos.emplace_back(new GLGizmoScale3D(m_parent, m_is_dark ? "toolbar_scale_dark.svg" : "toolbar_scale.svg", EType::Scale, &m_object_manipulation));
@ -1042,7 +1042,11 @@ void GLGizmosManager::render_arrow(const GLCanvas3D& parent, EType highlighted_t
for (size_t idx : selectable_idxs)
{
if (idx == highlighted_type) {
int tex_width = m_icons_texture.get_width();
int tex_height = m_icons_texture.get_height();
unsigned int tex_id = m_arrow_texture.get_id();
float inv_tex_width = (tex_width != 0.0f) ? 1.0f / tex_width : 0.0f;
float inv_tex_height = (tex_height != 0.0f) ? 1.0f / tex_height : 0.0f;
const float left_uv = 0.0f;
const float right_uv = 1.0f;

View file

@ -591,6 +591,7 @@ void GizmoObjectManipulation::do_render_move_window(ImGuiWrapper *imgui_wrapper,
float World_size = imgui_wrapper->calc_text_size(position_title).x + space_size;
float caption_max = std::max(position_size, World_size) + 2 * space_size;
float end_text_size = imgui_wrapper->calc_text_size(this->m_new_unit_string).x;
// position
Vec3d original_position;
@ -600,6 +601,8 @@ void GizmoObjectManipulation::do_render_move_window(ImGuiWrapper *imgui_wrapper,
original_position = this->m_new_position;
Vec3d display_position = m_buffered_position;
// Rotation
Vec3d rotation = this->m_buffered_rotation;
float unit_size = imgui_wrapper->calc_text_size(MAX_SIZE).x + space_size;
int index = 1;
int index_unit = 1;
@ -705,6 +708,13 @@ void GizmoObjectManipulation::do_render_rotate_window(ImGuiWrapper *imgui_wrappe
float caption_max = std::max(position_size, World_size) + 2 * space_size;
float end_text_size = imgui_wrapper->calc_text_size(this->m_new_unit_string).x;
// position
Vec3d original_position;
if (this->m_imperial_units)
original_position = this->m_new_position * this->mm_to_in;
else
original_position = this->m_new_position;
Vec3d display_position = m_buffered_position;
// Rotation
Vec3d rotation = this->m_buffered_rotation;
@ -825,7 +835,10 @@ void GizmoObjectManipulation::do_render_scale_input_window(ImGuiWrapper* imgui_w
Vec3d scale = m_buffered_scale;
Vec3d display_size = m_buffered_size;
Vec3d display_position = m_buffered_position;
float unit_size = imgui_wrapper->calc_text_size(MAX_SIZE).x + space_size;
bool imperial_units = this->m_imperial_units;
int index = 2;
int index_unit = 1;

View file

@ -499,7 +499,8 @@ HintData* HintDatabase::get_hint(HintDataNavigation nav)
m_hint_id = get_next_hint_id();
if(nav == HintDataNavigation::Prev)
m_hint_id = get_prev_hint_id();
// if (nav == HintDataNavigation::Curr)
if (nav == HintDataNavigation::Curr)
;
if (nav == HintDataNavigation::Random)
init_random_hint_id();
}

View file

@ -231,7 +231,7 @@ void IMSlider::SetTicksValues(const Info &custom_gcode_per_print_z)
static bool last_spiral_vase_status = false;
// const bool was_empty = m_ticks.empty();
const bool was_empty = m_ticks.empty();
m_ticks.ticks.clear();
const std::vector<CustomGCode::Item> &heights = custom_gcode_per_print_z.gcodes;
@ -240,9 +240,9 @@ void IMSlider::SetTicksValues(const Info &custom_gcode_per_print_z)
if (tick >= 0) m_ticks.ticks.emplace(TickCode{tick, h.type, h.extruder, h.color, h.extra});
}
// if (!was_empty && m_ticks.empty())
if (!was_empty && m_ticks.empty())
// Switch to the "Feature type"/"Tool" from the very beginning of a new object slicing after deleting of the old one
// post_ticks_changed_event();
;// post_ticks_changed_event();
if (m_ticks.has_tick_with_code(ToolChange) && !m_can_change_color) {
if (!wxGetApp().plater()->only_gcode_mode() && !wxGetApp().plater()->using_exported_file())
@ -1034,6 +1034,8 @@ bool IMSlider::vertical_slider(const char* str_id, int* higher_value, int* lower
context.IO.MouseClicked[0])
m_show_menu = false;
ImVec2 bar_center = higher_handle.GetCenter();
// draw ticks
draw_ticks(one_slideable_region);
// draw colored band

View file

@ -182,6 +182,8 @@ int ImGuiWrapper::TOOLBAR_WINDOW_FLAGS = ImGuiWindowFlags_AlwaysAutoResize
bool get_data_from_svg(const std::string &filename, unsigned int max_size_px, ThumbnailData &thumbnail_data)
{
bool compression_enabled = false;
NSVGimage *image = nsvgParseFromFile(filename.c_str(), "px", 96.0f);
if (image == nullptr) { return false; }
@ -234,6 +236,7 @@ bool get_data_from_svg(const std::string &filename, unsigned int max_size_px, Th
bool slider_behavior(ImGuiID id, const ImRect& region, const ImS32 v_min, const ImS32 v_max, ImS32* out_value, ImRect* out_handle, ImGuiSliderFlags flags/* = 0*/, const int fixed_value/* = -1*/, const ImVec4& fixed_rect/* = ImRect()*/)
{
ImGuiContext& context = *GImGui;
ImGuiIO& io = ImGui::GetIO();
const ImGuiAxis axis = (flags & ImGuiSliderFlags_Vertical) ? ImGuiAxis_Y : ImGuiAxis_X;
@ -1790,7 +1793,7 @@ void ImGuiWrapper::search_list(const ImVec2& size_, bool (*items_getter)(int, co
ImGui::ListBoxFooter();
/*auto check_box = [&edited, this](const wxString& label, bool& check) {
auto check_box = [&edited, this](const wxString& label, bool& check) {
ImGui::SameLine();
bool ch = check;
checkbox(label, ch);
@ -1798,7 +1801,7 @@ void ImGuiWrapper::search_list(const ImVec2& size_, bool (*items_getter)(int, co
check = !check;
edited = true;
}
};*/
};
ImGui::AlignTextToFramePadding();
@ -3146,6 +3149,7 @@ bool IMTexture::load_from_svg_file(const std::string& filename, unsigned width,
std::vector<unsigned char> data(n_pixels * 4, 0);
nsvgRasterize(rast, image, 0, 0, scale, data.data(), width, height, width * 4);
bool compress = false;
GLint last_texture;
unsigned m_image_texture{ 0 };
unsigned char* pixels = (unsigned char*)(&data[0]);

View file

@ -136,6 +136,7 @@ void ArrangeJob::prepare_selected() {
inst_sel[size_t(inst_id)] = true;
for (size_t i = 0; i < inst_sel.size(); ++i) {
ModelInstance* mi = mo->instances[i];
ArrangePolygon&& ap = prepare_arrange_polygon(mo->instances[i]);
//BBS: partplate_list preprocess
//remove the locked plate's instances, neither in selected, nor in un-selected
@ -207,6 +208,7 @@ void ArrangeJob::prepare_all() {
ModelObject *mo = model.objects[oidx];
for (size_t i = 0; i < mo->instances.size(); ++i) {
ModelInstance * mi = mo->instances[i];
ArrangePolygon&& ap = prepare_arrange_polygon(mo->instances[i]);
//BBS: partplate_list preprocess
//remove the locked plate's instances, neither in selected, nor in un-selected
@ -322,6 +324,7 @@ void ArrangeJob::prepare_wipe_tower()
wipe_tower_ap.name = "WipeTower";
wipe_tower_ap.is_virt_object = true;
wipe_tower_ap.is_wipe_tower = true;
const GLCanvas3D* canvas3D = static_cast<const GLCanvas3D*>(m_plater->canvas3D());
std::set<int> extruder_ids;
PartPlateList& ppl = wxGetApp().plater()->get_partplate_list();
@ -527,6 +530,7 @@ void ArrangeJob::process(Ctl &ctl)
auto & partplate_list = m_plater->get_partplate_list();
const Slic3r::DynamicPrintConfig& global_config = wxGetApp().preset_bundle->full_config();
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
const bool is_bbl = wxGetApp().preset_bundle->is_bbl_vendor();
if (is_bbl && params.avoid_extrusion_cali_region && global_config.opt_bool("scan_first_layer"))
partplate_list.preprocess_nonprefered_areas(m_unselected, MAX_NUM_PLATES);

View file

@ -127,8 +127,8 @@ void FillBedJob::prepare()
m_bedpts = get_bed_shape(*m_plater->config());
/*auto &objects = m_plater->model().objects;
BoundingBox bedbb = get_extents(m_bedpts);
auto &objects = m_plater->model().objects;
/*BoundingBox bedbb = get_extents(m_bedpts);
for (size_t idx = 0; idx < objects.size(); ++idx)
if (int(idx) != m_object_idx)
@ -209,7 +209,9 @@ void FillBedJob::process(Ctl &ctl)
m_bedpts = get_shrink_bedpts(m_plater->config(), params);
auto &partplate_list = m_plater->get_partplate_list();
auto &print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
const Slic3r::DynamicPrintConfig& global_config = wxGetApp().preset_bundle->full_config();
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
const bool is_bbl = wxGetApp().preset_bundle->is_bbl_vendor();
if (is_bbl && params.avoid_extrusion_cali_region && global_config.opt_bool("scan_first_layer"))
partplate_list.preprocess_nonprefered_areas(m_unselected, MAX_NUM_PLATES);
@ -273,6 +275,8 @@ void FillBedJob::finalize(bool canceled, std::exception_ptr &eptr)
int plate_cols = plate_list.get_plate_cols();
int cur_plate = plate_list.get_curr_plate_index();
size_t inst_cnt = model_object->instances.size();
int added_cnt = std::accumulate(m_selected.begin(), m_selected.end(), 0, [](int s, auto &ap) {
return s + int(ap.priority == 0 && ap.bed_idx == 0);
});

View file

@ -46,6 +46,7 @@ void OrientJob::prepare_selection(std::vector<bool> obj_sel, bool only_one_plate
ModelInstance* mi = mo->instances[inst_idx];
OrientMesh&& om = get_orient_mesh(mi);
bool locked = false;
if (!only_one_plate) {
int plate_index = plate_list.find_instance(oidx, inst_idx);
if ((plate_index >= 0)&&(plate_index < plate_list.get_plate_count())) {

View file

@ -103,6 +103,9 @@ wxString PrintJob::get_http_error_msg(unsigned int status, std::string body)
if (!j["message"].is_null())
message = j["message"].get<std::string>();
}
switch (status) {
;
}
}
catch (...) {
;
@ -134,6 +137,7 @@ void PrintJob::process(Ctl &ctl)
wxString error_str;
int curr_percent = 10;
NetworkAgent* m_agent = wxGetApp().getAgent();
AppConfig* config = wxGetApp().app_config;
if (this->connection_type == "lan") {
msg = _u8L("Sending print job over LAN");
@ -148,7 +152,9 @@ void PrintJob::process(Ctl &ctl)
int result = -1;
std::string http_body;
int total_plate_num = plate_data.plate_count;
if (!plate_data.is_valid) {
total_plate_num = m_plater->get_partplate_list().get_plate_count();
PartPlate *plate = m_plater->get_partplate_list().get_plate(job_data.plate_idx);
if (plate == nullptr) {
plate = m_plater->get_partplate_list().get_curr_plate();
@ -305,7 +311,7 @@ void PrintJob::process(Ctl &ctl)
try {
stl_design_id = std::stoi(wxGetApp().model().stl_design_id);
}
catch (std::exception&) {
catch (const std::exception&) {
stl_design_id = 0;
}
params.stl_design_id = stl_design_id;
@ -440,7 +446,7 @@ void PrintJob::process(Ctl &ctl)
std::string curr_job_id;
json job_info_j;
try {
job_info_j = json::parse(job_info);
job_info_j.parse(job_info);
if (job_info_j.contains("job_id")) {
curr_job_id = job_info_j["job_id"].get<std::string>();
}

View file

@ -57,7 +57,8 @@ void RotoptimizeJob::process(Ctl &ctl)
.print_config(&m_default_print_cfg)
.statucb([this, &prev_status, &ctl/*, &statustxt*/](int s)
{
// if (s > 0 && s < 100)
if (s > 0 && s < 100)
;
// ctl.update_status(prev_status + s / m_selected_object_ids.size(),
// statustxt);

View file

@ -67,6 +67,9 @@ wxString SendJob::get_http_error_msg(unsigned int status, std::string body)
if (!j["message"].is_null())
message = j["message"].get<std::string>();
}
switch (status) {
;
}
}
catch (...) {
;
@ -106,6 +109,7 @@ void SendJob::process(Ctl &ctl)
std::string msg;
int curr_percent = 10;
NetworkAgent* m_agent = wxGetApp().getAgent();
AppConfig* config = wxGetApp().app_config;
int result = -1;
std::string http_body;

View file

@ -183,7 +183,11 @@ void KBShortcutsDialog::fill_shortcuts()
// Slice plate
{ ctrl + "R", L("Slice plate")},
// Send to Print
{ ctrl + L("Shift+G"), L("Print plate")},
#ifdef __APPLE__
{ L("⌘+Shift+G"), L("Print plate")},
#else
{ L("Ctrl+Shift+G"), L("Print plate")},
#endif // __APPLE
// Edit
{ ctrl + "X", L("Cut") },
@ -222,9 +226,16 @@ void KBShortcutsDialog::fill_shortcuts()
{L("Shift+R"), L("Auto orientates selected objects or all objects.If there are selected objects, it just orientates the selected ones.Otherwise, it will orientates all objects in the current disk.")},
{L("Shift+Tab"), L("Collapse/Expand the sidebar")},
{ ctrl + L("Any arrow"), L("Movement in camera space")},
{ alt + L("Left mouse button"), L("Select a part")},
{ ctrl + L("Left mouse button"), L("Select multiple objects")},
#ifdef __APPLE__
{L("⌘+Any arrow"), L("Movement in camera space")},
{L("⌥+Left mouse button"), L("Select a part")},
{L("⌘+Left mouse button"), L("Select multiple objects")},
#else
{L("Ctrl+Any arrow"), L("Movement in camera space")},
{L("Alt+Left mouse button"), L("Select a part")},
{L("Ctrl+Left mouse button"), L("Select multiple objects")},
#endif
{L("Shift+Left mouse button"), L("Select objects by rectangle")},
{L("Arrow Up"), L("Move selection 10 mm in positive Y direction")},
{L("Arrow Down"), L("Move selection 10 mm in negative Y direction")},
@ -263,8 +274,13 @@ void KBShortcutsDialog::fill_shortcuts()
Shortcuts gizmos_shortcuts = {
{L("Esc"), L("Deselect all")},
{L("Shift+"), L("Move: press to snap by 1mm")},
{ ctrl + L("Mouse wheel"), L("Support/Color Painting: adjust pen radius")},
{ alt + L("Mouse wheel"), L("Support/Color Painting: adjust section position")},
#ifdef __APPLE__
{L("⌘+Mouse wheel"), L("Support/Color Painting: adjust pen radius")},
{L("⌥+Mouse wheel"), L("Support/Color Painting: adjust section position")},
#else
{L("Ctrl+Mouse wheel"), L("Support/Color Painting: adjust pen radius")},
{L("Alt+Mouse wheel"), L("Support/Color Painting: adjust section position")},
#endif
};
m_full_shortcuts.push_back({{_L("Gizmo"), ""}, gizmos_shortcuts});
@ -295,8 +311,13 @@ void KBShortcutsDialog::fill_shortcuts()
{ "Tab", L("Switch between Prepare/Preview") },
{L("Shift+Any arrow"), L("Move slider 5x faster")},
{L("Shift+Mouse wheel"), L("Move slider 5x faster")},
{ ctrl + L("Any arrow"), L("Move slider 5x faster")},
{ ctrl + L("Mouse wheel"), L("Move slider 5x faster")},
#ifdef __APPLE__
{L("⌘+Any arrow"), L("Move slider 5x faster")},
{L("⌘+Mouse wheel"), L("Move slider 5x faster")},
#else
{L("Ctrl+Any arrow"), L("Move slider 5x faster")},
{L("Ctrl+Mouse wheel"), L("Move slider 5x faster")},
#endif
{ L("Home"), L("Horizontal slider - Move to start position")},
{ L("End"), L("Horizontal slider - Move to last position")},
};

View file

@ -743,6 +743,7 @@ void MainFrame::update_layout()
if (m_layout != ESettingsLayout::Unknown)
restore_to_creation();
ESettingsLayout old_layout = m_layout;
m_layout = layout;
// From the very beginning the Print settings should be selected
@ -1487,6 +1488,7 @@ bool MainFrame::can_reslice() const
wxBoxSizer* MainFrame::create_side_tools()
{
enable_multi_machine = wxGetApp().is_enable_multi_machine();
int em = em_unit();
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
m_slice_select = eSlicePlate;
@ -1777,7 +1779,7 @@ wxBoxSizer* MainFrame::create_side_tools()
aux_btn->Bind(wxEVT_BUTTON, [](auto e) {
wxGetApp().sidebar().show_auxiliary_dialog();
});
sizer->Add(aux_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 1 * em_unit() / 10);
sizer->Add(aux_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 1 * em / 10);
*/
sizer->Add(FromDIP(19), 0, 0, 0, 0);
@ -1922,6 +1924,9 @@ bool MainFrame::get_enable_print_status()
void MainFrame::update_side_button_style()
{
// BBS
int em = em_unit();
/*m_slice_btn->SetLayoutStyle(1);
m_slice_btn->SetTextLayout(SideButton::EHorizontalOrientation::HO_Center, FromDIP(15));
m_slice_btn->SetMinSize(wxSize(-1, FromDIP(24)));
@ -2183,6 +2188,9 @@ static void add_common_publish_menu_items(wxMenu* publish_menu, MainFrame* mainF
return;
}
json j;
NetworkAgent* agent = GUI::wxGetApp().getAgent();
//if (GUI::wxGetApp().plater()->model().objects.empty()) return;
wxGetApp().open_publish_page_dialog();
});
@ -2580,13 +2588,13 @@ void MainFrame::init_menubar_as_editor()
//BBS perspective view
wxWindowID camera_id_base = wxWindow::NewControlId(int(wxID_CAMERA_COUNT));
append_menu_radio_item(viewMenu, wxID_CAMERA_PERSPECTIVE + camera_id_base, _L("Use Perspective View"), _L("Use Perspective View"),
auto perspective_item = append_menu_radio_item(viewMenu, wxID_CAMERA_PERSPECTIVE + camera_id_base, _L("Use Perspective View"), _L("Use Perspective View"),
[this](wxCommandEvent&) {
wxGetApp().app_config->set_bool("use_perspective_camera", true);
wxGetApp().update_ui_from_settings();
}, nullptr);
//BBS orthogonal view
append_menu_radio_item(viewMenu, wxID_CAMERA_ORTHOGONAL + camera_id_base, _L("Use Orthogonal View"), _L("Use Orthogonal View"),
auto orthogonal_item = append_menu_radio_item(viewMenu, wxID_CAMERA_ORTHOGONAL + camera_id_base, _L("Use Orthogonal View"), _L("Use Orthogonal View"),
[this](wxCommandEvent&) {
wxGetApp().app_config->set_bool("use_perspective_camera", false);
wxGetApp().update_ui_from_settings();
@ -2661,8 +2669,7 @@ void MainFrame::init_menubar_as_editor()
//auto preference_item = new wxMenuItem(parent_menu, OrcaSlicerMenuPreferences + bambu_studio_id_base, _L("Preferences") + "\tCtrl+,", "");
#else
wxMenu* parent_menu = m_topbar->GetTopMenu();
// auto preference_item =
new wxMenuItem(parent_menu, ConfigMenuPreferences + config_id_base, _L("Preferences") + "\t" + ctrl + "P", "");
auto preference_item = new wxMenuItem(parent_menu, ConfigMenuPreferences + config_id_base, _L("Preferences") + "\t" + ctrl + "P", "");
#endif
//auto printer_item = new wxMenuItem(parent_menu, ConfigMenuPrinter + config_id_base, _L("Printer"), "");
@ -2815,10 +2822,17 @@ void MainFrame::init_menubar_as_editor()
auto flowrate_menu = new wxMenu();
append_menu_item(
flowrate_menu, wxID_ANY, _L("Pass 1"), _L("Flow rate test - Pass 1"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(1); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 2"), _L("Flow rate test - Pass 2"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(2); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
flowrate_menu->AppendSeparator();
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO (Recommended)"), _L("Orca YOLO flowrate calibration, 0.01 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO (perfectionist version)"), _L("Orca YOLO flowrate calibration, 0.005 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
m_topbar->GetCalibMenu()->AppendSubMenu(flowrate_menu, _L("Flow rate"));
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),
@ -2902,13 +2916,20 @@ void MainFrame::init_menubar_as_editor()
// Flowrate
auto flowrate_menu = new wxMenu();
append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 1"), _L("Flow rate test - Pass 1"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(1); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 2"), _L("Flow rate test - Pass 2"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(2); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_submenu(calib_menu,flowrate_menu,wxID_ANY,_L("Flow rate"),_L("Flow rate"),"",
[this]() {return m_plater->is_view3D_shown();; });
flowrate_menu->AppendSeparator();
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO (Recommended)"), _L("Orca YOLO flowrate calibration, 0.01 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO (perfectionist version)"), _L("Orca YOLO flowrate calibration, 0.005 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
// PA
append_menu_item(calib_menu, wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),
@ -3093,6 +3114,10 @@ void MainFrame::init_menubar_as_gcodeviewer()
void MainFrame::update_menubar()
{
if (wxGetApp().is_gcode_viewer())
return;
const bool is_fff = plater()->printer_technology() == ptFFF;
}
void MainFrame::reslice_now()
@ -3168,6 +3193,7 @@ void MainFrame::load_config_file()
cfiles.push_back(into_u8(file));
m_last_config = file;
}
bool update = false;
wxGetApp().preset_bundle->import_presets(cfiles, [this](std::string const & name) {
ConfigsOverwriteConfirmDialog dlg(this, from_u8(name), false);
int res = dlg.ShowModal();
@ -3737,6 +3763,7 @@ void MainFrame::on_select_default_preset(SimpleEvent& evt)
wxICON_INFORMATION);
/* get setting list */
NetworkAgent* agent = wxGetApp().getAgent();
switch ( dialog.ShowModal() )
{
case wxID_YES: {

View file

@ -328,6 +328,7 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
MessageDialog(this, m, _L("Download failed"), wxOK | wxICON_ERROR).ShowModal();
});
NetworkAgent* agent = wxGetApp().getAgent();
if (result > 1 || result == 0) {
json j;
j["code"] = result;
@ -575,7 +576,7 @@ void MediaFilePanel::doAction(size_t index, int action)
}
else {
MessageDialog dlg(this, _L("The .gcode.3mf file contains no G-code data.Please slice it with Orca Slicer and export a new .gcode.3mf file."), wxEmptyString, wxICON_WARNING | wxOK);
dlg.ShowModal();
auto res = dlg.ShowModal();
}
});

View file

@ -67,7 +67,7 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w
auto ip = str.find(' ', ik);
if (ip == wxString::npos) ip = str.Length();
auto v = str.Mid(ik, ip - ik);
if (strcmp(k, "T:") == 0 && v.Length() == 8) {
if (k == "T:" && v.Length() == 8) {
long h = 0,m = 0,s = 0;
v.Left(2).ToLong(&h);
v.Mid(3, 2).ToLong(&m);
@ -389,7 +389,7 @@ void MediaPlayCtrl::Stop(wxString const &msg)
}
auto tunnel = m_url.empty() ? "" : into_u8(wxURI(m_url).GetPath()).substr(1);
if (auto n = tunnel.find_first_of("/_"); n != std::string::npos)
if (auto n = tunnel.find_first_of('/_'); n != std::string::npos)
tunnel = tunnel.substr(0, n);
if (last_state != wxMEDIASTATE_PLAYING && m_failed_code != 0
&& m_last_failed_codes.find(m_failed_code) == m_last_failed_codes.end()
@ -734,7 +734,7 @@ bool MediaPlayCtrl::start_stream_service(bool *need_install)
auto file_dll = tools_dir + dll;
auto file_dll2 = plugins_dir + dll;
if (!boost::filesystem::exists(file_dll) || boost::filesystem::last_write_time(file_dll) != boost::filesystem::last_write_time(file_dll2))
boost::filesystem::copy_file(file_dll2, file_dll, boost::filesystem::copy_options::overwrite_existing);
boost::filesystem::copy_file(file_dll2, file_dll, boost::filesystem::copy_option::overwrite_if_exists);
}
boost::process::child process_source(file_source, file_url2.ToStdWstring(), boost::process::start_dir(tools_dir),
boost::process::windows::create_no_window,

View file

@ -114,7 +114,7 @@ AddMachinePanel::~AddMachinePanel() {
m_side_tools->get_panel()->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(MonitorPanel::on_printer_clicked), NULL, this);
Bind(wxEVT_TIMER, [this](wxTimerEvent&) { on_timer(); });
Bind(wxEVT_TIMER, &MonitorPanel::on_timer, this);
Bind(wxEVT_SIZE, &MonitorPanel::on_size, this);
Bind(wxEVT_COMMAND_CHOICE_SELECTED, &MonitorPanel::on_select_printer, this);
@ -160,7 +160,7 @@ MonitorPanel::~MonitorPanel()
m_refresh_timer = new wxTimer();
m_refresh_timer->SetOwner(this);
m_refresh_timer->Start(REFRESH_INTERVAL);
on_timer();
wxPostEvent(this, wxTimerEvent());
Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) return;
@ -272,7 +272,7 @@ void MonitorPanel::on_update_all(wxMouseEvent &event)
}
}
void MonitorPanel::on_timer()
void MonitorPanel::on_timer(wxTimerEvent& event)
{
if (update_flag) {
update_all();
@ -306,6 +306,9 @@ void MonitorPanel::on_timer()
void MonitorPanel::on_printer_clicked(wxMouseEvent &event)
{
auto mouse_pos = ClientToScreen(event.GetPosition());
wxPoint rect = m_side_tools->ClientToScreen(wxPoint(0, 0));
if (!m_side_tools->is_in_interval()) {
wxPoint pos = m_side_tools->ClientToScreen(wxPoint(0, 0));
pos.y += m_side_tools->GetRect().height;
@ -431,6 +434,7 @@ bool MonitorPanel::Show(bool show)
wxGetApp().mainframe->SetMinSize(wxGetApp().plater()->GetMinSize());
#endif
NetworkAgent* m_agent = wxGetApp().getAgent();
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (show) {
start_update();
@ -438,7 +442,7 @@ bool MonitorPanel::Show(bool show)
m_refresh_timer->Stop();
m_refresh_timer->SetOwner(this);
m_refresh_timer->Start(REFRESH_INTERVAL);
on_timer();
wxPostEvent(this, wxTimerEvent());
if (dev) {
//set a default machine when obj is null
@ -481,6 +485,7 @@ void MonitorPanel::show_status(int status)
if (!m_initialized) return;
if (last_status == status)return;
if ((last_status & (int)MonitorStatus::MONITOR_CONNECTING) != 0) {
NetworkAgent* agent = wxGetApp().getAgent();
json j;
j["dev_id"] = obj ? obj->dev_id : "obj_nullptr";
if ((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0) {

View file

@ -133,7 +133,7 @@ public:
StatusPanel* get_status_panel() {return m_status_info_panel;};
void select_machine(std::string machine_sn);
void on_update_all(wxMouseEvent &event);
void on_timer();
void on_timer(wxTimerEvent& event);
void on_select_printer(wxCommandEvent& event);
void on_printer_clicked(wxMouseEvent &event);
void on_size(wxSizeEvent &event);

View file

@ -6,6 +6,7 @@
///////////////////////////////////////////////////////////////////////////
#include "MonitorBasePanel.h"
#include "Printer/PrinterFileSystem.h"
#include "Widgets/Label.hpp"
///////////////////////////////////////////////////////////////////////////
@ -20,7 +21,7 @@ MonitorBasePanel::MonitorBasePanel(wxWindow* parent, wxWindowID id, const wxPoin
m_splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D | wxSP_BORDER);
m_splitter->SetSashGravity(0);
m_splitter->SetSashInvisible();
m_splitter->SetSashSize(0);
m_splitter->Connect(wxEVT_IDLE, wxIdleEventHandler(MonitorBasePanel::m_splitterOnIdle), NULL, this);
m_splitter->SetMinimumPaneSize(182);
@ -280,7 +281,7 @@ VideoMonitoringBasePanel::~VideoMonitoringBasePanel()
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
//#include "MonitorBasePanel.h"
#include "MonitorBasePanel.h"
///////////////////////////////////////////////////////////////////////////
using namespace Slic3r::GUI;

View file

@ -9,16 +9,16 @@ namespace Slic3r {
namespace GUI {
#define DEVICE_ITEM_MAX_WIDTH 900
#define SEND_ITEM_MAX_HEIGHT 30
#define DEVICE_ITEM_MAX_HEIGHT 50
#define DEVICE_ITEM_MAX_WIDTH 900
#define SEND_ITEM_MAX_HEIGHT 30
#define DEVICE_ITEM_MAX_HEIGHT 50
#define TABLE_HEAR_NORMAL_COLOUR wxColour(238, 238, 238)
#define TABLE_HEAD_PRESSED_COLOUR wxColour(150, 150, 150)
#define CTRL_BUTTON_NORMAL_COLOUR wxColour(255, 255, 255)
#define CTRL_BUTTON_PRESSEN_COLOUR wxColour(150, 150, 150)
#define TABLE_HEAD_FONT Label::Body_13
#define MM_ICON_SIZE FromDIP(16)
#define ICON_SIZE FromDIP(16)
class DeviceItem : public wxWindow
{

View file

@ -320,7 +320,7 @@ MultiMachineManagerPage::MultiMachineManagerPage(wxWindow* parent)
m_table_head_panel->SetBackgroundColour(TABLE_HEAR_NORMAL_COLOUR);
m_table_head_sizer = new wxBoxSizer(wxHORIZONTAL);
m_printer_name = new Button(m_table_head_panel, _L("Device Name"), "toolbar_double_directional_arrow", wxNO_BORDER, MM_ICON_SIZE);
m_printer_name = new Button(m_table_head_panel, _L("Device Name"), "toolbar_double_directional_arrow", wxNO_BORDER, ICON_SIZE);
m_printer_name->SetBackgroundColor(head_bg);
m_printer_name->SetFont(TABLE_HEAD_FONT);
m_printer_name->SetCornerRadius(0);
@ -343,7 +343,7 @@ MultiMachineManagerPage::MultiMachineManagerPage(wxWindow* parent)
});
m_task_name = new Button(m_table_head_panel, _L("Task Name"), "", wxNO_BORDER, MM_ICON_SIZE);
m_task_name = new Button(m_table_head_panel, _L("Task Name"), "", wxNO_BORDER, ICON_SIZE);
m_task_name->SetBackgroundColor(TABLE_HEAR_NORMAL_COLOUR);
m_task_name->SetFont(TABLE_HEAD_FONT);
m_task_name->SetCornerRadius(0);
@ -353,7 +353,7 @@ MultiMachineManagerPage::MultiMachineManagerPage(wxWindow* parent)
m_status = new Button(m_table_head_panel, _L("Device Status"), "toolbar_double_directional_arrow", wxNO_BORDER, MM_ICON_SIZE);
m_status = new Button(m_table_head_panel, _L("Device Status"), "toolbar_double_directional_arrow", wxNO_BORDER, ICON_SIZE);
m_status->SetBackgroundColor(head_bg);
m_status->SetFont(TABLE_HEAD_FONT);
m_status->SetCornerRadius(0);
@ -376,7 +376,7 @@ MultiMachineManagerPage::MultiMachineManagerPage(wxWindow* parent)
});
m_action = new Button(m_table_head_panel, _L("Actions"), "", wxNO_BORDER, MM_ICON_SIZE, false);
m_action = new Button(m_table_head_panel, _L("Actions"), "", wxNO_BORDER, ICON_SIZE, false);
m_action->SetBackgroundColor(TABLE_HEAR_NORMAL_COLOUR);
m_action->SetFont(TABLE_HEAD_FONT);
m_action->SetCornerRadius(0);
@ -523,7 +523,7 @@ MultiMachineManagerPage::MultiMachineManagerPage(wxWindow* parent)
Layout();
Fit();
Bind(wxEVT_TIMER, [this](wxTimerEvent&) { on_timer(); });
Bind(wxEVT_TIMER, &MultiMachineManagerPage::on_timer, this);
}
void MultiMachineManagerPage::update_page()
@ -676,7 +676,7 @@ void MultiMachineManagerPage::start_timer()
m_flipping_timer->SetOwner(this);
m_flipping_timer->Start(1000);
on_timer();
wxPostEvent(this, wxTimerEvent());
}
void MultiMachineManagerPage::update_page_number()
@ -688,7 +688,7 @@ void MultiMachineManagerPage::update_page_number()
st_page_number->SetLabel(number);
}
void MultiMachineManagerPage::on_timer()
void MultiMachineManagerPage::on_timer(wxTimerEvent& event)
{
m_flipping_timer->Stop();
if (btn_last_page)

View file

@ -55,7 +55,7 @@ public:
void start_timer();
void update_page_number();
void on_timer();
void on_timer(wxTimerEvent& event);
void clear_page();
void page_num_enter_evt();

View file

@ -19,7 +19,7 @@ MultiMachinePage::MultiMachinePage(wxWindow* parent, wxWindowID id, const wxPoin
wxGetApp().UpdateDarkUIWin(this);
init_timer();
Bind(wxEVT_TIMER, [this](wxTimerEvent&) { on_timer(); });
Bind(wxEVT_TIMER, &MultiMachinePage::on_timer, this);
}
MultiMachinePage::~MultiMachinePage()
@ -59,7 +59,7 @@ bool MultiMachinePage::Show(bool show)
m_refresh_timer->Stop();
m_refresh_timer->SetOwner(this);
m_refresh_timer->Start(2000);
on_timer();
wxPostEvent(this, wxTimerEvent());
}
else {
m_refresh_timer->Stop();
@ -97,7 +97,7 @@ void MultiMachinePage::init_timer()
//wxPostEvent(this, wxTimerEvent());
}
void MultiMachinePage::on_timer()
void MultiMachinePage::on_timer(wxTimerEvent& event)
{
m_local_task_manager->update_page();
m_cloud_task_manager->update_page();

View file

@ -41,7 +41,7 @@ public:
void init_tabpanel();
void init_timer();
void on_timer();
void on_timer(wxTimerEvent& event);
void clear_page();
};

View file

@ -4,6 +4,7 @@
#include "GUI_App.hpp"
#include "MainFrame.hpp"
#include "Widgets/RadioBox.hpp"
#include <wx/listimpl.cpp>
#include <boost/date_time/posix_time/posix_time.hpp>
namespace Slic3r {
@ -573,7 +574,7 @@ LocalTaskManagerPage::LocalTaskManagerPage(wxWindow* parent)
});
m_task_name = new Button(m_table_head_panel, _L("Task Name"), "", wxNO_BORDER, MM_ICON_SIZE);
m_task_name = new Button(m_table_head_panel, _L("Task Name"), "", wxNO_BORDER, ICON_SIZE);
m_task_name->SetBackgroundColor(TABLE_HEAR_NORMAL_COLOUR);
m_task_name->SetFont(TABLE_HEAD_FONT);
m_task_name->SetCornerRadius(0);
@ -582,7 +583,7 @@ LocalTaskManagerPage::LocalTaskManagerPage(wxWindow* parent)
m_task_name->SetCenter(false);
m_table_head_sizer->Add(m_task_name, 0, wxALIGN_CENTER_VERTICAL, 0);
m_printer_name = new Button(m_table_head_panel, _L("Device Name"), "toolbar_double_directional_arrow", wxNO_BORDER, MM_ICON_SIZE);
m_printer_name = new Button(m_table_head_panel, _L("Device Name"), "toolbar_double_directional_arrow", wxNO_BORDER, ICON_SIZE);
m_printer_name->SetBackgroundColor(head_bg);
m_printer_name->SetFont(TABLE_HEAD_FONT);
m_printer_name->SetCornerRadius(0);
@ -602,7 +603,7 @@ LocalTaskManagerPage::LocalTaskManagerPage(wxWindow* parent)
});
m_table_head_sizer->Add(m_printer_name, 0, wxALIGN_CENTER_VERTICAL, 0);
m_status = new Button(m_table_head_panel, _L("Task Status"), "toolbar_double_directional_arrow", wxNO_BORDER, MM_ICON_SIZE);
m_status = new Button(m_table_head_panel, _L("Task Status"), "toolbar_double_directional_arrow", wxNO_BORDER, ICON_SIZE);
m_status->SetBackgroundColor(head_bg);
m_status->SetFont(TABLE_HEAD_FONT);
m_status->SetCornerRadius(0);
@ -622,7 +623,7 @@ LocalTaskManagerPage::LocalTaskManagerPage(wxWindow* parent)
});
m_table_head_sizer->Add(m_status, 0, wxALIGN_CENTER_VERTICAL, 0);
m_info = new Button(m_table_head_panel, _L("Info"), "", wxNO_BORDER, MM_ICON_SIZE);
m_info = new Button(m_table_head_panel, _L("Info"), "", wxNO_BORDER, ICON_SIZE);
m_info->SetBackgroundColor(TABLE_HEAR_NORMAL_COLOUR);
m_info->SetFont(TABLE_HEAD_FONT);
m_info->SetCornerRadius(0);
@ -631,7 +632,7 @@ LocalTaskManagerPage::LocalTaskManagerPage(wxWindow* parent)
m_info->SetCenter(false);
m_table_head_sizer->Add(m_info, 0, wxALIGN_CENTER_VERTICAL, 0);
m_send_time = new Button(m_table_head_panel, _L("Sent Time"), "toolbar_double_directional_arrow", wxNO_BORDER, MM_ICON_SIZE, false);
m_send_time = new Button(m_table_head_panel, _L("Sent Time"), "toolbar_double_directional_arrow", wxNO_BORDER, ICON_SIZE, false);
m_send_time->SetBackgroundColor(head_bg);
m_send_time->SetFont(TABLE_HEAD_FONT);
m_send_time->SetCornerRadius(0);
@ -651,7 +652,7 @@ LocalTaskManagerPage::LocalTaskManagerPage(wxWindow* parent)
});
m_table_head_sizer->Add(m_send_time, 0, wxALIGN_CENTER_VERTICAL, 0);
m_action = new Button(m_table_head_panel, _L("Actions"), "", wxNO_BORDER, MM_ICON_SIZE, false);
m_action = new Button(m_table_head_panel, _L("Actions"), "", wxNO_BORDER, ICON_SIZE, false);
m_action->SetBackgroundColor(TABLE_HEAR_NORMAL_COLOUR);
m_action->SetFont(TABLE_HEAD_FONT);
m_action->SetCornerRadius(0);
@ -945,7 +946,7 @@ CloudTaskManagerPage::CloudTaskManagerPage(wxWindow* parent)
m_task_name = new Button(m_table_head_panel, _L("Task Name"), "", wxNO_BORDER, MM_ICON_SIZE);
m_task_name = new Button(m_table_head_panel, _L("Task Name"), "", wxNO_BORDER, ICON_SIZE);
m_task_name->SetBackgroundColor(TABLE_HEAR_NORMAL_COLOUR);
m_task_name->SetFont(TABLE_HEAD_FONT);
m_task_name->SetCornerRadius(0);
@ -954,7 +955,7 @@ CloudTaskManagerPage::CloudTaskManagerPage(wxWindow* parent)
m_task_name->SetCenter(false);
m_table_head_sizer->Add(m_task_name, 0, wxALIGN_CENTER_VERTICAL, 0);
m_printer_name = new Button(m_table_head_panel, _L("Device Name"), "toolbar_double_directional_arrow", wxNO_BORDER, MM_ICON_SIZE);
m_printer_name = new Button(m_table_head_panel, _L("Device Name"), "toolbar_double_directional_arrow", wxNO_BORDER, ICON_SIZE);
m_printer_name->SetBackgroundColor(head_bg);
m_printer_name->SetFont(TABLE_HEAD_FONT);
m_printer_name->SetCornerRadius(0);
@ -974,7 +975,7 @@ CloudTaskManagerPage::CloudTaskManagerPage(wxWindow* parent)
});
m_table_head_sizer->Add(m_printer_name, 0, wxALIGN_CENTER_VERTICAL, 0);
m_status = new Button(m_table_head_panel, _L("Task Status"), "toolbar_double_directional_arrow", wxNO_BORDER, MM_ICON_SIZE);
m_status = new Button(m_table_head_panel, _L("Task Status"), "toolbar_double_directional_arrow", wxNO_BORDER, ICON_SIZE);
m_status->SetBackgroundColor(head_bg);
m_status->SetFont(TABLE_HEAD_FONT);
m_status->SetCornerRadius(0);
@ -994,7 +995,7 @@ CloudTaskManagerPage::CloudTaskManagerPage(wxWindow* parent)
});
m_table_head_sizer->Add(m_status, 0, wxALIGN_CENTER_VERTICAL, 0);
m_info = new Button(m_table_head_panel, _L("Info"), "", wxNO_BORDER, MM_ICON_SIZE);
m_info = new Button(m_table_head_panel, _L("Info"), "", wxNO_BORDER, ICON_SIZE);
m_info->SetBackgroundColor(TABLE_HEAR_NORMAL_COLOUR);
m_info->SetFont(TABLE_HEAD_FONT);
m_info->SetCornerRadius(0);
@ -1003,7 +1004,7 @@ CloudTaskManagerPage::CloudTaskManagerPage(wxWindow* parent)
m_info->SetCenter(false);
m_table_head_sizer->Add(m_info, 0, wxALIGN_CENTER_VERTICAL, 0);
m_send_time = new Button(m_table_head_panel, _L("Sent Time"), "toolbar_double_directional_arrow", wxNO_BORDER, MM_ICON_SIZE, false);
m_send_time = new Button(m_table_head_panel, _L("Sent Time"), "toolbar_double_directional_arrow", wxNO_BORDER, ICON_SIZE, false);
m_send_time->SetBackgroundColor(head_bg);
m_send_time->SetFont(TABLE_HEAD_FONT);
m_send_time->SetCornerRadius(0);
@ -1023,7 +1024,7 @@ CloudTaskManagerPage::CloudTaskManagerPage(wxWindow* parent)
});
m_table_head_sizer->Add(m_send_time, 0, wxALIGN_CENTER_VERTICAL, 0);
m_action = new Button(m_table_head_panel, _L("Actions"), "", wxNO_BORDER, MM_ICON_SIZE, false);
m_action = new Button(m_table_head_panel, _L("Actions"), "", wxNO_BORDER, ICON_SIZE, false);
m_action->SetBackgroundColor(TABLE_HEAR_NORMAL_COLOUR);
m_action->SetFont(TABLE_HEAD_FONT);
m_action->SetCornerRadius(0);
@ -1182,7 +1183,7 @@ CloudTaskManagerPage::CloudTaskManagerPage(wxWindow* parent)
page_sizer = new wxBoxSizer(wxVERTICAL);
page_sizer->Add(m_main_panel, 1, wxALL | wxEXPAND, FromDIP(25));
Bind(wxEVT_TIMER, [this](wxTimerEvent&) { on_timer(); });
Bind(wxEVT_TIMER, &CloudTaskManagerPage::on_timer, this);
wxGetApp().UpdateDarkUIWin(this);
@ -1399,10 +1400,10 @@ void CloudTaskManagerPage::start_timer()
m_flipping_timer->SetOwner(this);
m_flipping_timer->Start(1000);
on_timer();
wxPostEvent(this, wxTimerEvent());
}
void CloudTaskManagerPage::on_timer()
void CloudTaskManagerPage::on_timer(wxTimerEvent& event)
{
m_flipping_timer->Stop();
enable_buttons(true);

View file

@ -135,7 +135,7 @@ public:
bool Show(bool show);
void update_page_number();
void start_timer();
void on_timer();
void on_timer(wxTimerEvent& event);
void pause_all(wxCommandEvent& evt);
void resume_all(wxCommandEvent& evt);

View file

@ -194,6 +194,8 @@ public:
// check that only the selected page is visible and others are hidden:
for (size_t page = 0; page < m_pages.size(); page++) {
wxWindow* win_a = GetPage(page);
wxWindow* win_b = GetPage(n);
if (page != n && GetPage(page) != GetPage(n)) {
m_pages[page]->Hide();
}

View file

@ -857,7 +857,7 @@ void NotificationManager::PopNotification::bbl_render_block_notif_buttons(ImGuiW
void NotificationManager::PopNotification::bbl_render_block_notif_left_sign(ImGuiWrapper& imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
{
// auto window = ImGui::GetCurrentWindow();
auto window = ImGui::GetCurrentWindow();
//window->DrawList->AddImage(user_texture_id, bb.Min + padding + margin, bb.Max - padding - margin, uv0, uv1, ImGui::GetColorU32(tint_col));
std::wstring text;

View file

@ -405,6 +405,7 @@ void OG_CustomCtrl::OnMotion(wxMouseEvent& event)
// Set tooltips with information for each icon
// BBS: markdown tip
if (!markdowntip.empty()) {
wxWindow* window = GetGrandParent();
assert(focusedLine);
wxPoint pos2 = { 250, focusedLine->rect_label.y };
pos2 = ClientToScreen(pos2);
@ -491,13 +492,16 @@ bool OG_CustomCtrl::update_visibility(ConfigOptionMode mode)
wxCoord h_pos2 = get_title_width() * m_em_unit;
wxCoord v_pos = 0;
size_t invisible_lines = 0;
bool has_visible_lines = false;
for (CtrlLine& line : ctrl_lines) {
line.update_visibility(mode);
if (line.is_visible)
if (line.is_visible) {
v_pos += (wxCoord)line.height;
else
invisible_lines++;
if (!line.is_separator()) { // Ignore separators
has_visible_lines = true;
}
}
}
// BBS: multi-line title
SetFont(Label::Head_16);
@ -512,7 +516,7 @@ bool OG_CustomCtrl::update_visibility(ConfigOptionMode mode)
this->SetMinSize(wxSize(h_pos, v_pos));
return invisible_lines != ctrl_lines.size();
return has_visible_lines;
}
// BBS: call by Tab/Page

View file

@ -1,6 +1,9 @@
#include <algorithm>
#include <sstream>
//#include "libslic3r/FlushVolCalc.hpp"
#include "ObjColorDialog.hpp"
#include "BitmapCache.hpp"
#include "GUI.hpp"
#include "I18N.hpp"
#include "GUI_App.hpp"
#include "MsgDialog.hpp"
@ -241,6 +244,7 @@ ObjColorPanel::ObjColorPanel(wxWindow * parent,
}
//end first cluster
//draw ui
auto sizer_width = FromDIP(300);
// Create two switched panels with their own sizers
m_sizer_simple = new wxBoxSizer(wxVERTICAL);
m_page_simple = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
@ -670,6 +674,7 @@ void ObjColorPanel::draw_table()
m_scrolledWindow->SetSizer(m_gridsizer);
int totalHeight = row_height *(row+1) * 2;
m_scrolledWindow->SetVirtualSize(MIN_OBJCOLOR_DIALOG_WIDTH, totalHeight);
auto look = FIX_SCROLL_HEIGTH;
if (totalHeight > FIX_SCROLL_HEIGTH) {
m_scrolledWindow->SetMinSize(wxSize(MIN_OBJCOLOR_DIALOG_WIDTH, FIX_SCROLL_HEIGTH));
m_scrolledWindow->SetMaxSize(wxSize(MIN_OBJCOLOR_DIALOG_WIDTH, FIX_SCROLL_HEIGTH));

View file

@ -9,8 +9,12 @@
#include "Widgets/StaticLine.hpp"
#include <utility>
#include <wx/bookctrl.h>
#include <wx/numformatter.h>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include "libslic3r/Exception.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/AppConfig.hpp"
#include "I18N.hpp"
#include <locale>

View file

@ -470,7 +470,7 @@ void PartPlate::calc_gridlines(const ExPolygon& poly, const BoundingBox& pp_bbox
int count = 0;
int step = 10;
// Orca: use 500 x 500 bed size as baseline.
auto grid_counts = pp_bbox.size() / ((coord_t) scale_(step * 50));
const Point grid_counts = pp_bbox.size() / ((coord_t) scale_(step * 50));
// if the grid is too dense, we increase the step
if (grid_counts.minCoeff() > 1) {
step = static_cast<int>(grid_counts.minCoeff() + 1) * 10;
@ -1597,6 +1597,9 @@ std::vector<int> PartPlate::get_extruders_without_support(bool conside_custom_gc
return plate_extruders;
}
// if 3mf file
const DynamicPrintConfig& glb_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
for (int obj_idx = 0; obj_idx < m_model->objects.size(); obj_idx++) {
if (!contain_instance_totally(obj_idx, 0))
continue;
@ -1655,14 +1658,14 @@ Vec3d PartPlate::estimate_wipe_tower_size(const DynamicPrintConfig & config, con
{
Vec3d wipe_tower_size;
// double layer_height = 0.08f; // hard code layer height
double layer_height = 0.08f; // hard code layer height
double max_height = 0.f;
wipe_tower_size.setZero();
wipe_tower_size(0) = w;
// const ConfigOption* layer_height_opt = config.option("layer_height");
// if (layer_height_opt)
// layer_height = layer_height_opt->getFloat();
const ConfigOption* layer_height_opt = config.option("layer_height");
if (layer_height_opt)
layer_height = layer_height_opt->getFloat();
// empty plate
if (plate_extruder_size == 0)
@ -1710,6 +1713,7 @@ Vec3d PartPlate::estimate_wipe_tower_size(const DynamicPrintConfig & config, con
// If wipe tower height is between the current and next member, set the min_depth as linear interpolation between them
auto next_height_to_depth = *iter;
if (next_height_to_depth.first > max_height) {
float height_base = curr_height_to_depth.first;
float height_diff = next_height_to_depth.first - curr_height_to_depth.first;
float min_depth_base = curr_height_to_depth.second;
float depth_diff = next_height_to_depth.second - curr_height_to_depth.second;
@ -2098,6 +2102,7 @@ bool PartPlate::intersect_instance(int obj_id, int instance_id, BoundingBoxf3* b
if (m_printable)
{
ModelObject* object = m_model->objects[obj_id];
ModelInstance* instance = object->instances[instance_id];
BoundingBoxf3 instance_box = bounding_box? *bounding_box: object->instance_convex_hull_bounding_box(instance_id);
result = get_plate_box().intersects(instance_box);
}
@ -2121,6 +2126,7 @@ bool PartPlate::is_left_top_of(int obj_id, int instance_id)
}
ModelObject* object = m_model->objects[obj_id];
ModelInstance* instance = object->instances[instance_id];
std::pair<int, int> pair(obj_id, instance_id);
BoundingBoxf3 instance_box = object->instance_convex_hull_bounding_box(instance_id);
@ -3120,7 +3126,7 @@ void PartPlate::update_first_layer_print_sequence(size_t filament_nums)
void PartPlate::print() const
{
// unsigned int count=0;
unsigned int count=0;
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << boost::format(": plate index %1%, pointer %2%, print_index %3% print pointer %4%") % m_plate_index % this % m_print_index % m_print;
BOOST_LOG_TRIVIAL(trace) << boost::format("\t origin {%1%,%2%,%3%}, width %4%, depth %5%, height %6%") % m_origin.x() % m_origin.y() % m_origin.z() % m_width % m_depth % m_height;
@ -4147,7 +4153,8 @@ int PartPlateList::find_instance_belongs(int obj_id, int instance_id)
//newly added or modified
int PartPlateList::notify_instance_update(int obj_id, int instance_id, bool is_new)
{
int index;
int ret = 0, index;
PartPlate* plate = NULL;
ModelObject* object = NULL;
if ((obj_id >= 0) && (obj_id < m_model->objects.size()))
@ -4176,7 +4183,7 @@ int PartPlateList::notify_instance_update(int obj_id, int instance_id, bool is_n
{
//found it added before
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": found it in previous plate %1%") % index;
PartPlate* plate = m_plate_list[index];
plate = m_plate_list[index];
if (!plate->intersect_instance(obj_id, instance_id, &boundingbox))
{
//not include anymore, remove it from original plate
@ -4281,7 +4288,7 @@ int PartPlateList::notify_instance_update(int obj_id, int instance_id, bool is_n
//notify instance is removed
int PartPlateList::notify_instance_removed(int obj_id, int instance_id)
{
int index, instance_to_delete = instance_id;
int ret = 0, index, instance_to_delete = instance_id;
PartPlate* plate = NULL;
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": obj_id %1%, instance_id %2%") % obj_id % instance_id;
@ -4379,6 +4386,7 @@ int PartPlateList::reload_all_objects(bool except_locked, int plate_index)
ModelObject* object = m_model->objects[i];
for (j = 0; j < (unsigned int)object->instances.size(); ++j)
{
ModelInstance* instance = object->instances[j];
BoundingBoxf3 boundingbox = object->instance_convex_hull_bounding_box(j);
for (k = 0; k < (unsigned int)m_plate_list.size(); ++k)
{
@ -4429,7 +4437,9 @@ int PartPlateList::construct_objects_list_for_new_plate(int plate_index)
ModelObject* object = m_model->objects[i];
for (j = 0; j < (unsigned int)object->instances.size(); ++j)
{
ModelInstance* instance = object->instances[j];
already_included = false;
for (k = 0; k < (unsigned int)plate_index; ++k)
{
PartPlate* plate = m_plate_list[k];
@ -4603,6 +4613,7 @@ bool PartPlateList::preprocess_nonprefered_areas(arrangement::ArrangePolygons& r
nonprefered_regions.emplace_back(Vec2d{ 18,0 }, Vec2d{ 240,15 }); // new extrusion & hand-eye calibration region
//has exclude areas
PartPlate* plate = m_plate_list[0];
for (int index = 0; index < nonprefered_regions.size(); index++)
{
Polygon ap = scaled(nonprefered_regions[index]).polygon();
@ -4829,8 +4840,11 @@ void PartPlateList::set_render_option(bool bedtype_texture, bool plate_settings)
int PartPlateList::select_plate_by_obj(int obj_index, int instance_index)
{
int ret = 0, index;
PartPlate* plate = NULL;
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": obj_id %1%, instance_id %2%") % obj_index % instance_index;
int index = find_instance(obj_index, instance_index);
index = find_instance(obj_index, instance_index);
if (index != -1)
{
//found it in plate
@ -4868,6 +4882,8 @@ bool PartPlateList::set_shapes(const Pointfs& shape, const Pointfs& exclude_area
m_height_to_lid = height_to_lid;
m_height_to_rod = height_to_rod;
double stride_x = plate_stride_x();
double stride_y = plate_stride_y();
for (unsigned int i = 0; i < (unsigned int)m_plate_list.size(); ++i)
{
PartPlate* plate = m_plate_list[i];
@ -5429,12 +5445,14 @@ void PartPlateList::BedTextureInfo::TexturePart::update_buffer()
rectangle.push_back(Vec2d(x, y+h));
ExPolygon poly;
for (const auto& p : rectangle) {
Vec2d pp = Vec2d(p.x() + offset.x(), p.y() + offset.y());
poly.contour.append({ scale_(pp(0)), scale_(pp(1)) });
for (int i = 0; i < 4; i++) {
const Vec2d & p = rectangle[i];
for (auto& p : rectangle) {
Vec2d pp = Vec2d(p.x() + offset.x(), p.y() + offset.y());
poly.contour.append({ scale_(pp(0)), scale_(pp(1)) });
}
}
if (!buffer)
buffer = new GLModel();

View file

@ -396,9 +396,10 @@ Sidebar::priv::~priv()
void Sidebar::priv::show_preset_comboboxes()
{
const bool showSLA = wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA;
//BBS
#if 0
const bool showSLA = wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA;
for (size_t i = 0; i < 4; ++i)
sizer_presets->Show(i, !showSLA);
@ -1157,7 +1158,7 @@ void Sidebar::init_filament_combo(PlaterPresetComboBox **combo, const int filame
auto combo_and_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
// BBS: filament double columns
// int em = wxGetApp().em_unit();
int em = wxGetApp().em_unit();
combo_and_btn_sizer->Add(FromDIP(8), 0, 0, 0, 0 );
(*combo)->clr_picker->SetLabel(wxString::Format("%d", filament_idx + 1));
combo_and_btn_sizer->Add((*combo)->clr_picker, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(3));
@ -1325,6 +1326,7 @@ void Sidebar::update_all_preset_comboboxes()
void Sidebar::update_presets(Preset::Type preset_type)
{
PresetBundle &preset_bundle = *wxGetApp().preset_bundle;
const auto print_tech = preset_bundle.printers.get_edited_preset().printer_technology();
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": enter, preset_type %1%")%preset_type;
switch (preset_type) {
@ -1332,7 +1334,6 @@ void Sidebar::update_presets(Preset::Type preset_type)
{
// BBS
#if 0
const auto print_tech = preset_bundle.printers.get_edited_preset().printer_technology();
const size_t extruder_cnt = print_tech != ptFFF ? 1 :
dynamic_cast<ConfigOptionFloats*>(preset_bundle.printers.get_edited_preset().config.option("nozzle_diameter"))->values.size();
const size_t filament_cnt = p->combos_filament.size() > extruder_cnt ? extruder_cnt : p->combos_filament.size();
@ -1354,7 +1355,7 @@ void Sidebar::update_presets(Preset::Type preset_type)
for (size_t i = 0; i < filament_cnt; i++)
p->combos_filament[i]->update();
dynamic_filament_list.update();
update_dynamic_filament_list();
break;
}
@ -1637,7 +1638,7 @@ void Sidebar::on_filaments_change(size_t num_filaments)
Layout();
p->m_panel_filament_title->Refresh();
update_ui_from_settings();
dynamic_filament_list.update();
update_dynamic_filament_list();
}
void Sidebar::add_filament() {
@ -1788,7 +1789,7 @@ void Sidebar::sync_ams_list()
// BBS:Record consumables information before synchronization
std::vector<string> color_before_sync;
std::vector<bool> is_support_before;
std::vector<int> is_support_before;
DynamicPrintConfig& project_config = wxGetApp().preset_bundle->project_config;
ConfigOptionStrings* color_opt = project_config.option<ConfigOptionStrings>("filament_colour");
for (int i = 0; i < p->combos_filament.size(); ++i) {
@ -1818,7 +1819,7 @@ void Sidebar::sync_ams_list()
c->update();
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->select_preset(wxGetApp().preset_bundle->filament_presets[0]);
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
dynamic_filament_list.update();
update_dynamic_filament_list();
// Expand filament list
p->m_panel_filament_content->SetMaxSize({-1, -1});
// BBS:Synchronized consumables information
@ -1854,6 +1855,12 @@ void Sidebar::show_SEMM_buttons(bool bshow)
Layout();
}
void Sidebar::update_dynamic_filament_list()
{
dynamic_filament_list.update();
dynamic_filament_list_1_based.update();
}
ObjectList* Sidebar::obj_list()
{
// BBS
@ -2021,13 +2028,18 @@ void Sidebar::auto_calc_flushing_volumes(const int modify_id)
{
auto& preset_bundle = wxGetApp().preset_bundle;
auto& project_config = preset_bundle->project_config;
auto& printer_config = preset_bundle->printers.get_edited_preset().config;
const auto& full_config = wxGetApp().preset_bundle->full_config();
auto& ams_multi_color_filament = preset_bundle->ams_multi_color_filment;
auto& ams_filament_list = preset_bundle->filament_ams_list;
const std::vector<double>& init_matrix = (project_config.option<ConfigOptionFloats>("flush_volumes_matrix"))->values;
const std::vector<double>& init_extruders = (project_config.option<ConfigOptionFloats>("flush_volumes_vector"))->values;
const std::vector<int>& min_flush_volumes= get_min_flush_volumes(full_config);
ConfigOptionFloat* flush_multi_opt = project_config.option<ConfigOptionFloat>("flush_multiplier");
float flush_multiplier = flush_multi_opt ? flush_multi_opt->getFloat() : 1.f;
std::vector<double> matrix = init_matrix;
int m_max_flush_volume = Slic3r::g_max_flush_volume;
unsigned int m_number_of_extruders = (int)(sqrt(init_matrix.size()) + 0.001);
@ -2925,7 +2937,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
wxGLCanvas* view3D_canvas = view3D->get_wxglcanvas();
//BBS: GUI refactor
// wxGLCanvas* preview_canvas = preview->get_wxglcanvas();
wxGLCanvas* preview_canvas = preview->get_wxglcanvas();
if (wxGetApp().is_editor()) {
// 3DScene events:
@ -3643,8 +3655,11 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
std::string designer_model_id;
std::string designer_country_code;
int answer_convert_from_meters = wxOK_DEFAULT;
int answer_convert_from_imperial_units = wxOK_DEFAULT;
int tolal_model_count = 0;
int progress_percent = 0;
int total_files = input_files.size();
const int stage_percent[IMPORT_STAGE_MAX+1] = {
5, // IMPORT_STAGE_RESTORE
@ -3811,7 +3826,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
wxString text = wxString::Format(_L("The 3mf's version %s is newer than %s's version %s, Found following keys unrecognized:"),
file_version.to_string(), std::string(SLIC3R_APP_FULL_NAME), app_version.to_string());
text += "\n";
// bool first = true;
bool first = true;
// std::string context = into_u8(text);
wxString context = text;
// if (wxGetApp().app_config->get("user_mode") == "develop") {
@ -3917,7 +3932,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
}
// Based on the printer technology field found in the loaded config, select the base for the config,
// PrinterTechnology printer_technology = Preset::printer_technology(config_loaded);
PrinterTechnology printer_technology = Preset::printer_technology(config_loaded);
config.apply(static_cast<const ConfigBase &>(FullPrintConfig::defaults()));
// and place the loaded config over the base.
@ -3972,7 +3987,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
MessageDialog dlg(q, _L("The 3mf has following modified G-codes in filament or printer presets:") + warning_message+ _L("Please confirm that these modified G-codes are safe to prevent any damage to the machine!"), _L("Modified G-codes"));
dlg.show_dsa_button();
dlg.ShowModal();
auto res = dlg.ShowModal();
if (dlg.get_checkbox_state())
wxGetApp().app_config->set("no_warn_when_modified_gcodes", "true");
}
@ -3985,7 +4000,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
//show_info(q, _L("The 3mf has following customized filament or printer presets:") + warning_message + _L("Please confirm that the G-codes within these presets are safe to prevent any damage to the machine!"), _L("Customized Preset"));
MessageDialog dlg(q, _L("The 3mf has following customized filament or printer presets:") + from_u8(warning_message)+ _L("Please confirm that the G-codes within these presets are safe to prevent any damage to the machine!"), _L("Customized Preset"));
dlg.show_dsa_button();
dlg.ShowModal();
auto res = dlg.ShowModal();
if (dlg.get_checkbox_state())
wxGetApp().app_config->set("no_warn_when_modified_gcodes", "true");
}
@ -4488,7 +4503,7 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs& mode
#ifndef AUTOPLACEMENT_ON_LOAD
// bool need_arrange = false;
#endif /* AUTOPLACEMENT_ON_LOAD */
// bool scaled_down = false;
bool scaled_down = false;
std::vector<size_t> obj_idxs;
unsigned int obj_count = model.objects.size();
@ -4525,15 +4540,15 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs& mode
const Vec3d ratio = size.cwiseQuotient(bed_size);
const double max_ratio = std::max(ratio(0), ratio(1));
if (max_ratio > 10000) {
MessageDialog dlg(q, _L("Your object appears to be too large. It will be scaled down to fit the heat bed automatically."), _L("Object too large"),
wxICON_QUESTION | wxOK);
dlg.ShowModal();
MessageDialog dlg(q, _L("Your object appears to be too large, Do you want to scale it down to fit the heat bed automatically?"), _L("Object too large"),
wxICON_QUESTION | wxYES);
int answer = dlg.ShowModal();
// the size of the object is too big -> this could lead to overflow when moving to clipper coordinates,
// so scale down the mesh
object->scale_mesh_after_creation(1. / max_ratio);
object->origin_translation = Vec3d::Zero();
object->center_around_origin();
// scaled_down = true;
scaled_down = true;
break;
}
else if (max_ratio > 10) {
@ -4542,7 +4557,7 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs& mode
int answer = dlg.ShowModal();
if (answer == wxID_YES) {
instance->set_scaling_factor(instance->get_scaling_factor() / max_ratio);
// scaled_down = true;
scaled_down = true;
}
}
}
@ -5296,7 +5311,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
process_validation_warning(warning);
return_state |= UPDATE_BACKGROUND_PROCESS_INVALID;
if (printer_technology == ptFFF) {
// const Print* print = background_process.fff_print();
const Print* print = background_process.fff_print();
//Polygons polygons;
//if (print->config().print_sequence == PrintSequence::ByObject)
// Print::sequential_print_clearance_valid(*print, &polygons);
@ -6440,6 +6455,7 @@ void Plater::priv::on_select_bed_type(wxCommandEvent &evt)
int selection = combo->GetSelection();
std::string bed_type_name = print_config_def.get("curr_bed_type")->enum_values[selection];
PresetBundle& preset_bundle = *wxGetApp().preset_bundle;
DynamicPrintConfig& proj_config = wxGetApp().preset_bundle->project_config;
const t_config_enum_values* keys_map = print_config_def.get("curr_bed_type")->enum_keys_map;
@ -6535,7 +6551,7 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
wxGetApp().preset_bundle->set_filament_preset(idx, preset_name);
wxGetApp().plater()->update_project_dirty_from_presets();
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
dynamic_filament_list.update();
sidebar->update_dynamic_filament_list();
bool flag_is_change = is_support_filament(idx);
if (flag != flag_is_change) {
sidebar->auto_calc_flushing_volumes(idx);
@ -8278,7 +8294,7 @@ void Plater::priv::on_create_filament(SimpleEvent &)
update_ui_from_settings();
sidebar->update_all_preset_comboboxes();
CreatePresetSuccessfulDialog success_dlg(wxGetApp().mainframe, SuccessType::FILAMENT);
success_dlg.ShowModal();
int res = success_dlg.ShowModal();
}
}
@ -8390,7 +8406,7 @@ void Plater::priv::take_snapshot(const std::string& snapshot_name, const UndoRed
// This is a workaround until we refactor the Wipe Tower position / orientation to live solely inside the Model, not in the Print config.
// BBS: add partplate logic
if (this->printer_technology == ptFFF) {
// const DynamicPrintConfig& config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
const DynamicPrintConfig& config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
const DynamicPrintConfig& proj_cfg = wxGetApp().preset_bundle->project_config;
const ConfigOptionFloats* tower_x_opt = proj_cfg.option<ConfigOptionFloats>("wipe_tower_x");
const ConfigOptionFloats* tower_y_opt = proj_cfg.option<ConfigOptionFloats>("wipe_tower_y");
@ -8500,7 +8516,7 @@ void Plater::priv::undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator
// This is a workaround until we refactor the Wipe Tower position / orientation to live solely inside the Model, not in the Print config.
// BBS: add partplate logic
if (this->printer_technology == ptFFF) {
// const DynamicPrintConfig& config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
const DynamicPrintConfig& config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
const DynamicPrintConfig& proj_cfg = wxGetApp().preset_bundle->project_config;
const ConfigOptionFloats* tower_x_opt = proj_cfg.option<ConfigOptionFloats>("wipe_tower_x");
const ConfigOptionFloats* tower_y_opt = proj_cfg.option<ConfigOptionFloats>("wipe_tower_y");
@ -8567,7 +8583,7 @@ void Plater::priv::undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator
// This is a workaround until we refactor the Wipe Tower position / orientation to live solely inside the Model, not in the Print config.
// BBS: add partplate logic
if (this->printer_technology == ptFFF) {
// const DynamicPrintConfig& config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
const DynamicPrintConfig& config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
const DynamicPrintConfig& proj_cfg = wxGetApp().preset_bundle->project_config;
ConfigOptionFloats* tower_x_opt = const_cast<ConfigOptionFloats*>(proj_cfg.option<ConfigOptionFloats>("wipe_tower_x"));
ConfigOptionFloats* tower_y_opt = const_cast<ConfigOptionFloats*>(proj_cfg.option<ConfigOptionFloats>("wipe_tower_y"));
@ -8748,6 +8764,7 @@ void Plater::priv::record_start_print_preset(std::string action) {
}
j["record_event"] = action;
NetworkAgent* agent = wxGetApp().getAgent();
}
catch (...) {
return;
@ -8950,7 +8967,7 @@ void Plater::load_project(wxString const& filename2,
// if res is empty no data has been loaded
if (!res.empty() && (load_restore || !(strategy & LoadStrategy::Silence))) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << (load_restore ? originfile : filename);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << load_restore ? originfile : filename;
p->set_project_filename(load_restore ? originfile : filename);
if (load_restore && originfile.IsEmpty()) {
p->set_project_name(_L("Untitled"));
@ -9032,6 +9049,8 @@ int Plater::save_project(bool saveAs)
boost::uintmax_t size = boost::filesystem::file_size(into_path(filename));
j["file_size"] = size;
j["file_name"] = std::string(filename.mb_str());
NetworkAgent* agent = wxGetApp().getAgent();
}
catch (...) {}
@ -9064,7 +9083,7 @@ void Plater::import_model_id(wxString download_info)
}
}
catch (std::exception&)
catch (const std::exception&)
{
//wxString sError = error.what();
}
@ -9105,6 +9124,7 @@ void Plater::import_model_id(wxString download_info)
// NetworkAgent* m_agent = Slic3r::GUI::wxGetApp().getAgent();
// if (!m_agent) return;
int res = 0;
std::string http_body;
msg = _L("prepare 3mf file...");
@ -9143,7 +9163,7 @@ void Plater::import_model_id(wxString download_info)
if (sFile == filename) is_already_exist = true;
}
}
catch (std::exception&)
catch (const std::exception&)
{
//wxString sError = error.what();
}
@ -9445,21 +9465,21 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
print_config.set_key_value( "travel_jerk", new ConfigOptionFloat(jerk));
}
for (const auto opt : SuggestedConfigCalibPAPattern().float_pairs) {
for (const auto& opt : SuggestedConfigCalibPAPattern().float_pairs) {
print_config.set_key_value(
opt.first,
new ConfigOptionFloat(opt.second)
);
}
for (const auto opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) {
for (const auto& opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) {
print_config.set_key_value(
opt.first,
new ConfigOptionFloatOrPercent(nozzle_diameter * opt.second / 100, false)
);
}
for (const auto opt : SuggestedConfigCalibPAPattern().int_pairs) {
for (const auto& opt : SuggestedConfigCalibPAPattern().int_pairs) {
print_config.set_key_value(
opt.first,
new ConfigOptionInt(opt.second)
@ -9625,21 +9645,11 @@ void Plater::_calib_pa_select_added_objects() {
}
}
void Plater::calib_flowrate(int pass) {
if (pass != 1 && pass != 2)
return;
const auto calib_name = wxString::Format(L"Flowrate Test - Pass%d", pass);
if (new_project(false, false, calib_name) == wxID_CANCEL)
return;
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
if(pass == 1)
add_model(false, (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass1.3mf").string());
else
add_model(false, (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass2.3mf").string());
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
// Adjust settings for flowrate calibration
// For linear mode, pass 1 means normal version while pass 2 mean "for perfectionists" version
void adjust_settings_for_flowrate_calib(ModelObjectPtrs& objects, bool linear, int pass)
{
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto printerConfig = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
@ -9649,37 +9659,47 @@ void Plater::calib_flowrate(int pass) {
assert(nozzle_diameter_config->values.size() > 0);
float nozzle_diameter = nozzle_diameter_config->values[0];
float xyScale = nozzle_diameter / 0.6;
//scale z to have 7 layers
//scale z to have 10 layers
// 2 bottom, 5 top, 3 sparse infill
double first_layer_height = print_config->option<ConfigOptionFloat>("initial_layer_print_height")->value;
double layer_height = nozzle_diameter / 2.0; // prefer 0.2 layer height for 0.4 nozzle
first_layer_height = std::max(first_layer_height, layer_height);
float zscale = (first_layer_height + 6 * layer_height) / 1.4;
float zscale = (first_layer_height + 9 * layer_height) / 2;
// only enlarge
if (xyScale > 1.2) {
for (auto _obj : model().objects)
for (auto _obj : objects)
_obj->scale(xyScale, xyScale, zscale);
}
else {
for (auto _obj : model().objects)
for (auto _obj : objects)
_obj->scale(1, 1, zscale);
}
auto cur_flowrate = filament_config->option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0);
Flow infill_flow = Flow(nozzle_diameter * 1.2f, layer_height, nozzle_diameter);
double filament_max_volumetric_speed = filament_config->option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(0);
double max_infill_speed = filament_max_volumetric_speed / (infill_flow.mm3_per_mm() * (pass == 1 ? 1.2 : 1));
double max_infill_speed;
if (linear)
max_infill_speed = filament_max_volumetric_speed /
(infill_flow.mm3_per_mm() * (cur_flowrate + (pass == 2 ? 0.035 : 0.05)) / cur_flowrate);
else
max_infill_speed = filament_max_volumetric_speed / (infill_flow.mm3_per_mm() * (pass == 1 ? 1.2 : 1));
double internal_solid_speed = std::floor(std::min(print_config->opt_float("internal_solid_infill_speed"), max_infill_speed));
double top_surface_speed = std::floor(std::min(print_config->opt_float("top_surface_speed"), max_infill_speed));
// adjust parameters
for (auto _obj : model().objects) {
for (auto _obj : objects) {
_obj->ensure_on_bed();
_obj->config.set_key_value("wall_loops", new ConfigOptionInt(3));
_obj->config.set_key_value("wall_loops", new ConfigOptionInt(1));
_obj->config.set_key_value("only_one_wall_top", new ConfigOptionBool(true));
_obj->config.set_key_value("thick_internal_bridges", new ConfigOptionBool(false));
_obj->config.set_key_value("sparse_infill_density", new ConfigOptionPercent(35));
_obj->config.set_key_value("min_width_top_surface", new ConfigOptionFloatOrPercent(100,true));
_obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(1));
_obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(2));
_obj->config.set_key_value("top_shell_layers", new ConfigOptionInt(5));
_obj->config.set_key_value("top_shell_thickness", new ConfigOptionFloat(0));
_obj->config.set_key_value("bottom_shell_thickness", new ConfigOptionFloat(0));
_obj->config.set_key_value("detect_thin_wall", new ConfigOptionBool(true));
_obj->config.set_key_value("filter_out_gap_fill", new ConfigOptionFloat(0));
_obj->config.set_key_value("sparse_infill_pattern", new ConfigOptionEnum<InfillPattern>(ipRectilinear));
@ -9703,14 +9723,18 @@ void Plater::calib_flowrate(int pass) {
if (obj_name[0] == 'm')
obj_name[0] = '-';
auto modifier = stof(obj_name);
_obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat(1.0f + modifier/100.f));
if(linear)
_obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat((cur_flowrate + modifier)/cur_flowrate));
else
_obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat(1.0f + modifier/100.f));
}
print_config->set_key_value("layer_height", new ConfigOptionFloat(layer_height));
print_config->set_key_value("alternate_extra_wall", new ConfigOptionBool(false));
print_config->set_key_value("initial_layer_print_height", new ConfigOptionFloat(first_layer_height));
print_config->set_key_value("reduce_crossing_wall", new ConfigOptionBool(true));
//filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats{ 9. });
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->update_dirty();
@ -9720,6 +9744,43 @@ void Plater::calib_flowrate(int pass) {
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
}
void Plater::calib_flowrate(bool is_linear, int pass) {
if (pass != 1 && pass != 2)
return;
wxString calib_name;
if (is_linear) {
calib_name = L"Orca YOLO Flow Calibration";
if (pass == 2)
calib_name += L" - Perfectionist version";
} else
calib_name = wxString::Format(L"Flowrate Test - Pass%d", pass);
if (new_project(false, false, calib_name) == wxID_CANCEL)
return;
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
if (is_linear) {
if (pass == 1)
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "Orca-LinearFlow.3mf").string());
else
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "Orca-LinearFlow_fine.3mf").string());
} else {
if (pass == 1)
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass1.3mf").string());
else
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass2.3mf").string());
}
adjust_settings_for_flowrate_calib(model().objects, is_linear, pass);
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
}
void Plater::calib_temp(const Calib_Params& params) {
const auto calib_temp_name = wxString::Format(L"Nozzle temperature test");
new_project(false, false, calib_temp_name);
@ -9856,6 +9917,7 @@ void Plater::calib_retraction(const Calib_Params& params)
add_model(false, Slic3r::resources_dir() + "/calib/retraction/retraction_tower.stl");
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
auto obj = model().objects[0];
@ -10186,7 +10248,7 @@ bool Plater::preview_zip_archive(const boost::filesystem::path& archive_path)
std::replace(name.begin(), name.end(), '\\', '/');
// rename if file exists
std::string filename = path.filename().string();
std::string extension = path.extension().string();
std::string extension = boost::filesystem::extension(path);
std::string just_filename = filename.substr(0, filename.size() - extension.size());
std::string final_filename = just_filename;
@ -10492,6 +10554,7 @@ ProjectDropDialog::ProjectDropDialog(const std::string &filename)
auto limit_width = m_fname_f->GetSize().GetWidth() - 2;
auto current_width = 0;
auto cut_index = 0;
auto fstring = wxString("");
auto bstring = wxString("");
@ -10499,6 +10562,7 @@ ProjectDropDialog::ProjectDropDialog(const std::string &filename)
auto file_name = wxString(filename);
for (int x = 0; x < file_name.length(); x++) {
current_width += m_fname_s->GetTextExtent(file_name[x]).GetWidth();
cut_index = x;
if (current_width > limit_width) {
bstring += file_name[x];
@ -11401,6 +11465,7 @@ void Plater::export_gcode(bool prefer_removable)
if (preset_bundle) {
j["gcode_printer_model"] = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
}
NetworkAgent *agent = wxGetApp().getAgent();
} catch (...) {}
}
@ -11510,7 +11575,7 @@ TriangleMesh Plater::combine_mesh_fff(const ModelObject& mo, int instance_id, st
std::vector<csg::CSGPart> csgmesh;
csgmesh.reserve(2 * mo.volumes.size());
csg::model_to_csgmesh(mo, Transform3d::Identity(), std::back_inserter(csgmesh),
bool has_splitable_volume = csg::model_to_csgmesh(mo, Transform3d::Identity(), std::back_inserter(csgmesh),
csg::mpartsPositive | csg::mpartsNegative);
std::string fail_msg = _u8L("Unable to perform boolean operation on model meshes. "
@ -11590,9 +11655,9 @@ void Plater::export_stl(bool extended, bool selection_only, bool multi_stls)
wxBusyCursor wait;
const auto& selection = p->get_selection();
const auto obj_idx = selection.get_object_idx();
#if EXPORT_WITH_BOOLEAN
const auto obj_idx = selection.get_object_idx();
if (selection_only && (obj_idx == -1 || selection.is_wipe_tower()))
return;
#else
@ -12355,6 +12420,7 @@ void Plater::record_slice_preset(std::string action)
}
j["record_event"] = action;
NetworkAgent* agent = wxGetApp().getAgent();
}
catch (...)
{
@ -12794,7 +12860,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
if (update_filament_colors_in_full_config()) {
p->sidebar->obj_list()->update_filament_colors();
dynamic_filament_list.update();
p->sidebar->update_dynamic_filament_list();
continue;
}
}
@ -12851,9 +12917,9 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
bed_shape_changed = true;
update_scheduled = true;
}
// BBS
else if (opt_key == "support_interface_filament" ||
opt_key == "support_filament") {
// Orca: update when *_filament changed
else if (opt_key == "support_interface_filament" || opt_key == "support_filament" || opt_key == "wall_filament" ||
opt_key == "sparse_infill_filament" || opt_key == "solid_infill_filament") {
update_scheduled = true;
}
}

View file

@ -150,6 +150,7 @@ public:
void sync_ams_list();
// Orca
void show_SEMM_buttons(bool bshow);
void update_dynamic_filament_list();
ObjectList* obj_list();
ObjectSettings* obj_settings();
@ -258,7 +259,7 @@ public:
// SoftFever
void calib_pa(const Calib_Params& params);
void calib_flowrate(int pass);
void calib_flowrate(bool is_linear, int pass);
void calib_temp(const Calib_Params& params);
void calib_max_vol_speed(const Calib_Params& params);
void calib_retraction(const Calib_Params& params);

View file

@ -16,6 +16,7 @@
#include "Widgets/RadioBox.hpp"
#include "Widgets/TextInput.hpp"
#include <wx/listimpl.cpp>
#include <wx/display.h>
#include <map>
#ifdef __WINDOWS__
@ -228,13 +229,13 @@ wxBoxSizer *PreferencesDialog::create_item_language_combobox(
}
}
/*auto check = [this](bool yes_or_no) {
auto check = [this](bool yes_or_no) {
// if (yes_or_no)
// return true;
int act_btns = ActionButtons::SAVE;
return wxGetApp().check_and_keep_current_preset_changes(_L("Switching application language"),
_L("Switching application language while some presets are modified."), act_btns);
};*/
};
m_current_language_selected = combobox->GetSelection();
if (m_current_language_selected >= 0 && m_current_language_selected < vlist.size()) {

View file

@ -401,7 +401,7 @@ void PresetComboBox::add_ams_filaments(std::string selected, bool alias_name)
auto color = tray.opt_string("filament_colour", 0u);
auto name = tray.opt_string("tray_name", 0u);
wxBitmap bmp(*get_extruder_color_icon(color, name, 24, 16));
Append(get_preset_name(*iter), bmp.ConvertToImage(), &m_first_ams_filament + entry.first);
int item_id = Append(get_preset_name(*iter), bmp.ConvertToImage(), &m_first_ams_filament + entry.first);
//validate_selection(id->value == selected); // can not select
}
m_last_ams_filament = GetCount();
@ -668,6 +668,7 @@ PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset
// BBS
if (m_type == Preset::TYPE_FILAMENT) {
int em = wxGetApp().em_unit();
clr_picker = new wxBitmapButton(parent, wxID_ANY, {}, wxDefaultPosition, wxSize(FromDIP(20), FromDIP(20)), wxBU_EXACTFIT | wxBU_AUTODRAW | wxBORDER_NONE);
clr_picker->SetToolTip(_L("Click to pick filament color"));
clr_picker->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {
@ -798,10 +799,13 @@ bool PlaterPresetComboBox::switch_to_tab()
//BBS Select NoteBook Tab params
if (tab->GetParent() == wxGetApp().params_panel())
wxGetApp().mainframe->select_tab(MainFrame::tp3DEditor);
else
else {
wxGetApp().params_dialog()->Popup();
tab->OnActivate();
}
tab->restore_last_select_item();
const Preset* selected_filament_preset = nullptr;
if (m_type == Preset::TYPE_FILAMENT)
{
const std::string& selected_preset = GetString(GetSelection()).ToUTF8().data();
@ -981,6 +985,7 @@ void PlaterPresetComboBox::update()
if (!preset.is_visible || (!preset.is_compatible && !is_selected))
continue;
bool single_bar = false;
if (m_type == Preset::TYPE_FILAMENT)
{
#if 0
@ -988,7 +993,7 @@ void PlaterPresetComboBox::update()
filament_rgb = is_selected ? selected_filament_preset->config.opt_string("filament_colour", 0) :
preset.config.opt_string("filament_colour", 0);
extruder_rgb = (is_selected && !filament_color.empty()) ? filament_color : filament_rgb;
bool single_bar = filament_rgb == extruder_rgb;
single_bar = filament_rgb == extruder_rgb;
bitmap_key += single_bar ? filament_rgb : filament_rgb + extruder_rgb;
#endif
@ -1476,6 +1481,8 @@ void GUI::CalibrateFilamentComboBox::update()
this->Clear();
invalidate_selection();
const Preset* selected_filament_preset = nullptr;
m_nonsys_presets.clear();
m_system_presets.clear();

View file

@ -548,6 +548,7 @@ void PrinterFileSystem::BuildGroups()
void PrinterFileSystem::UpdateGroupSelect()
{
m_group_flags.clear();
int beg = 0;
if (m_group_mode != G_NONE) {
auto group = m_group_mode == G_YEAR ? m_group_year : m_group_month;
if (m_group_mode == G_YEAR)

View file

@ -1,9 +1,11 @@
#include "PrinterWebView.hpp"
#include "I18N.hpp"
#include "slic3r/GUI/PrinterWebView.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/MainFrame.hpp"
#include "libslic3r_version.h"
#include <wx/sizer.h>
#include <wx/string.h>

View file

@ -86,6 +86,8 @@ void RecenterDialog::OnPaint(wxPaintEvent& event){
}
void RecenterDialog::render(wxDC& dc) {
wxSize size = GetSize();
dc.SetFont(Label::Body_14);
dc.SetTextForeground(text_color);
wxPoint pos_start = wxPoint(BORDER, BORDER);

View file

@ -1375,6 +1375,7 @@ wxString ConfirmBeforeSendDialog::format_text(wxString str, int warp)
Label st (this, str);
wxString out_txt = str;
wxString count_txt = "";
int new_line_pos = 0;
for (int i = 0; i < str.length(); i++) {
auto text_size = st.GetTextExtent(count_txt);

View file

@ -6,9 +6,13 @@
#include <boost/log/trivial.hpp>
#if _WIN32
#include <windows.h>
#include <tchar.h>
#include <winioctl.h>
#include <shlwapi.h>
#include <Dbt.h>
#else
// unix, linux & OSX includes
#include <errno.h>

View file

@ -435,6 +435,8 @@ void SearchItem::OnPaint(wxPaintEvent &event)
auto bold_pair = std::vector<std::pair<int, int>>();
auto index = 0;
auto b_first_list = std::vector<int>();
auto b_second_list = std::vector<int>();
@ -813,9 +815,8 @@ void SearchDialog::OnCheck(wxCommandEvent &event)
void SearchDialog::OnMotion(wxMouseEvent &event)
{
// wxDataViewItem item;
// wxDataViewColumn *col;
// wxWindow * win = this;
wxDataViewItem item;
wxWindow * win = this;
// search_list->HitTest(wxGetMousePosition() - win->GetScreenPosition(), item, col);
// search_list->Select(item);
@ -864,7 +865,7 @@ void SearchDialog::msw_rescale()
SearchListModel::SearchListModel(wxWindow *parent) : wxDataViewVirtualListModel(0)
{
int icon_id = 0;
for (const std::string &icon : {"cog", "printer", "printer", "spool", "blank_16"}) m_icon[icon_id++] = ScalableBitmap(parent, icon);
for (const std::string icon : {"cog", "printer", "printer", "spool", "blank_16"}) m_icon[icon_id++] = ScalableBitmap(parent, icon);
}
void SearchListModel::Clear()

View file

@ -421,7 +421,7 @@ SelectMachinePopup::SelectMachinePopup(wxWindow *parent)
m_refresh_timer = new wxTimer();
m_refresh_timer->SetOwner(this);
Bind(EVT_UPDATE_USER_MACHINE_LIST, &SelectMachinePopup::update_machine_list, this);
Bind(wxEVT_TIMER, [this](wxTimerEvent&) { on_timer(); });
Bind(wxEVT_TIMER, &SelectMachinePopup::on_timer, this);
Bind(EVT_DISSMISS_MACHINE_LIST, &SelectMachinePopup::on_dissmiss_win, this);
}
@ -459,7 +459,7 @@ void SelectMachinePopup::Popup(wxWindow *WXUNUSED(focus))
}
}
on_timer();
wxPostEvent(this, wxTimerEvent());
PopupWindow::Popup();
}
@ -529,7 +529,7 @@ wxWindow *SelectMachinePopup::create_title_panel(wxString text)
return m_panel_title_own;
}
void SelectMachinePopup::on_timer()
void SelectMachinePopup::on_timer(wxTimerEvent &event)
{
BOOST_LOG_TRIVIAL(trace) << "SelectMachinePopup on_timer";
wxGetApp().reset_to_active();
@ -933,6 +933,7 @@ wxString SelectMachineDialog::format_text(wxString &m_msg)
wxString out_txt = m_msg;
wxString count_txt = "";
int new_line_pos = 0;
for (int i = 0; i < m_msg.length(); i++) {
auto text_size = m_statictext_ams_msg->GetTextExtent(count_txt);
@ -2460,6 +2461,9 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
//check blacklist
for (auto i = 0; i < m_ams_mapping_result.size(); i++) {
auto tid = m_ams_mapping_result[i].tray_id;
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
std::string filament_brand;
@ -3315,7 +3319,7 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
if (m_list[i]->is_lan_mode_printer() && !m_list[i]->has_access_right()) {
ConnectPrinterDialog dlg(wxGetApp().mainframe, wxID_ANY, _L("Input access code"));
dlg.set_machine_object(m_list[i]);
dlg.ShowModal();
auto res = dlg.ShowModal();
m_printer_last_select = "";
m_comboBox_printer->SetSelection(-1);
m_comboBox_printer->Refresh();
@ -3365,6 +3369,7 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
void SelectMachineDialog::update_flow_cali_check(MachineObject* obj)
{
auto bed_type = m_plater->get_partplate_list().get_curr_plate()->get_bed_type(true);
auto show_cali_tips = true;
if (obj && obj->get_printer_arch() == PrinterArch::ARCH_I3) { show_cali_tips = false; }
@ -3701,6 +3706,7 @@ void SelectMachineDialog::reset_ams_material()
{
MaterialHash::iterator iter = m_materialList.begin();
while (iter != m_materialList.end()) {
int id = iter->first;
Material* item = iter->second;
MaterialItem* m = item->item;
wxString ams_id = "-";
@ -3982,6 +3988,7 @@ void SelectMachineDialog::reset_and_sync_ams_list()
BitmapCache bmcache;
MaterialHash::iterator iter = m_materialList.begin();
while (iter != m_materialList.end()) {
int id = iter->first;
Material *item = iter->second;
item->item->Destroy();
delete item;
@ -4008,6 +4015,7 @@ void SelectMachineDialog::reset_and_sync_ams_list()
item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent &e) {
MaterialHash::iterator iter = m_materialList.begin();
while (iter != m_materialList.end()) {
int id = iter->first;
Material * item = iter->second;
MaterialItem *m = item->item;
m->on_normal();
@ -4017,6 +4025,9 @@ void SelectMachineDialog::reset_and_sync_ams_list()
m_current_filament_id = extruder;
item->on_selected();
auto mouse_pos = ClientToScreen(e.GetPosition());
wxPoint rect = item->ClientToScreen(wxPoint(0, 0));
// update ams data
DeviceManager *dev_manager = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev_manager) return;
@ -4236,6 +4247,7 @@ void SelectMachineDialog::unify_deal_thumbnail_data(ThumbnailData &input_data, T
MaterialHash::iterator iter = m_materialList.begin();
bool is_connect_printer = true;
while (iter != m_materialList.end()) {
int id = iter->first;
Material * item = iter->second;
MaterialItem *m = item->item;
if (m->m_ams_name == "-") {
@ -4347,10 +4359,10 @@ void SelectMachineDialog::set_default_normal(const ThumbnailData &data)
MachineObject* obj_ = dev_manager->get_selected_machine();
update_flow_cali_check(obj_);
#ifdef __WINDOWS__
wxSize screenSize = wxGetDisplaySize();
auto dialogSize = this->GetSize();
#ifdef __WINDOWS__
if (screenSize.GetHeight() < dialogSize.GetHeight()) {
m_need_adaptation_screen = true;
m_scrollable_view->SetScrollRate(0, 5);
@ -4411,6 +4423,7 @@ void SelectMachineDialog::set_default_from_sdcard()
//init MaterialItem
MaterialHash::iterator iter = m_materialList.begin();
while (iter != m_materialList.end()) {
int id = iter->first;
Material* item = iter->second;
item->item->Destroy();
delete item;
@ -4433,6 +4446,7 @@ void SelectMachineDialog::set_default_from_sdcard()
item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, fo](wxMouseEvent& e) {
MaterialHash::iterator iter = m_materialList.begin();
while (iter != m_materialList.end()) {
int id = iter->first;
Material* item = iter->second;
MaterialItem* m = item->item;
m->on_normal();
@ -4445,6 +4459,9 @@ void SelectMachineDialog::set_default_from_sdcard()
catch (...) {}
item->on_selected();
auto mouse_pos = ClientToScreen(e.GetPosition());
wxPoint rect = item->ClientToScreen(wxPoint(0, 0));
// update ams data
DeviceManager* dev_manager = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev_manager) return;
@ -4468,7 +4485,7 @@ void SelectMachineDialog::set_default_from_sdcard()
m_mapping_popup.Popup();
}
}
});
});
Material* material_item = new Material();
material_item->id = fo.id;
@ -4495,9 +4512,10 @@ void SelectMachineDialog::set_default_from_sdcard()
set_flow_calibration_state(true);
#ifdef __WINDOWS__
wxSize screenSize = wxGetDisplaySize();
auto dialogSize = this->GetSize();
#ifdef __WINDOWS__
if (screenSize.GetHeight() < dialogSize.GetHeight()) {
m_need_adaptation_screen = true;
m_scrollable_view->SetScrollRate(0, 5);

View file

@ -278,7 +278,7 @@ private:
private:
void OnLeftUp(wxMouseEvent &event);
void on_timer();
void on_timer(wxTimerEvent &event);
void update_other_devices();
void update_user_devices();

View file

@ -1110,6 +1110,7 @@ void Selection::move_to_center(const Vec3d& displacement, bool local)
if (!m_valid)
return;
EMode translation_type = m_mode;
//BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": %1%, displacement {%2%, %3%, %4%}") % __LINE__ % displacement(X) % displacement(Y) % displacement(Z);
set_caches();
@ -1130,6 +1131,7 @@ void Selection::move_to_center(const Vec3d& displacement, bool local)
else {
const Vec3d local_displacement = (m_cache.volumes_data[i].get_instance_rotation_matrix() * m_cache.volumes_data[i].get_instance_scale_matrix() * m_cache.volumes_data[i].get_instance_mirror_matrix()).inverse() * displacement;
v.set_volume_offset(m_cache.volumes_data[i].get_volume_position() + local_displacement);
translation_type = Volume;
}
}
}
@ -2183,8 +2185,7 @@ void Selection::update_type()
obj_it->second.insert(inst_idx);
}
// BBL removed functionality below
// bool requires_disable = false;
bool requires_disable = false;
if (!m_valid)
m_type = Invalid;
@ -2200,7 +2201,7 @@ void Selection::update_type()
else if (first->is_modifier)
{
m_type = SingleModifier;
// requires_disable = true;
requires_disable = true;
}
else
{
@ -2222,7 +2223,7 @@ void Selection::update_type()
else
{
m_type = SingleVolume;
// requires_disable = true;
requires_disable = true;
}
}
}
@ -2270,7 +2271,7 @@ void Selection::update_type()
else if (modifiers_count == (unsigned int)m_list.size())
m_type = MultipleModifier;
// requires_disable = true;
requires_disable = true;
}
}
else if ((selected_instances_count > 1) && (selected_instances_count * model_volumes_count + sla_volumes_count == (unsigned int)m_list.size()))

View file

@ -300,7 +300,7 @@ SendMultiMachinePage::SendMultiMachinePage(Plater* plater)
m_main_scroll->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {check_fcous_state(this); e.Skip(); });
init_timer();
Bind(wxEVT_TIMER, [this](wxTimerEvent&) { on_timer(); });
Bind(wxEVT_TIMER, &SendMultiMachinePage::on_timer, this);
wxGetApp().UpdateDlgDarkUI(this);
}
@ -451,6 +451,8 @@ BBL::PrintParams SendMultiMachinePage::request_params(MachineObject* obj)
auto use_ams = false;
AmsRadioSelectorList::Node* node = m_radio_group.GetFirst();
auto groupid = 0;
while (node) {
AmsRadioSelector* rs = node->GetData();
@ -470,11 +472,13 @@ BBL::PrintParams SendMultiMachinePage::request_params(MachineObject* obj)
PrintPrepareData job_data;
m_plater->get_print_job_data(&job_data);
std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt";
auto check_access_code_path = temp_file.c_str();
BOOST_LOG_TRIVIAL(trace) << "sned_job: check_access_code_path = " << check_access_code_path;
job_data._temp_path = fs::path(check_access_code_path);
if (&job_data) {
std::string temp_file = Slic3r::resources_dir() + "/check_access_code.txt";
auto check_access_code_path = temp_file.c_str();
BOOST_LOG_TRIVIAL(trace) << "sned_job: check_access_code_path = " << check_access_code_path;
job_data._temp_path = fs::path(check_access_code_path);
}
int curr_plate_idx;
if (job_data.plate_idx >= 0)
@ -635,7 +639,7 @@ void SendMultiMachinePage::on_send(wxCommandEvent& event)
int result = m_plater->send_gcode(m_print_plate_idx, [this](int export_stage, int current, int total, bool& cancel) {
if (m_is_canceled) return;
// bool cancelled = false;
bool cancelled = false;
wxString msg = _L("Preparing print job");
//m_status_bar->update_status(msg, cancelled, 10, true);
//m_export_3mf_cancel = cancel = cancelled;
@ -734,7 +738,7 @@ bool SendMultiMachinePage::Show(bool show)
m_refresh_timer->Stop();
m_refresh_timer->SetOwner(this);
m_refresh_timer->Start(4000);
on_timer();
wxPostEvent(this, wxTimerEvent());
}
else {
m_refresh_timer->Stop();
@ -931,6 +935,7 @@ void SendMultiMachinePage::on_set_finish_mapping(wxCommandEvent& evt)
if (selection_data_arr.size() == 6) {
auto ams_colour = wxColour(wxAtoi(selection_data_arr[0]), wxAtoi(selection_data_arr[1]), wxAtoi(selection_data_arr[2]), wxAtoi(selection_data_arr[3]));
int old_filament_id = (int)wxAtoi(selection_data_arr[5]);
int ctype = 0;
std::vector<wxColour> material_cols;
@ -1142,7 +1147,7 @@ wxPanel* SendMultiMachinePage::create_page()
e.Skip();
});
m_printer_name = new Button(m_table_head_panel, _L("Device Name"), "toolbar_double_directional_arrow", wxNO_BORDER, MM_ICON_SIZE);
m_printer_name = new Button(m_table_head_panel, _L("Device Name"), "toolbar_double_directional_arrow", wxNO_BORDER, ICON_SIZE);
m_printer_name->SetBackgroundColor(head_bg);
m_printer_name->SetCornerRadius(0);
m_printer_name->SetFont(TABLE_HEAD_FONT);
@ -1164,7 +1169,7 @@ wxPanel* SendMultiMachinePage::create_page()
m_table_head_sizer->Add( 0, 0, 0, wxLEFT, FromDIP(10) );
m_table_head_sizer->Add(m_printer_name, 0, wxALIGN_CENTER_VERTICAL, 0);
m_device_status = new Button(m_table_head_panel, _L("Device Status"), "toolbar_double_directional_arrow", wxNO_BORDER, MM_ICON_SIZE);
m_device_status = new Button(m_table_head_panel, _L("Device Status"), "toolbar_double_directional_arrow", wxNO_BORDER, ICON_SIZE);
m_device_status->SetBackgroundColor(head_bg);
m_device_status->SetFont(TABLE_HEAD_FONT);
m_device_status->SetCornerRadius(0);
@ -1207,7 +1212,7 @@ wxPanel* SendMultiMachinePage::create_page()
//m_table_head_sizer->Add(m_task_status, 0, wxALIGN_CENTER_VERTICAL, 0);
m_ams = new Button(m_table_head_panel, _L("Ams Status"), "toolbar_double_directional_arrow", wxNO_BORDER, MM_ICON_SIZE, false);
m_ams = new Button(m_table_head_panel, _L("Ams Status"), "toolbar_double_directional_arrow", wxNO_BORDER, ICON_SIZE, false);
m_ams->SetBackgroundColor(head_bg);
m_ams->SetCornerRadius(0);
m_ams->SetFont(TABLE_HEAD_FONT);
@ -1228,7 +1233,7 @@ wxPanel* SendMultiMachinePage::create_page()
});
m_table_head_sizer->Add(m_ams, 0, wxALIGN_CENTER_VERTICAL, 0);
m_refresh_button = new Button(m_table_head_panel, "", "mall_control_refresh", wxNO_BORDER, MM_ICON_SIZE, false);
m_refresh_button = new Button(m_table_head_panel, "", "mall_control_refresh", wxNO_BORDER, ICON_SIZE, false);
m_refresh_button->SetBackgroundColor(head_bg);
m_refresh_button->SetCornerRadius(0);
m_refresh_button->SetFont(TABLE_HEAD_FONT);
@ -1380,6 +1385,7 @@ void SendMultiMachinePage::sync_ams_list()
BitmapCache bmcache;
MaterialHash::iterator iter = m_material_list.begin();
while (iter != m_material_list.end()) {
int id = iter->first;
Material* item = iter->second;
item->item->Destroy();
delete item;
@ -1408,6 +1414,7 @@ void SendMultiMachinePage::sync_ams_list()
item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent& e) {
MaterialHash::iterator iter = m_material_list.begin();
while (iter != m_material_list.end()) {
int id = iter->first;
Material* item = iter->second;
MaterialItem* m = item->item;
m->on_normal();
@ -1417,6 +1424,9 @@ void SendMultiMachinePage::sync_ams_list()
m_current_filament_id = extruder;
item->on_selected();
auto mouse_pos = ClientToScreen(e.GetPosition());
wxPoint rect = item->ClientToScreen(wxPoint(0, 0));
// update ams data
if (get_value_radio("use_ams")) {
if (m_mapping_popup->IsShown()) return;
@ -1646,7 +1656,7 @@ void SendMultiMachinePage::init_timer()
m_refresh_timer = new wxTimer();
}
void SendMultiMachinePage::on_timer()
void SendMultiMachinePage::on_timer(wxTimerEvent& event)
{
for (auto it = m_device_items.begin(); it != m_device_items.end(); it++) {
it->second->sync_state();

View file

@ -194,7 +194,7 @@ protected:
void on_set_finish_mapping(wxCommandEvent& evt);
void on_rename_click(wxCommandEvent& event);
void on_timer();
void on_timer(wxTimerEvent& event);
void init_timer();
private:

View file

@ -443,7 +443,7 @@ static std::string generate_system_info_json()
pt::ptree hw_node;
{
hw_node.put("ArchName", wxPlatformInfo::Get().GetBitnessName());
hw_node.put("ArchName", wxPlatformInfo::Get().GetArchName());
size_t num = std::round(Slic3r::total_physical_memory()/107374100.);
hw_node.put("RAM_GiB", std::to_string(num / 10) + "." + std::to_string(num % 10));
}

View file

@ -59,6 +59,7 @@ wxString SendToPrinterDialog::format_text(wxString &m_msg)
wxString out_txt = m_msg;
wxString count_txt = "";
int new_line_pos = 0;
for (int i = 0; i < m_msg.length(); i++) {
auto text_size = m_statictext_printer_msg->GetTextExtent(count_txt);
@ -1337,6 +1338,11 @@ void SendToPrinterDialog::set_default()
Layout();
Fit();
wxSize screenSize = wxGetDisplaySize();
auto dialogSize = this->GetSize();
// basic info
auto aprint_stats = m_plater->get_partplate_list().get_current_fff_print().print_statistics();
wxString time;

View file

@ -224,8 +224,8 @@ void NotificationManager::SlicingProgressNotification::render(GLCanvas3D& canvas
const float progress_panel_width = (m_window_width - 2 * progress_child_window_padding.x);
const float progress_panel_height = (58.0f * scale);
const float dailytips_panel_width = (m_window_width - 2 * dailytips_child_window_padding.x);
// const float gcodeviewer_height = wxGetApp().plater()->get_preview_canvas3D()->get_gcode_viewer().get_legend_height();
// const float dailytips_panel_height = std::min(380.0f * scale, std::max(90.0f, (cnv_size.get_height() - gcodeviewer_height - progress_panel_height - dailytips_child_window_padding.y - initial_y - m_line_height * 4)));
const float gcodeviewer_height = wxGetApp().plater()->get_preview_canvas3D()->get_gcode_viewer().get_legend_height();
//const float dailytips_panel_height = std::min(380.0f * scale, std::max(90.0f, (cnv_size.get_height() - gcodeviewer_height - progress_panel_height - dailytips_child_window_padding.y - initial_y - m_line_height * 4)));
const float dailytips_panel_height = 125.0f * scale;
float right_gap = right_margin + (move_from_overlay ? overlay_width + m_line_height * 5 : 0);

View file

@ -291,6 +291,7 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
});
m_button_pause_resume->Bind(wxEVT_LEAVE_WINDOW, [this](auto &e) {
auto buf = m_button_pause_resume->GetClientData();
if (m_button_pause_resume->GetToolTipText() == _L("Pause")) {
m_button_pause_resume->SetBitmap_("print_control_pause");
}
@ -2527,7 +2528,7 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
}
bool light_on = obj->chamber_light != MachineObject::LIGHT_EFFECT::LIGHT_EFFECT_OFF;
BOOST_LOG_TRIVIAL(trace) << "light: " << (light_on ? "on" : "off");
BOOST_LOG_TRIVIAL(trace) << "light: " << light_on ? "on" : "off";
if (m_switch_lamp_timeout > 0)
m_switch_lamp_timeout--;
else {
@ -2591,6 +2592,7 @@ void StatusPanel::update_ams(MachineObject *obj)
}
bool is_support_virtual_tray = obj->ams_support_virtual_tray;
bool is_support_filament_backup = obj->is_support_filament_backup;
AMSModel ams_mode = AMSModel::GENERIC_AMS;
if (obj) {
@ -2661,6 +2663,9 @@ void StatusPanel::update_ams(MachineObject *obj)
std::string curr_ams_id = m_ams_control->GetCurentAms();
std::string curr_can_id = m_ams_control->GetCurrentCan(curr_ams_id);
bool is_vt_tray = false;
if (obj->m_tray_tar == std::to_string(VIRTUAL_TRAY_ID))
is_vt_tray = true;
// set segment 1, 2
if (obj->m_tray_now == std::to_string(VIRTUAL_TRAY_ID) ) {
@ -4841,7 +4846,7 @@ wxBoxSizer *ScoreDialog::get_photo_btn_sizer() {
it = m_selected_image_list.erase(it);
}
m_image_url_paths.clear();
for (const std::pair<wxStaticBitmap *, ImageMsg> &bitmap : m_image) {
for (const auto& bitmap : m_image) {
if (bitmap.second.is_uploaded) {
if (!bitmap.second.img_url_paths.empty()) {
m_image_url_paths.push_back(bitmap.second.img_url_paths);
@ -4902,6 +4907,7 @@ wxBoxSizer *ScoreDialog::get_button_sizer()
if (m_upload_status_code == StatusCode::UPLOAD_PROGRESS) {
int need_upload_nums = need_upload_images.size();
int upload_nums = 0;
int upload_failed_nums = 0;
ProgressDialog *progress_dialog = new ProgressDialog(_L("Upload Pictrues"), _L("Number of images successfully uploaded") + ": " + std::to_string(upload_nums) + "/" + std::to_string(need_upload_nums), need_upload_nums, this);
for (std::set<std::pair<wxStaticBitmap *, wxString>>::iterator it = need_upload_images.begin(); it != need_upload_images.end();) {
std::pair<wxStaticBitmap *, wxString> need_upload = *it;

View file

@ -266,7 +266,7 @@ void Tab::create_preset_tab()
set_tooltips_text();
add_scaled_button(m_top_panel, &m_undo_btn, m_bmp_white_bullet.name());
add_scaled_button(m_top_panel, &m_undo_to_sys_btn, m_bmp_white_bullet.name());
//add_scaled_button(m_top_panel, &m_undo_to_sys_btn, m_bmp_white_bullet.name());
add_scaled_button(m_top_panel, &m_btn_search, "search");
m_btn_search->SetToolTip(_L("Search in preset"));
@ -347,7 +347,7 @@ void Tab::create_preset_tab()
});
m_undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_roll_back_value(); }));
m_undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_roll_back_value(true); }));
//m_undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_roll_back_value(true); }));
/* m_search_btn->Bind(wxEVT_BUTTON, [](wxCommandEvent) { wxGetApp().plater()->search(false); });*/
// Colors for ui "decoration"
@ -468,14 +468,7 @@ void Tab::create_preset_tab()
// so that the cursor jumps to the last item.
// BBS: bold selection
m_tabctrl->Bind(wxEVT_TAB_SEL_CHANGING, [this](wxCommandEvent& event) {
if (m_disable_tree_sel_changed_event)
return;
const auto sel_item = m_tabctrl->GetSelection();
//OutputDebugStringA("wxEVT_TAB_SEL_CHANGING ");
//OutputDebugStringA(m_title.c_str());
//const auto selection = sel_item >= 0 ? m_tabctrl->GetItemText(sel_item) : "";
//OutputDebugString(selection);
//OutputDebugStringA("\n");
m_tabctrl->SetItemBold(sel_item, false);
});
m_tabctrl->Bind(wxEVT_TAB_SEL_CHANGED, [this](wxCommandEvent& event) {
@ -1034,10 +1027,10 @@ void Tab::update_undo_buttons()
{
// BBS: restore all pages in preset
m_undo_btn-> SetBitmap_(m_presets->get_edited_preset().is_dirty ? m_bmp_value_revert: m_bmp_white_bullet);
m_undo_to_sys_btn-> SetBitmap_(m_is_nonsys_values ? *m_bmp_non_system : m_bmp_value_lock);
//m_undo_to_sys_btn-> SetBitmap_(m_is_nonsys_values ? *m_bmp_non_system : m_bmp_value_lock);
m_undo_btn->SetToolTip(m_presets->get_edited_preset().is_dirty ? _L("Click to reset all settings to the last saved preset.") : m_ttg_white_bullet);
m_undo_to_sys_btn->SetToolTip(m_is_nonsys_values ? *m_ttg_non_system : m_ttg_value_lock);
//m_undo_to_sys_btn->SetToolTip(m_is_nonsys_values ? *m_ttg_non_system : m_ttg_value_lock);
}
void Tab::on_roll_back_value(const bool to_sys /*= true*/)
@ -1222,7 +1215,7 @@ void Tab::msw_rescale()
// recreate and set new ImageList for tree_ctrl
m_icons->RemoveAll();
m_icons = new wxImageList(m_scaled_icons_list.front().bmp().GetWidth(), m_scaled_icons_list.front().bmp().GetHeight(), false);
// for (ScalableBitmap& bmp : m_scaled_icons_list)
for (ScalableBitmap& bmp : m_scaled_icons_list)
//m_icons->Add(bmp.bmp());
m_tabctrl->AssignImageList(m_icons);
@ -1256,7 +1249,7 @@ void Tab::sys_color_changed()
// recreate and set new ImageList for tree_ctrl
m_icons->RemoveAll();
m_icons = new wxImageList(m_scaled_icons_list.front().bmp().GetWidth(), m_scaled_icons_list.front().bmp().GetHeight(), false);
// for (ScalableBitmap& bmp : m_scaled_icons_list)
for (ScalableBitmap& bmp : m_scaled_icons_list)
//m_icons->Add(bmp.bmp());
m_tabctrl->AssignImageList(m_icons);
@ -1617,6 +1610,19 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
}
}
// -1 means caculate all
auto update_flush_volume = [](int idx = -1) {
if (idx < 0) {
size_t filament_size = wxGetApp().plater()->get_extruder_colors_from_plater_config().size();
for (size_t i = 0; i < filament_size; ++i)
wxGetApp().plater()->sidebar().auto_calc_flushing_volumes(i);
}
else
wxGetApp().plater()->sidebar().auto_calc_flushing_volumes(idx);
};
string opt_key_without_idx = opt_key.substr(0, opt_key.find('#'));
if (opt_key_without_idx == "long_retractions_when_cut") {
@ -1997,23 +2003,23 @@ void TabPrint::build()
auto page = add_options_page(L("Quality"), "custom-gcode_quality"); // ORCA: icon only visible on placeholders
auto optgroup = page->new_optgroup(L("Layer height"), L"param_layer_height");
optgroup->append_single_option_line("layer_height");
optgroup->append_single_option_line("initial_layer_print_height");
optgroup->append_single_option_line("layer_height","quality_settings_layer_height");
optgroup->append_single_option_line("initial_layer_print_height","quality_settings_layer_height");
optgroup = page->new_optgroup(L("Line width"), L"param_line_width");
optgroup->append_single_option_line("line_width");
optgroup->append_single_option_line("initial_layer_line_width");
optgroup->append_single_option_line("outer_wall_line_width");
optgroup->append_single_option_line("inner_wall_line_width");
optgroup->append_single_option_line("top_surface_line_width");
optgroup->append_single_option_line("sparse_infill_line_width");
optgroup->append_single_option_line("internal_solid_infill_line_width");
optgroup->append_single_option_line("support_line_width");
optgroup->append_single_option_line("line_width","quality_settings_line_width");
optgroup->append_single_option_line("initial_layer_line_width","quality_settings_line_width");
optgroup->append_single_option_line("outer_wall_line_width","quality_settings_line_width");
optgroup->append_single_option_line("inner_wall_line_width","quality_settings_line_width");
optgroup->append_single_option_line("top_surface_line_width","quality_settings_line_width");
optgroup->append_single_option_line("sparse_infill_line_width","quality_settings_line_width");
optgroup->append_single_option_line("internal_solid_infill_line_width","quality_settings_line_width");
optgroup->append_single_option_line("support_line_width","quality_settings_line_width");
optgroup = page->new_optgroup(L("Seam"), L"param_seam");
optgroup->append_single_option_line("seam_position", "seam");
optgroup->append_single_option_line("staggered_inner_seams", "seam");
optgroup->append_single_option_line("seam_gap","seam");
optgroup->append_single_option_line("seam_position", "quality_settings_seam");
optgroup->append_single_option_line("staggered_inner_seams", "quality_settings_seam");
optgroup->append_single_option_line("seam_gap","quality_settings_seam");
optgroup->append_single_option_line("seam_slope_type", "seam#scarf-joint-seam");
optgroup->append_single_option_line("seam_slope_conditional", "seam#scarf-joint-seam");
optgroup->append_single_option_line("scarf_angle_threshold", "seam#scarf-joint-seam");
@ -2025,10 +2031,10 @@ void TabPrint::build()
optgroup->append_single_option_line("seam_slope_steps", "seam#scarf-joint-seam");
optgroup->append_single_option_line("scarf_joint_flow_ratio", "seam#scarf-joint-seam");
optgroup->append_single_option_line("seam_slope_inner_walls", "seam#scarf-joint-seam");
optgroup->append_single_option_line("role_based_wipe_speed","seam");
optgroup->append_single_option_line("wipe_speed", "seam");
optgroup->append_single_option_line("wipe_on_loops","seam");
optgroup->append_single_option_line("wipe_before_external_loop","seam");
optgroup->append_single_option_line("role_based_wipe_speed","quality_settings_seam");
optgroup->append_single_option_line("wipe_speed", "quality_settings_seam");
optgroup->append_single_option_line("wipe_on_loops","quality_settings_seam");
optgroup->append_single_option_line("wipe_before_external_loop","quality_settings_seam");
optgroup = page->new_optgroup(L("Precision"), L"param_precision");
@ -2601,6 +2607,8 @@ void TabPrintModel::update_model_config()
// Reset m_config manually because there's no corresponding config in m_parent_tab->m_config
for (auto plate_item : m_object_configs) {
const DynamicPrintConfig& plate_config = plate_item.second->get();
BedType plate_bed_type = (BedType)0;
PrintSequence plate_print_seq = (PrintSequence)0;
if (!plate_config.has("curr_bed_type")) {
// same as global
DynamicConfig& global_cfg = wxGetApp().preset_bundle->project_config;
@ -2911,6 +2919,7 @@ void TabPrintPlate::on_value_change(const std::string& opt_key, const boost::any
void TabPrintPlate::notify_changed(ObjectBase* object)
{
auto plate = dynamic_cast<PartPlate*>(object);
auto objects_list = wxGetApp().obj_list();
wxDataViewItemArray items;
objects_list->GetSelections(items);
@ -3455,8 +3464,6 @@ void TabFilament::build()
optgroup->append_single_option_line("filament_loading_speed", "semm");
optgroup->append_single_option_line("filament_unloading_speed_start", "semm");
optgroup->append_single_option_line("filament_unloading_speed", "semm");
optgroup->append_single_option_line("filament_load_time", "semm");
optgroup->append_single_option_line("filament_unload_time", "semm");
optgroup->append_single_option_line("filament_toolchange_delay", "semm");
optgroup->append_single_option_line("filament_cooling_moves", "semm");
optgroup->append_single_option_line("filament_cooling_initial_speed", "semm");
@ -3599,10 +3606,9 @@ void TabFilament::toggle_options()
if (m_active_page->title() == L("Multimaterial")) {
// Orca: hide specific settings for BBL printers
for (auto el :
{"filament_minimal_purge_on_wipe_tower", "filament_loading_speed_start", "filament_loading_speed",
"filament_unloading_speed_start", "filament_unloading_speed", "filament_load_time", "filament_unload_time",
"filament_toolchange_delay", "filament_cooling_moves", "filament_cooling_initial_speed", "filament_cooling_final_speed"})
for (auto el : {"filament_minimal_purge_on_wipe_tower", "filament_loading_speed_start", "filament_loading_speed",
"filament_unloading_speed_start", "filament_unloading_speed", "filament_toolchange_delay", "filament_cooling_moves",
"filament_cooling_initial_speed", "filament_cooling_final_speed"})
toggle_option(el, !is_BBL_printer);
}
}
@ -3759,8 +3765,6 @@ void TabPrinter::build_fff()
optgroup->append_single_option_line("use_relative_e_distances");
optgroup->append_single_option_line("use_firmware_retraction");
// optgroup->append_single_option_line("spaghetti_detector");
optgroup->append_single_option_line("machine_load_filament_time");
optgroup->append_single_option_line("machine_unload_filament_time");
optgroup->append_single_option_line("time_cost");
optgroup = page->new_optgroup(L("Cooling Fan"), "param_cooling_fan");
@ -4215,6 +4219,11 @@ if (is_marlin_flavor)
optgroup->append_single_option_line("parking_pos_retraction", "semm");
optgroup->append_single_option_line("extra_loading_move", "semm");
optgroup->append_single_option_line("high_current_on_filament_swap", "semm");
optgroup = page->new_optgroup(L("Advanced"), L"param_advanced");
optgroup->append_single_option_line("machine_load_filament_time");
optgroup->append_single_option_line("machine_unload_filament_time");
optgroup->append_single_option_line("machine_tool_change_time");
m_pages.insert(m_pages.end() - n_after_single_extruder_MM, page);
}
@ -4461,9 +4470,8 @@ void TabPrinter::toggle_options()
if (m_active_page->title() == L("Basic information")) {
// SoftFever: hide BBL specific settings
for (auto el :
{"scan_first_layer", "machine_load_filament_time", "machine_unload_filament_time", "bbl_calib_mark_logo", "bbl_use_printhost"})
toggle_line(el, is_BBL_printer);
for (auto el : {"scan_first_layer", "bbl_calib_mark_logo", "bbl_use_printhost"})
toggle_line(el, is_BBL_printer);
// SoftFever: hide non-BBL settings
for (auto el : {"use_firmware_retraction", "use_relative_e_distances", "support_multi_bed_types", "pellet_modded_printer"})
@ -4749,19 +4757,28 @@ void Tab::rebuild_page_tree()
// To avoid redundant clear/activate functions call
// suppress activate page before page_tree rebuilding
m_disable_tree_sel_changed_event = true;
m_tabctrl->DeleteAllItems();
int curr_item = 0;
for (auto p : m_pages)
{
if (!p->get_show())
continue;
auto itemId = m_tabctrl->AppendItem(translate_category(p->title(), m_type), p->iconID());
m_tabctrl->SetItemTextColour(itemId, p->get_item_colour() == m_modified_label_clr ? p->get_item_colour() : StateColor(
if (m_tabctrl->GetCount() <= curr_item) {
m_tabctrl->AppendItem(translate_category(p->title(), m_type), p->iconID());
} else {
m_tabctrl->SetItemText(curr_item, translate_category(p->title(), m_type));
}
m_tabctrl->SetItemTextColour(curr_item, p->get_item_colour() == m_modified_label_clr ? p->get_item_colour() : StateColor(
std::make_pair(0x6B6B6C, (int) StateColor::NotChecked),
std::make_pair(p->get_item_colour(), (int) StateColor::Normal)));
if (translate_category(p->title(), m_type) == selected)
item = itemId;
item = curr_item;
curr_item++;
}
while (m_tabctrl->GetCount() > curr_item) {
m_tabctrl->DeleteItem(m_tabctrl->GetCount() - 1);
}
// BBS: on mac, root is selected, this fix it
m_tabctrl->Unselect();
// BBS: not select on hide tab
@ -4773,14 +4790,14 @@ void Tab::rebuild_page_tree()
if (sel_item == m_last_select_item)
m_last_select_item = item;
else
m_last_select_item = 0;
m_last_select_item = NULL;
// allow activate page before selection of a page_tree item
m_disable_tree_sel_changed_event = false;
//BBS: GUI refactor
if (item >= 0)
{
update_current_page_in_background(item);
bool ret = update_current_page_in_background(item);
//if m_active_page is changed in update_current_page_in_background
//will just update the selected item of the treectrl
if (m_parent->is_active_and_shown_tab(this)) // FIX: modify state not update
@ -5276,10 +5293,10 @@ bool Tab::update_current_page_in_background(int& item)
// clear pages from the controlls
// BBS: fix after new layout, clear page in backgroud
if (m_parent->is_active_and_shown_tab((wxPanel*)this))
m_parent->clear_page();
for (auto p : m_pages)
p->clear();
if (m_parent->is_active_and_shown_tab((wxPanel*)this))
m_parent->clear_page();
update_undo_buttons();
@ -5600,6 +5617,7 @@ void Tab::delete_preset()
if (m_presets->get_preset_base(current_preset) == &current_preset) { //root preset
is_base_preset = true;
if (current_preset.type == Preset::Type::TYPE_PRINTER && !current_preset.is_system) { //Customize third-party printers
Preset &current_preset = m_presets->get_selected_preset();
int filament_preset_num = 0;
int process_preset_num = 0;
for (const Preset &preset : m_preset_bundle->filaments.get_presets()) {
@ -5863,6 +5881,7 @@ wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent)
sizer->Add(btn, 0, wxALIGN_CENTER_VERTICAL);
btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) {
bool is_configed_by_BBL = PresetUtils::system_printer_bed_model(m_preset_bundle->printers.get_edited_preset()).size() > 0;
BedShapeDialog dlg(this);
dlg.build_dialog(*m_config->option<ConfigOptionPoints>("printable_area"),
*m_config->option<ConfigOptionString>("bed_custom_texture"),

View file

@ -198,6 +198,8 @@ public:
// check that only the selected page is visible and others are hidden:
for (size_t page = 0; page < m_pages.size(); page++) {
wxWindow* win_a = GetPage(page);
wxWindow* win_b = GetPage(n);
if (page != n && GetPage(page) != GetPage(n)) {
m_pages[page]->Hide();
}

View file

@ -1654,7 +1654,7 @@ void UnsavedChangesDialog::update_tree(Preset::Type type, PresetCollection* pres
const DynamicPrintConfig& new_config = presets->get_edited_preset().config;
type = presets->type();
// const std::map<wxString, std::string>& category_icon_map = wxGetApp().get_tab(type)->get_category_icon_map();
const std::map<wxString, std::string>& category_icon_map = wxGetApp().get_tab(type)->get_category_icon_map();
//m_tree->model->AddPreset(type, from_u8(presets->get_edited_preset().name), old_pt);

View file

@ -24,11 +24,12 @@
namespace Slic3r {
namespace GUI {
// Orca: Replace static char* with macro defs
// currently disabled until needed
// #define URL_CHANGELOG "%1%"
// #define URL_DOWNLOAD "%1%"
// #define URL_DEV "%1%"
static const char* URL_CHANGELOG = "%1%";
static const char* URL_DOWNLOAD = "%1%";
static const char* URL_DEV = "%1%";
static const std::string CONFIG_UPDATE_WIKI_URL("");
// MsgUpdateSlic3r

View file

@ -670,6 +670,8 @@ void MachineInfoPanel::update_ams_ext(MachineObject *obj)
show_ams(true);
std::map<int, MachineObject::ModuleVersionInfo> ver_list = obj->get_ams_version();
AmsPanelHash::iterator iter = m_amspanel_list.begin();
for (auto i = 0; i < m_amspanel_list.GetCount(); i++) {
AmsPanel* amspanel = m_amspanel_list[i];
amspanel->Hide();

View file

@ -25,6 +25,7 @@ void UserManager::set_agent(NetworkAgent* agent)
int UserManager::parse_json(std::string payload)
{
bool restored_json = false;
json j;
json j_pre = json::parse(payload);
if (j_pre.empty()) {

View file

@ -1,17 +1,27 @@
#include "WebDownPluginDlg.hpp"
#include "ConfigWizard.hpp"
#include <string.h>
#include "I18N.hpp"
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "libslic3r_version.h"
#include <wx/sizer.h>
#include <wx/toolbar.h>
#include <wx/textdlg.h>
#include <wx/wx.h>
#include <wx/fileconf.h>
#include <wx/file.h>
#include <wx/wfstream.h>
#include <boost/cast.hpp>
#include <boost/lexical_cast.hpp>
#include "MainFrame.hpp"
#include <boost/dll.hpp>
#include <slic3r/GUI/Widgets/WebView.hpp>
#include <slic3r/Utils/Http.hpp>
#include <libslic3r/miniz_extension.hpp>
@ -217,7 +227,7 @@ void DownPluginFrame::OnScriptMessage(wxWebViewEvent &evt)
auto plugin_folder = (boost::filesystem::path(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data()) / "plugins").make_preferred().string();
desktop_open_any_folder(plugin_folder);
}
} catch (std::exception&) {
} catch (std::exception &) {
// wxMessageBox(e.what(), "json Exception", MB_OK);
}
}

View file

@ -858,7 +858,7 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle
const std::map<std::string, std::set<std::string>>& model_maps = config->second;
//for (const auto& vendor_profile : preset_bundle->vendors) {
for (const auto model_it: model_maps) {
for (const auto& model_it: model_maps) {
if (model_it.second.size() > 0) {
variant = *model_it.second.begin();
const auto config_old = old_enabled_vendors.find(bundle_name);
@ -893,13 +893,13 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle
}
std::string first_added_filament;
/*auto get_first_added_material_preset = [this, app_config](const std::string& section_name, std::string& first_added_preset) {
auto get_first_added_material_preset = [this, app_config](const std::string& section_name, std::string& first_added_preset) {
if (m_appconfig_new.has_section(section_name)) {
// get first of new added preset names
const std::map<std::string, std::string>& old_presets = app_config->has_section(section_name) ? app_config->get_section(section_name) : std::map<std::string, std::string>();
first_added_preset = get_first_added_preset(old_presets, m_appconfig_new.get_section(section_name));
}
};*/
};
// Not switch filament
//get_first_added_material_preset(AppConfig::SECTION_FILAMENTS, first_added_filament);
@ -960,6 +960,7 @@ bool GuideFrame::run()
BOOST_LOG_TRIVIAL(info) << "GuideFrame cancelled";
if (app.preset_bundle->printers.only_default_printers()) {
//we install the default here
bool apply_keeped_changes = false;
//clear filament section and use default materials
app.app_config->set_variant(PresetBundle::BBL_BUNDLE,
PresetBundle::BBL_DEFAULT_PRINTER_MODEL, PresetBundle::BBL_DEFAULT_PRINTER_VARIANT, "true");
@ -1139,7 +1140,7 @@ int GuideFrame::LoadProfile()
wxString strVendor = from_u8(iter->path().string()).BeforeLast('.');
strVendor = strVendor.AfterLast( '\\');
strVendor = strVendor.AfterLast('/');
strVendor = strVendor.AfterLast('\/');
wxString strExtension = from_u8(iter->path().string()).AfterLast('.').Lower();
if (w2s(strVendor) == PresetBundle::BBL_BUNDLE && strExtension.CmpNoCase("json") == 0)
@ -1158,7 +1159,7 @@ int GuideFrame::LoadProfile()
//cout << iter->path().string() << endl;
wxString strVendor = from_u8(iter->path().string()).BeforeLast('.');
strVendor = strVendor.AfterLast( '\\');
strVendor = strVendor.AfterLast('/');
strVendor = strVendor.AfterLast('\/');
wxString strExtension = from_u8(iter->path().string()).AfterLast('.').Lower();
if (w2s(strVendor) != PresetBundle::BBL_BUNDLE && strExtension.CmpNoCase("json")==0)
@ -1543,6 +1544,9 @@ int GuideFrame::LoadProfileFamily(std::string strVendor, std::string strFilePath
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "Vendor: " << strVendor <<", tFilaList Add: " << s1;
}
int nFalse = 0;
int nModel = 0;
int nFinish = 0;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got %1% filaments") % nsize;
for (int n = 0; n < nsize; n++) {
json OneFF = pFilament.at(n);
@ -1652,7 +1656,7 @@ std::string GuideFrame::w2s(wxString sSrc)
void GuideFrame::GetStardardFilePath(std::string &FilePath) {
StrReplace(FilePath, "\\", w2s(wxString::Format("%c", boost::filesystem::path::preferred_separator)));
StrReplace(FilePath, "/", w2s(wxString::Format("%c", boost::filesystem::path::preferred_separator)));
StrReplace(FilePath, "\/", w2s(wxString::Format("%c", boost::filesystem::path::preferred_separator)));
}
bool GuideFrame::LoadFile(std::string jPath, std::string &sContent)

View file

@ -3,6 +3,7 @@
#include <string.h>
#include "I18N.hpp"
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "libslic3r_version.h"
@ -12,9 +13,11 @@
#include <wx/wx.h>
#include <wx/fileconf.h>
#include <wx/file.h>
#include <wx/wfstream.h>
#include <boost/cast.hpp>
#include <boost/lexical_cast.hpp>
#include <nlohmann/json.hpp>
#include "MainFrame.hpp"

Some files were not shown because too many files have changed in this diff Show more