mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-27 19:01:02 +00:00
Merge branch 'main' into pr/tommasobbianchi/15238
This commit is contained in:
@@ -437,7 +437,7 @@ wxBoxSizer* AMSDryCtrWin::create_normal_state_panel(wxPanel* parent)
|
||||
m_temperature_input = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, wxSize(FromDIP(80), -1));
|
||||
m_temperature_input->SetMaxLength(3); // Limit to 3 digits
|
||||
|
||||
m_temperature_input->Bind(wxEVT_CHAR, [this](wxKeyEvent& event) {
|
||||
m_temperature_input->Bind(wxEVT_CHAR, [](wxKeyEvent& event) {
|
||||
int keycode = event.GetKeyCode();
|
||||
if (keycode >= '0' && keycode <= '9') {
|
||||
event.Skip();
|
||||
@@ -464,7 +464,7 @@ wxBoxSizer* AMSDryCtrWin::create_normal_state_panel(wxPanel* parent)
|
||||
m_time_input = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, wxSize(FromDIP(100), -1));
|
||||
m_time_input->SetMaxLength(3); // Limit to 3 digits
|
||||
|
||||
m_time_input->Bind(wxEVT_CHAR, [this](wxKeyEvent& event) {
|
||||
m_time_input->Bind(wxEVT_CHAR, [](wxKeyEvent& event) {
|
||||
int keycode = event.GetKeyCode();
|
||||
if (keycode >= '0' && keycode <= '9') {
|
||||
event.Skip();
|
||||
@@ -698,7 +698,7 @@ wxBoxSizer* AMSDryCtrWin::create_guide_info_section(wxPanel* parent)
|
||||
m_rotate_spool_toggle = new wxCheckBox(parent, wxID_ANY, "");
|
||||
m_rotate_spool_toggle->SetValue(false);
|
||||
|
||||
m_rotate_spool_toggle->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& event) {
|
||||
m_rotate_spool_toggle->Bind(wxEVT_CHECKBOX, [](wxCommandEvent& event) {
|
||||
bool is_checked = event.IsChecked();
|
||||
// Add toggle behavior logic here
|
||||
});
|
||||
@@ -1511,6 +1511,10 @@ void AMSDryCtrWin::update_filament_guide_info(DevAms* dev_ams)
|
||||
m_temperature_input->GetValue().ToLong(&input_temp);
|
||||
bool can_start = true;
|
||||
|
||||
// "GFA00" is Bambu's PLA id; GetFilamentDryingPreset is keyed by our OF ids.
|
||||
auto* agent = wxGetApp().getAgent();
|
||||
const std::string pla_filament_id = agent ? agent->to_orca_filament_id("GFA00") : std::string("GFA00");
|
||||
|
||||
int slot_count = 0, empty_count = 0;
|
||||
for (auto& tray_pair : dev_ams->GetTrays()) {
|
||||
if (!tray_pair.second) {
|
||||
@@ -1526,13 +1530,15 @@ void AMSDryCtrWin::update_filament_guide_info(DevAms* dev_ams)
|
||||
wxString filament_type = tray_pair.second->get_display_filament_type();
|
||||
DevFilamentDryingPreset preset;
|
||||
if (filament_type.IsEmpty()) {
|
||||
auto fallback_preset = DevUtilBackend::GetFilamentDryingPreset("GFA00");
|
||||
auto fallback_preset = DevUtilBackend::GetFilamentDryingPreset(pla_filament_id);
|
||||
if (!fallback_preset) continue; // no PLA preset (e.g. the id map is missing): skip, don't throw
|
||||
preset = fallback_preset.value();
|
||||
filament_type = "?";
|
||||
} else if (preset_opt.has_value()) {
|
||||
preset = preset_opt.value();
|
||||
} else {
|
||||
auto fallback_preset = DevUtilBackend::GetFilamentDryingPreset("GFA00");
|
||||
auto fallback_preset = DevUtilBackend::GetFilamentDryingPreset(pla_filament_id);
|
||||
if (!fallback_preset) continue;
|
||||
preset = fallback_preset.value();
|
||||
}
|
||||
std::string icon_path = "dev_ams_dry_ctr_enable";
|
||||
@@ -1594,39 +1600,21 @@ int AMSDryCtrWin::update_filament_list(DevAms* dev_ams, MachineObject* obj)
|
||||
}
|
||||
stream << std::fixed << std::setprecision(1) << obj->GetExtderSystem()->GetNozzleDiameter(extruder_id);
|
||||
std::string nozzle_diameter_str = stream.str();
|
||||
std::set<std::string> printer_names = preset_bundle->get_printer_names_by_printer_type_and_nozzle(
|
||||
DevPrinterConfigUtil::get_printer_display_name(obj->printer_type), nozzle_diameter_str);
|
||||
|
||||
for (auto filament_it = filaments.begin(); filament_it != filaments.end(); ++filament_it) {
|
||||
Preset& preset = *filament_it;
|
||||
// Filter by system preset: root preset and (system preset or user preset is supported)
|
||||
if (filaments.get_preset_base(*filament_it) != &preset || (!filament_it->is_system && !obj->is_support_user_preset)) {
|
||||
for (Preset *filament_it : preset_bundle->get_filament_presets_for_machine(
|
||||
DevPrinterConfigUtil::get_printer_display_name(obj->printer_type), nozzle_diameter_str, obj->is_support_user_preset)) {
|
||||
if (!filament_id_set.insert(filament_it->filament_id).second)
|
||||
continue;
|
||||
const std::string filament_alias = filaments.get_preset_alias(*filament_it, true);
|
||||
if (filament_alias.empty())
|
||||
continue;
|
||||
auto opt_info = preset_bundle->get_filament_by_filament_id(filament_it->filament_id);
|
||||
if (!opt_info.has_value())
|
||||
continue;
|
||||
}
|
||||
|
||||
ConfigOption * printer_opt = filament_it->config.option("compatible_printers");
|
||||
ConfigOptionStrings *printer_strs = dynamic_cast<ConfigOptionStrings *>(printer_opt);
|
||||
if (!printer_strs) continue;
|
||||
|
||||
for (auto printer_str : printer_strs->values) {
|
||||
if (printer_names.find(printer_str) != printer_names.end()) {
|
||||
if (filament_id_set.find(filament_it->filament_id) != filament_id_set.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
filament_id_set.insert(filament_it->filament_id);
|
||||
auto filament_alias = filaments.get_preset_alias(*filament_it, true);
|
||||
if (!filament_alias.empty()) {
|
||||
auto opt_info = preset_bundle->get_filament_by_filament_id(filament_it->filament_id);
|
||||
if (opt_info.has_value()) {
|
||||
auto real_info = opt_info.value();
|
||||
real_info.filament_name = filament_alias;
|
||||
m_tray_ids.push_back(std::move(real_info));
|
||||
m_trays_combo->Append(wxString::FromUTF8(filament_alias));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opt_info->filament_name = filament_alias;
|
||||
m_tray_ids.push_back(std::move(*opt_info));
|
||||
m_trays_combo->Append(wxString::FromUTF8(filament_alias));
|
||||
}
|
||||
|
||||
if (m_tray_ids.empty()) {
|
||||
@@ -1701,9 +1689,10 @@ int AMSDryCtrWin::update_filament_list(DevAms* dev_ams, MachineObject* obj)
|
||||
|
||||
// Select recommended drying temperature and default filament
|
||||
float min_dry_temp = std::numeric_limits<float>::max();
|
||||
std::string default_filament_id = "GFA00";
|
||||
auto* agent = wxGetApp().getAgent();
|
||||
std::string default_filament_id = agent ? agent->to_orca_filament_id("GFA00") : std::string("GFA00"); // compared against m_tray_ids[i].filament_id (our OF ids) below
|
||||
bool has_ready = false;
|
||||
const auto fallback_preset = DevUtilBackend::GetFilamentDryingPreset("GFA00");
|
||||
const auto fallback_preset = DevUtilBackend::GetFilamentDryingPreset(default_filament_id);
|
||||
for (const auto& tray_pair : dev_ams->GetTrays()) {
|
||||
if (!tray_pair.second || !tray_pair.second->is_tray_info_ready()) continue;
|
||||
has_ready = true;
|
||||
|
||||
@@ -55,7 +55,6 @@ private:
|
||||
|
||||
Label* m_text_label;
|
||||
wxStaticBitmap* m_icon_bitmap;
|
||||
int m_target_size;
|
||||
std::string m_icon_name;
|
||||
ScalableBitmap m_icon;
|
||||
};
|
||||
|
||||
@@ -681,6 +681,19 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
|
||||
}
|
||||
|
||||
|
||||
// Orca: log the tray payload this dialog hands the printer, so the filament_id resolved from the
|
||||
// dropdown selection can be checked against the tray_info_idx the AMS actually receives. A
|
||||
// BBL-tagged (RFID) tray is read-only here, so nothing is published for it.
|
||||
BOOST_LOG_TRIVIAL(info) << "ams_materials_setting: " << (m_is_third ? "sending" : "NOT sending (BBL RFID tray, read-only)")
|
||||
<< ", ams_id = " << ams_id << ", slot_id = " << slot_id
|
||||
<< ", selected = " << m_comboBox_filament->GetValue().ToStdString()
|
||||
<< ", tray_info_idx (filament_id) = " << ams_filament_id
|
||||
<< ", setting_id = " << ams_setting_id
|
||||
<< ", tray_type = " << m_filament_type
|
||||
<< ", tray_color = " << col_buf
|
||||
<< ", nozzle_temp_min = " << nozzle_temp_min_int
|
||||
<< ", nozzle_temp_max = " << nozzle_temp_max_int;
|
||||
|
||||
// set filament
|
||||
if (m_is_third) {
|
||||
obj->command_ams_filament_settings(ams_id, slot_id, ams_filament_id, ams_setting_id, std::string(col_buf), m_filament_type, nozzle_temp_min_int, nozzle_temp_max_int);
|
||||
@@ -802,7 +815,10 @@ void AMSMaterialsSetting::set_color(wxColour color)
|
||||
fila_color.m_colors.insert(color);
|
||||
fila_color.EndSet(m_clr_picker->ctype);
|
||||
auto clr_query = GUI::wxGetApp().get_filament_color_code_query();
|
||||
m_clr_name->SetLabelText(clr_query->GetFilaColorName(ams_filament_id, fila_color));
|
||||
// ams_filament_id is our OF id; GetFilaColorName looks up filaments_color_codes.json,
|
||||
// downloaded from Bambu and keyed by the printer's own ids, so translate for this lookup only.
|
||||
auto* agent = GUI::wxGetApp().getAgent();
|
||||
m_clr_name->SetLabelText(clr_query->GetFilaColorName(agent ? agent->from_orca_filament_id(ams_filament_id) : ams_filament_id, fila_color));
|
||||
}
|
||||
|
||||
void AMSMaterialsSetting::set_empty_color(wxColour color)
|
||||
@@ -823,7 +839,10 @@ void AMSMaterialsSetting::set_colors(std::vector<wxColour> colors)
|
||||
for (const auto& clr : colors) { fila_color.m_colors.insert(clr); }
|
||||
fila_color.EndSet(m_clr_picker->ctype);
|
||||
auto clr_query = GUI::wxGetApp().get_filament_color_code_query();
|
||||
m_clr_name->SetLabelText(clr_query->GetFilaColorName(ams_filament_id, fila_color));
|
||||
// ams_filament_id is our OF id; GetFilaColorName looks up filaments_color_codes.json,
|
||||
// downloaded from Bambu and keyed by the printer's own ids, so translate for this lookup only.
|
||||
auto* agent = GUI::wxGetApp().getAgent();
|
||||
m_clr_name->SetLabelText(clr_query->GetFilaColorName(agent ? agent->from_orca_filament_id(ams_filament_id) : ams_filament_id, fila_color));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -932,7 +951,6 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
||||
m_input_k_val->GetTextCtrl()->SetValue(k);
|
||||
m_input_n_val->GetTextCtrl()->SetValue(n);
|
||||
|
||||
int idx = 0;
|
||||
wxArrayString filament_items;
|
||||
wxString bambu_filament_name;
|
||||
wxString hint_filament_name; // the hint type to be selected
|
||||
@@ -940,6 +958,9 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
||||
std::unordered_map<wxString, wxString> query_filament_types; //
|
||||
|
||||
std::set<std::string> filament_id_set;
|
||||
// The alias keyed map has to start empty: it is a member, so a stale alias left by an earlier
|
||||
// popup (a different printer, a different nozzle) would resolve to that printer's filament_id.
|
||||
map_filament_items.clear();
|
||||
PresetBundle * preset_bundle = wxGetApp().preset_bundle;
|
||||
std::ostringstream stream;
|
||||
// Defensive: this dialog is opened only from StatusPanel (BBL-only) today, so the fallback fires
|
||||
@@ -952,83 +973,48 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
||||
}
|
||||
stream << std::fixed << std::setprecision(1) << machine_diameter;
|
||||
std::string nozzle_diameter_str = stream.str();
|
||||
std::set<std::string> printer_names = preset_bundle->get_printer_names_by_printer_type_and_nozzle(DevPrinterConfigUtil::get_printer_display_name(obj->printer_type), nozzle_diameter_str);
|
||||
|
||||
if (preset_bundle) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "system_preset_bundle filament number=" << preset_bundle->filaments.size();
|
||||
for (auto filament_it = preset_bundle->filaments.begin(); filament_it != preset_bundle->filaments.end(); filament_it++) {
|
||||
//filter by system preset
|
||||
Preset& preset = *filament_it;
|
||||
/*The situation where the user preset is not displayed is as follows:
|
||||
1. Not a root preset
|
||||
2. Not system preset and the printer firmware does not support user preset */
|
||||
if (preset_bundle->filaments.get_preset_base(*filament_it) != &preset || (!filament_it->is_system && !obj->is_support_user_preset)) {
|
||||
for (Preset *filament_it : preset_bundle->get_filament_presets_for_machine(
|
||||
DevPrinterConfigUtil::get_printer_display_name(obj->printer_type), nozzle_diameter_str, obj->is_support_user_preset)) {
|
||||
if (!filament_id_set.insert(filament_it->filament_id).second)
|
||||
continue;
|
||||
const std::string alias = preset_bundle->filaments.get_preset_alias(*filament_it, true);
|
||||
if (alias.empty())
|
||||
continue;
|
||||
}
|
||||
|
||||
ConfigOption * printer_opt = filament_it->config.option("compatible_printers");
|
||||
ConfigOptionStrings *printer_strs = dynamic_cast<ConfigOptionStrings *>(printer_opt);
|
||||
for (auto printer_str : printer_strs->values) {
|
||||
if (printer_names.find(printer_str) != printer_names.end()) {
|
||||
if (filament_id_set.find(filament_it->filament_id) != filament_id_set.end()) {
|
||||
continue;
|
||||
} else {
|
||||
filament_id_set.insert(filament_it->filament_id);
|
||||
// name matched
|
||||
if (filament_it->is_system) {
|
||||
filament_items.push_back(filament_it->alias);
|
||||
_collect_filament_info(filament_it->alias, preset, query_filament_vendors, query_filament_types);
|
||||
filament_items.push_back(alias);
|
||||
_collect_filament_info(alias, *filament_it, query_filament_vendors, query_filament_types);
|
||||
|
||||
FilamentInfos filament_infos;
|
||||
filament_infos.filament_id = filament_it->filament_id;
|
||||
filament_infos.setting_id = filament_it->setting_id;
|
||||
map_filament_items[filament_it->alias] = filament_infos;
|
||||
} else {
|
||||
char target = '@';
|
||||
size_t pos = filament_it->name.find(target);
|
||||
if (pos != std::string::npos) {
|
||||
std::string user_preset_alias = filament_it->name.substr(0, pos - 1);
|
||||
wxString wx_user_preset_alias = wxString(user_preset_alias.c_str(), wxConvUTF8);
|
||||
user_preset_alias = wx_user_preset_alias.ToStdString();
|
||||
FilamentInfos filament_infos;
|
||||
filament_infos.filament_id = filament_it->filament_id;
|
||||
filament_infos.setting_id = filament_it->setting_id;
|
||||
map_filament_items[alias] = filament_infos;
|
||||
|
||||
filament_items.push_back(user_preset_alias);
|
||||
_collect_filament_info(user_preset_alias, preset, query_filament_vendors, query_filament_types);
|
||||
|
||||
FilamentInfos filament_infos;
|
||||
filament_infos.filament_id = filament_it->filament_id;
|
||||
filament_infos.setting_id = filament_it->setting_id;
|
||||
map_filament_items[user_preset_alias] = filament_infos;
|
||||
}
|
||||
}
|
||||
|
||||
if (filament_it->filament_id == ams_filament_id) {
|
||||
hint_filament_name = from_u8(filament_it->alias);
|
||||
bambu_filament_name = from_u8(filament_it->alias);
|
||||
if (filament_it->filament_id == ams_filament_id) {
|
||||
hint_filament_name = from_u8(alias);
|
||||
bambu_filament_name = from_u8(alias);
|
||||
|
||||
|
||||
// update if nozzle_temperature_range is found
|
||||
ConfigOption *opt_min = filament_it->config.option("nozzle_temperature_range_low");
|
||||
if (opt_min) {
|
||||
ConfigOptionInts *opt_min_ints = dynamic_cast<ConfigOptionInts *>(opt_min);
|
||||
if (opt_min_ints) {
|
||||
wxString text_nozzle_temp_min = wxString::Format("%d", opt_min_ints->get_at(0));
|
||||
m_input_nozzle_min->GetTextCtrl()->SetValue(text_nozzle_temp_min);
|
||||
}
|
||||
}
|
||||
ConfigOption *opt_max = filament_it->config.option("nozzle_temperature_range_high");
|
||||
if (opt_max) {
|
||||
ConfigOptionInts *opt_max_ints = dynamic_cast<ConfigOptionInts *>(opt_max);
|
||||
if (opt_max_ints) {
|
||||
wxString text_nozzle_temp_max = wxString::Format("%d", opt_max_ints->get_at(0));
|
||||
m_input_nozzle_max->GetTextCtrl()->SetValue(text_nozzle_temp_max);
|
||||
}
|
||||
}
|
||||
}
|
||||
idx++;
|
||||
// update if nozzle_temperature_range is found
|
||||
ConfigOption *opt_min = filament_it->config.option("nozzle_temperature_range_low");
|
||||
if (opt_min) {
|
||||
ConfigOptionInts *opt_min_ints = dynamic_cast<ConfigOptionInts *>(opt_min);
|
||||
if (opt_min_ints) {
|
||||
wxString text_nozzle_temp_min = wxString::Format("%d", opt_min_ints->get_at(0));
|
||||
m_input_nozzle_min->GetTextCtrl()->SetValue(text_nozzle_temp_min);
|
||||
}
|
||||
}
|
||||
ConfigOption *opt_max = filament_it->config.option("nozzle_temperature_range_high");
|
||||
if (opt_max) {
|
||||
ConfigOptionInts *opt_max_ints = dynamic_cast<ConfigOptionInts *>(opt_max);
|
||||
if (opt_max_ints) {
|
||||
wxString text_nozzle_temp_max = wxString::Format("%d", opt_max_ints->get_at(0));
|
||||
m_input_nozzle_max->GetTextCtrl()->SetValue(text_nozzle_temp_max);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1251,56 +1237,47 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
||||
stream << std::fixed << std::setprecision(1) << machine_diameter;
|
||||
}
|
||||
std::string nozzle_diameter_str = stream.str();
|
||||
std::set<std::string> printer_names = preset_bundle->get_printer_names_by_printer_type_and_nozzle(DevPrinterConfigUtil::get_printer_display_name(obj->printer_type),
|
||||
nozzle_diameter_str);
|
||||
for (auto it = preset_bundle->filaments.begin(); it != preset_bundle->filaments.end(); it++) {
|
||||
if (!m_comboBox_filament->GetValue().IsEmpty()) {
|
||||
auto filament_item = map_filament_items[m_comboBox_filament->GetValue().ToStdString()];
|
||||
std::string filament_id = filament_item.filament_id;
|
||||
if (it->filament_id.compare(filament_id) == 0) {
|
||||
ConfigOption * printer_opt = it->config.option("compatible_printers");
|
||||
ConfigOptionStrings *printer_strs = dynamic_cast<ConfigOptionStrings *>(printer_opt);
|
||||
bool has_compatible_printer = false;
|
||||
for (auto printer_str : printer_strs->values) {
|
||||
if (printer_names.find(printer_str) != printer_names.end()) {
|
||||
has_compatible_printer = true;
|
||||
break;
|
||||
}
|
||||
// Resolve the selection against the same list Popup() built the dropdown from, so the two
|
||||
// halves of the dialog cannot disagree about which filaments this machine can use.
|
||||
const std::string selected = m_comboBox_filament->GetValue().ToStdString();
|
||||
if (!selected.empty()) {
|
||||
const std::string filament_id = map_filament_items[selected].filament_id;
|
||||
for (Preset *it : preset_bundle->get_filament_presets_for_machine(
|
||||
DevPrinterConfigUtil::get_printer_display_name(obj->printer_type), nozzle_diameter_str, obj->is_support_user_preset)) {
|
||||
if (it->filament_id != filament_id)
|
||||
continue;
|
||||
// ) if nozzle_temperature_range is found
|
||||
ConfigOption* opt_min = it->config.option("nozzle_temperature_range_low");
|
||||
if (opt_min) {
|
||||
ConfigOptionInts* opt_min_ints = dynamic_cast<ConfigOptionInts*>(opt_min);
|
||||
if (opt_min_ints) {
|
||||
wxString text_nozzle_temp_min = wxString::Format("%d", opt_min_ints->get_at(0));
|
||||
m_input_nozzle_min->GetTextCtrl()->SetValue(text_nozzle_temp_min);
|
||||
}
|
||||
if (!it->is_system && !has_compatible_printer) continue;
|
||||
// ) if nozzle_temperature_range is found
|
||||
ConfigOption* opt_min = it->config.option("nozzle_temperature_range_low");
|
||||
if (opt_min) {
|
||||
ConfigOptionInts* opt_min_ints = dynamic_cast<ConfigOptionInts*>(opt_min);
|
||||
if (opt_min_ints) {
|
||||
wxString text_nozzle_temp_min = wxString::Format("%d", opt_min_ints->get_at(0));
|
||||
m_input_nozzle_min->GetTextCtrl()->SetValue(text_nozzle_temp_min);
|
||||
}
|
||||
}
|
||||
ConfigOption* opt_max = it->config.option("nozzle_temperature_range_high");
|
||||
if (opt_max) {
|
||||
ConfigOptionInts* opt_max_ints = dynamic_cast<ConfigOptionInts*>(opt_max);
|
||||
if (opt_max_ints) {
|
||||
wxString text_nozzle_temp_max = wxString::Format("%d", opt_max_ints->get_at(0));
|
||||
m_input_nozzle_max->GetTextCtrl()->SetValue(text_nozzle_temp_max);
|
||||
}
|
||||
}
|
||||
ConfigOption* opt_type = it->config.option("filament_type");
|
||||
bool found_filament_type = false;
|
||||
if (opt_type) {
|
||||
ConfigOptionStrings* opt_type_strs = dynamic_cast<ConfigOptionStrings*>(opt_type);
|
||||
if (opt_type_strs) {
|
||||
found_filament_type = true;
|
||||
//m_filament_type = opt_type_strs->get_at(0);
|
||||
std::string display_filament_type;
|
||||
m_filament_type = it->config.get_filament_type(display_filament_type);
|
||||
}
|
||||
}
|
||||
if (!found_filament_type)
|
||||
m_filament_type = "";
|
||||
|
||||
break;
|
||||
}
|
||||
ConfigOption* opt_max = it->config.option("nozzle_temperature_range_high");
|
||||
if (opt_max) {
|
||||
ConfigOptionInts* opt_max_ints = dynamic_cast<ConfigOptionInts*>(opt_max);
|
||||
if (opt_max_ints) {
|
||||
wxString text_nozzle_temp_max = wxString::Format("%d", opt_max_ints->get_at(0));
|
||||
m_input_nozzle_max->GetTextCtrl()->SetValue(text_nozzle_temp_max);
|
||||
}
|
||||
}
|
||||
ConfigOption* opt_type = it->config.option("filament_type");
|
||||
bool found_filament_type = false;
|
||||
if (opt_type) {
|
||||
ConfigOptionStrings* opt_type_strs = dynamic_cast<ConfigOptionStrings*>(opt_type);
|
||||
if (opt_type_strs) {
|
||||
found_filament_type = true;
|
||||
//m_filament_type = opt_type_strs->get_at(0);
|
||||
std::string display_filament_type;
|
||||
m_filament_type = it->config.get_filament_type(display_filament_type);
|
||||
}
|
||||
}
|
||||
if (!found_filament_type)
|
||||
m_filament_type = "";
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1938,11 +1915,6 @@ void ColorPickerPopup::paintEvent(wxPaintEvent& evt)
|
||||
|
||||
void ColorPickerPopup::OnDismiss() {}
|
||||
|
||||
void ColorPickerPopup::Popup()
|
||||
{
|
||||
PopupWindow::Popup();
|
||||
}
|
||||
|
||||
bool ColorPickerPopup::ProcessLeftDown(wxMouseEvent& event) {
|
||||
return PopupWindow::ProcessLeftDown(event);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,6 @@ public:
|
||||
void set_ams_colours(std::vector<wxColour> ams);
|
||||
void set_def_colour(wxColour col);
|
||||
void paintEvent(wxPaintEvent& evt);
|
||||
void Popup();
|
||||
virtual void OnDismiss() wxOVERRIDE;
|
||||
virtual bool ProcessLeftDown(wxMouseEvent& event) wxOVERRIDE;
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ void AMSSetting::UpdateByObj(MachineObject* obj)
|
||||
|
||||
update_ams_img(obj);
|
||||
|
||||
m_ams_type->Update(obj);
|
||||
m_ams_type->UpdateInfo(obj);
|
||||
//m_ams_arrange_order->Update(obj);
|
||||
update_insert_material_read_mode(obj);
|
||||
m_sizer_remain_block->Show(obj->is_support_update_remain);
|
||||
@@ -624,7 +624,7 @@ void AMSSettingTypePanel::CreateGui()
|
||||
Fit();
|
||||
}
|
||||
|
||||
void AMSSettingTypePanel::Update(const MachineObject* obj)
|
||||
void AMSSettingTypePanel::UpdateInfo(const MachineObject* obj)
|
||||
{
|
||||
if (!obj) {
|
||||
Show(false);
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
~AMSSettingTypePanel();
|
||||
|
||||
public:
|
||||
void Update(const MachineObject* obj);
|
||||
void UpdateInfo(const MachineObject* obj);
|
||||
|
||||
private:
|
||||
void CreateGui();
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
#include "AVVideoDecoder.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <libavutil/avutil.h>
|
||||
#include <libavutil/imgutils.h>
|
||||
}
|
||||
|
||||
AVVideoDecoder::AVVideoDecoder()
|
||||
{
|
||||
codec_ctx_ = avcodec_alloc_context3(nullptr);
|
||||
}
|
||||
|
||||
AVVideoDecoder::~AVVideoDecoder()
|
||||
{
|
||||
if (sws_ctx_)
|
||||
sws_freeContext(sws_ctx_);
|
||||
if (frame_)
|
||||
av_frame_free(&frame_);
|
||||
if (codec_ctx_)
|
||||
avcodec_free_context(&codec_ctx_);
|
||||
}
|
||||
|
||||
int AVVideoDecoder::open(Bambu_StreamInfo const &info)
|
||||
{
|
||||
auto codec_id = info.sub_type == AVC1 ? AV_CODEC_ID_H264 : AV_CODEC_ID_MJPEG;
|
||||
auto codec = avcodec_find_decoder(codec_id);
|
||||
if (codec == nullptr) {
|
||||
fprintf(stderr, "AVVideoDecoder: unsupported codec!\n");
|
||||
return -1; // Codec not found
|
||||
}
|
||||
/* open the coderc */
|
||||
if (avcodec_open2(codec_ctx_, codec, nullptr) < 0) {
|
||||
fprintf(stderr, "AVVideoDecoder: could not open codec\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Allocate an AVFrame structure
|
||||
frame_ = av_frame_alloc();
|
||||
if (frame_ == nullptr)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AVVideoDecoder::decode(const Bambu_Sample &sample)
|
||||
{
|
||||
int ret = -1;
|
||||
AVPacket *pkt = av_packet_alloc();
|
||||
if (!pkt) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = av_new_packet(pkt, sample.size);
|
||||
if (ret != 0) {
|
||||
av_packet_free(&pkt);
|
||||
return ret;
|
||||
}
|
||||
|
||||
memcpy(pkt->data, sample.buffer, size_t(sample.size));
|
||||
|
||||
ret = avcodec_send_packet(codec_ctx_, pkt);
|
||||
if (ret == 0) {
|
||||
got_frame_ = avcodec_receive_frame(codec_ctx_, frame_) == 0;
|
||||
}
|
||||
|
||||
av_packet_unref(pkt);
|
||||
av_packet_free(&pkt);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int AVVideoDecoder::flush()
|
||||
{
|
||||
int ret = avcodec_send_packet(codec_ctx_, nullptr);
|
||||
got_frame_ = avcodec_receive_frame(codec_ctx_, frame_) == 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AVVideoDecoder::close()
|
||||
{
|
||||
}
|
||||
|
||||
bool AVVideoDecoder::toWxImage(wxImage &image, wxSize const &size2)
|
||||
{
|
||||
if (!got_frame_)
|
||||
return false;
|
||||
|
||||
auto size1 = size2;
|
||||
if (!size1.IsFullySpecified())
|
||||
size1 = {frame_->width, frame_->height };
|
||||
auto size = size1;
|
||||
if (size.GetWidth() & 0x0f) {
|
||||
size.SetWidth((size.GetWidth() & ~0x0f) + 0x10);
|
||||
if (size.GetWidth() != width_) {
|
||||
std::fill(bits_.begin(), bits_.end(), 0);
|
||||
width_ = size.GetWidth();
|
||||
}
|
||||
}
|
||||
AVPixelFormat wxFmt = AV_PIX_FMT_RGB24;
|
||||
sws_ctx_ = sws_getCachedContext(sws_ctx_,
|
||||
frame_->width, frame_->height, AVPixelFormat(frame_->format),
|
||||
size1.GetWidth(), size1.GetHeight(), wxFmt,
|
||||
SWS_GAUSS,
|
||||
nullptr, nullptr, nullptr);
|
||||
if (sws_ctx_ == nullptr)
|
||||
return false;
|
||||
int length = size.GetWidth() * size.GetHeight() * 3;
|
||||
if (bits_.size() < length)
|
||||
bits_.resize(length);
|
||||
uint8_t * datas[] = { bits_.data() };
|
||||
int strides[] = { size.GetWidth() * 3 };
|
||||
int result_h = sws_scale(sws_ctx_, frame_->data, frame_->linesize, 0, frame_->height, datas, strides);
|
||||
if (result_h != size.GetHeight()) {
|
||||
return false;
|
||||
}
|
||||
// Copy: the frame outlives this decoder and is painted by the GUI thread while the
|
||||
// next sws_scale is already overwriting bits_, so it must own its pixels. The Windows
|
||||
// path below needs no equivalent, wxBitmap copies the bits into GDI.
|
||||
image = wxImage(size.GetWidth(), size.GetHeight(), bits_.data(), true).Copy();
|
||||
if (!image.IsOk()) {
|
||||
fprintf(stderr, "AVVideoDecoder: image not ok %dx%d\n", size.GetWidth(), size.GetHeight());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AVVideoDecoder::toWxBitmap(wxBitmap &bitmap, wxSize const &size2)
|
||||
{
|
||||
if (!got_frame_)
|
||||
return false;
|
||||
|
||||
auto size1 = size2;
|
||||
if (!size1.IsFullySpecified())
|
||||
size1 = {frame_->width, frame_->height };
|
||||
auto size = size1;
|
||||
if (size.GetWidth() & 0x0f) {
|
||||
size.SetWidth((size.GetWidth() & ~0x0f) + 0x10);
|
||||
if (size.GetWidth() != width_) {
|
||||
std::fill(bits_.begin(), bits_.end(), 0);
|
||||
width_ = size.GetWidth();
|
||||
}
|
||||
}
|
||||
AVPixelFormat wxFmt = AV_PIX_FMT_RGB32;
|
||||
sws_ctx_ = sws_getCachedContext(sws_ctx_,
|
||||
frame_->width, frame_->height, AVPixelFormat(frame_->format),
|
||||
size1.GetWidth(), size1.GetHeight(), wxFmt,
|
||||
SWS_GAUSS,
|
||||
nullptr, nullptr, nullptr);
|
||||
if (sws_ctx_ == nullptr)
|
||||
return false;
|
||||
int length = size.GetWidth() * size.GetHeight() * 4;
|
||||
if (bits_.size() < length)
|
||||
bits_.resize(length);
|
||||
uint8_t *datas[] = { bits_.data() };
|
||||
int strides[] = { size.GetWidth() * 4 };
|
||||
int result_h = sws_scale(sws_ctx_, frame_->data, frame_->linesize, 0, frame_->height, datas, strides);
|
||||
if (result_h != size.GetHeight()) {
|
||||
fprintf(stderr, "AVVideoDecoder: result_h %d %d\n", result_h, size.GetHeight());
|
||||
return false;
|
||||
}
|
||||
bitmap = wxBitmap((char const *) bits_.data(), size.GetWidth(), size.GetHeight(), 32);
|
||||
assert(bitmap.IsOk());
|
||||
if (!bitmap.IsOk()) {
|
||||
fprintf(stderr, "AVVideoDecoder: bitmap not ok %dx%d\n", size.GetWidth(), size.GetHeight());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef AVVIDEODECODER_HPP
|
||||
#define AVVIDEODECODER_HPP
|
||||
|
||||
#include "Printer/BambuTunnel.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libswscale/swscale.h>
|
||||
}
|
||||
#include <vector>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/image.h>
|
||||
|
||||
class wxBitmap;
|
||||
|
||||
class AVVideoDecoder
|
||||
{
|
||||
public:
|
||||
AVVideoDecoder();
|
||||
|
||||
~AVVideoDecoder();
|
||||
|
||||
public:
|
||||
int open(Bambu_StreamInfo const &info);
|
||||
|
||||
int decode(Bambu_Sample const &sample);
|
||||
|
||||
int flush();
|
||||
|
||||
void close();
|
||||
|
||||
bool toWxImage(wxImage &image, wxSize const &size);
|
||||
|
||||
bool toWxBitmap(wxBitmap &bitmap, wxSize const & size);
|
||||
|
||||
private:
|
||||
AVCodecContext *codec_ctx_ = nullptr;
|
||||
AVFrame * frame_ = nullptr;
|
||||
SwsContext * sws_ctx_ = nullptr;
|
||||
bool got_frame_ = false;
|
||||
int width_ { 0 }; // scale result width
|
||||
std::vector<uint8_t> bits_;
|
||||
};
|
||||
|
||||
#endif // AVVIDEODECODER_HPP
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "libslic3r/Color.hpp"
|
||||
#include "BuildCommit.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "MainFrame.hpp"
|
||||
@@ -245,7 +246,7 @@ AboutDialog::AboutDialog()
|
||||
vesizer->Add(0, 0, 1, wxEXPAND, FromDIP(5));
|
||||
auto version_string = std::string(SoftFever_VERSION); // _L("Orca Slicer ") + " " + std::string(SoftFever_VERSION);
|
||||
wxStaticText* version = new wxStaticText(this, wxID_ANY, version_string.c_str(), wxDefaultPosition, wxDefaultSize);
|
||||
wxStaticText* credits_string = new wxStaticText(this, wxID_ANY, wxString::Format("Build %s", std::string(GIT_COMMIT_HASH)), wxDefaultPosition, wxDefaultSize);
|
||||
wxStaticText* credits_string = new wxStaticText(this, wxID_ANY, wxString::Format("Build %s", build_commit_label), wxDefaultPosition, wxDefaultSize);
|
||||
credits_string->SetFont(_build_string_font);
|
||||
wxFont version_font = GetFont();
|
||||
version_font = version_font.Scaled(1.85f); // SetPointSize(20) not works on macOS because it uses a 72 PPI reference
|
||||
|
||||
@@ -60,7 +60,6 @@ class AboutDialog : public DPIDialog
|
||||
wxHtmlWindow* m_html;
|
||||
wxStaticBitmap* m_logo;
|
||||
int m_copy_rights_btn_id { wxID_ANY };
|
||||
int m_copy_version_btn_id { wxID_ANY };
|
||||
public:
|
||||
AboutDialog();
|
||||
|
||||
|
||||
@@ -93,7 +93,6 @@ private:
|
||||
CenteredTitle* m_title_ctrl { nullptr };
|
||||
wxString m_titleText;
|
||||
|
||||
wxAuiToolBarItem* m_account_item;
|
||||
wxAuiToolBarItem* m_model_store_item;
|
||||
|
||||
//wxAuiToolBarItem *m_publish_item;
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// BambuPlayer.h
|
||||
// BambuPlayer
|
||||
//
|
||||
// Created by cmguo on 2021/12/6.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AVFoundation/AVSampleBufferDisplayLayer.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface BambuPlayer : NSObject
|
||||
|
||||
+ (void) initialize;
|
||||
|
||||
- (instancetype) initWithDisplayLayer: (AVSampleBufferDisplayLayer*) layer;
|
||||
- (instancetype) initWithImageView: (NSView*) view;
|
||||
- (int) open: (char const *) url;
|
||||
- (NSSize) videoSize;
|
||||
- (int) play;
|
||||
- (void) stop;
|
||||
- (void) close;
|
||||
|
||||
- (void) setLogger: (void (*)(void const * context, int level, char const * msg)) logger withContext: (void const *) context;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -468,7 +468,7 @@ PingCodeBindDialog::~PingCodeBindDialog() {
|
||||
m_link_privacy_title->SetFont(Label::Head_13);
|
||||
m_link_privacy_title->SetMaxSize(wxSize(FromDIP(450), -1));
|
||||
m_link_privacy_title->Wrap(FromDIP(450));
|
||||
m_link_privacy_title->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
||||
m_link_privacy_title->Bind(wxEVT_LEFT_DOWN, [](auto& e) {
|
||||
std::string url;
|
||||
std::string country_code = Slic3r::GUI::wxGetApp().app_config->get_country_code();
|
||||
|
||||
@@ -893,7 +893,7 @@ void BindMachineDialog::on_show(wxShowEvent &event)
|
||||
}
|
||||
}
|
||||
})
|
||||
.on_error([this](std::string body, std::string error, unsigned status) {
|
||||
.on_error([](std::string body, std::string error, unsigned status) {
|
||||
//BOOST_LOG_TRIVIAL(info) << "load oss picture failed, oss path: " << oss_path << " status:" << status << " error:" << error;
|
||||
}).perform();
|
||||
}
|
||||
@@ -1099,7 +1099,7 @@ void UnBindMachineDialog::on_show(wxShowEvent &event)
|
||||
}
|
||||
}
|
||||
})
|
||||
.on_error([this](std::string body, std::string error, unsigned status) {
|
||||
.on_error([](std::string body, std::string error, unsigned status) {
|
||||
//BOOST_LOG_TRIVIAL(info) << "load oss picture failed, oss path: " << oss_path << " status:" << status << " error:" << error;
|
||||
}).perform();
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "BuildCommit.hpp"
|
||||
#include "git_commit_hash.h"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
const char *const build_commit_hash = GIT_COMMIT_HASH;
|
||||
const char *const build_commit_label = GIT_COMMIT_HASH GIT_COMMIT_SUFFIX;
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
// Read these rather than including git_commit_hash.h, which changes with every
|
||||
// commit and rebuilds everything that includes it.
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
// The commit alone, safe to use in a commit URL.
|
||||
extern const char *const build_commit_hash;
|
||||
|
||||
// The same, with "-dirty" when the build had uncommitted changes. Use this
|
||||
// wherever the build is shown to a person.
|
||||
extern const char *const build_commit_label;
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
@@ -443,7 +443,7 @@ void HistoryWindow::sync_history_data() {
|
||||
|
||||
auto edit_button = new Button(m_history_data_panel, _L("Edit"));
|
||||
edit_button->SetStyle(ButtonStyle::Confirm, ButtonType::Window);
|
||||
edit_button->Bind(wxEVT_BUTTON, [this, result, k_value, name_value, edit_button](auto& e) {
|
||||
edit_button->Bind(wxEVT_BUTTON, [this, result, k_value, name_value](auto& e) {
|
||||
if (m_ui_op_lock) return;
|
||||
|
||||
PACalibResult result_buffer = result;
|
||||
@@ -702,7 +702,6 @@ wxArrayString NewCalibrationHistoryDialog::get_all_filaments(const MachineObject
|
||||
|
||||
wxArrayString filament_items;
|
||||
std::set<std::string> filament_id_set;
|
||||
std::set<std::string> printer_names;
|
||||
std::ostringstream stream;
|
||||
// If the machine didn't report a nozzle diameter (0.0 = unknown), fall back to the currently
|
||||
// selected printer preset so the filament list isn't empty.
|
||||
@@ -714,67 +713,21 @@ wxArrayString NewCalibrationHistoryDialog::get_all_filaments(const MachineObject
|
||||
stream << std::fixed << std::setprecision(1) << machine_diameter;
|
||||
std::string nozzle_diameter_str = stream.str();
|
||||
|
||||
for (auto printer_it = preset_bundle->printers.begin(); printer_it != preset_bundle->printers.end(); printer_it++) {
|
||||
// filter by system preset
|
||||
if (!printer_it->is_system)
|
||||
continue;
|
||||
// get printer_model
|
||||
ConfigOption * printer_model_opt = printer_it->config.option("printer_model");
|
||||
ConfigOptionString *printer_model_str = dynamic_cast<ConfigOptionString *>(printer_model_opt);
|
||||
if (!printer_model_str)
|
||||
continue;
|
||||
|
||||
// use printer_model as printer type
|
||||
if (printer_model_str->value != DevPrinterConfigUtil::get_printer_display_name(obj->printer_type))
|
||||
continue;
|
||||
|
||||
if (printer_it->name.find(nozzle_diameter_str) != std::string::npos)
|
||||
printer_names.insert(printer_it->name);
|
||||
}
|
||||
|
||||
if (preset_bundle) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "system_preset_bundle filament number=" << preset_bundle->filaments.size();
|
||||
for (auto filament_it = preset_bundle->filaments.begin(); filament_it != preset_bundle->filaments.end(); filament_it++) {
|
||||
// filter by system preset
|
||||
Preset &preset = *filament_it;
|
||||
/*The situation where the user preset is not displayed is as follows:
|
||||
1. Not a root preset
|
||||
2. Not system preset and the printer firmware does not support user preset */
|
||||
if (preset_bundle->filaments.get_preset_base(*filament_it) != &preset || (!filament_it->is_system && ! obj->is_support_user_preset)) { continue; }
|
||||
for (Preset *filament_it : preset_bundle->get_filament_presets_for_machine(
|
||||
DevPrinterConfigUtil::get_printer_display_name(obj->printer_type), nozzle_diameter_str, obj->is_support_user_preset)) {
|
||||
if (!filament_id_set.insert(filament_it->filament_id).second)
|
||||
continue;
|
||||
const std::string alias = preset_bundle->filaments.get_preset_alias(*filament_it, true);
|
||||
if (alias.empty())
|
||||
continue;
|
||||
|
||||
ConfigOption * printer_opt = filament_it->config.option("compatible_printers");
|
||||
ConfigOptionStrings *printer_strs = dynamic_cast<ConfigOptionStrings *>(printer_opt);
|
||||
for (auto printer_str : printer_strs->values) {
|
||||
if (printer_names.find(printer_str) != printer_names.end()) {
|
||||
if (filament_id_set.find(filament_it->filament_id) != filament_id_set.end()) {
|
||||
continue;
|
||||
} else {
|
||||
filament_id_set.insert(filament_it->filament_id);
|
||||
// name matched
|
||||
if (filament_it->is_system) {
|
||||
filament_items.push_back(filament_it->alias);
|
||||
FilamentInfos filament_infos;
|
||||
filament_infos.filament_id = filament_it->filament_id;
|
||||
filament_infos.setting_id = filament_it->setting_id;
|
||||
map_filament_items[filament_it->alias] = filament_infos;
|
||||
} else {
|
||||
char target = '@';
|
||||
size_t pos = filament_it->name.find(target);
|
||||
if (pos != std::string::npos) {
|
||||
std::string user_preset_alias = filament_it->name.substr(0, pos - 1);
|
||||
wxString wx_user_preset_alias = wxString(user_preset_alias.c_str(), wxConvUTF8);
|
||||
user_preset_alias = wx_user_preset_alias.ToStdString();
|
||||
|
||||
filament_items.push_back(user_preset_alias);
|
||||
FilamentInfos filament_infos;
|
||||
filament_infos.filament_id = filament_it->filament_id;
|
||||
filament_infos.setting_id = filament_it->setting_id;
|
||||
map_filament_items[user_preset_alias] = filament_infos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
filament_items.push_back(alias);
|
||||
FilamentInfos filament_infos;
|
||||
filament_infos.filament_id = filament_it->filament_id;
|
||||
filament_infos.setting_id = filament_it->setting_id;
|
||||
map_filament_items[alias] = filament_infos;
|
||||
}
|
||||
}
|
||||
return filament_items;
|
||||
|
||||
@@ -201,7 +201,7 @@ wxWindow* CalibrationDialog::create_check_option(wxString title, wxWindow* paren
|
||||
checkbox->SetToolTip(tooltip);
|
||||
text->SetToolTip(tooltip);
|
||||
|
||||
text->Bind(wxEVT_LEFT_DOWN, [this, check](wxMouseEvent&) { check->SetValue(check->GetValue() ? false : true); });
|
||||
text->Bind(wxEVT_LEFT_DOWN, [check](wxMouseEvent&) { check->SetValue(check->GetValue() ? false : true); });
|
||||
m_checkbox_list[param] = check;
|
||||
m_checkbox_list[param]->SetValue(true);
|
||||
return checkbox;
|
||||
|
||||
@@ -477,7 +477,7 @@ void CalibrationWizard::on_cali_go_home()
|
||||
if (go_home_dialog == nullptr)
|
||||
go_home_dialog = new SecondaryCheckDialog(this, wxID_ANY, _L("Confirm"));
|
||||
|
||||
go_home_dialog->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, method](wxCommandEvent &e) {
|
||||
go_home_dialog->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent &e) {
|
||||
if (curr_obj) {
|
||||
curr_obj->command_task_abort();
|
||||
} else {
|
||||
|
||||
@@ -90,7 +90,7 @@ void CalibrationCaliPage::on_subtask_abort(wxCommandEvent& event)
|
||||
|
||||
if (abort_dlg == nullptr) {
|
||||
abort_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Cancel print"));
|
||||
abort_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, obj](wxCommandEvent& e) {
|
||||
abort_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [obj](wxCommandEvent& e) {
|
||||
if (obj) obj->command_task_abort();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -762,7 +762,7 @@ void CaliPageActionPanel::bind_button(CaliPageActionType action_type, bool is_bl
|
||||
|
||||
if (is_block) {
|
||||
m_action_btns[i]->Bind(wxEVT_BUTTON,
|
||||
[this](wxCommandEvent& evt) {
|
||||
[](wxCommandEvent& evt) {
|
||||
MessageDialog msg(nullptr, _L("The current firmware version of the printer does not support calibration.\nPlease upgrade the printer firmware."), _L("Calibration not supported"), wxOK | wxICON_WARNING);
|
||||
msg.ShowModal();
|
||||
});
|
||||
|
||||
@@ -272,7 +272,7 @@ void CaliPASaveAutoPanel::sync_cali_result(const std::vector<PACalibResult>& cal
|
||||
preset_names = default_naming(preset_names);
|
||||
|
||||
std::vector<PACalibResult> sorted_cali_result = cali_result;
|
||||
std::sort(sorted_cali_result.begin(), sorted_cali_result.end(), [this](const PACalibResult &left, const PACalibResult& right) {
|
||||
std::sort(sorted_cali_result.begin(), sorted_cali_result.end(), [](const PACalibResult &left, const PACalibResult& right) {
|
||||
return left.tray_id < right.tray_id;
|
||||
});
|
||||
|
||||
@@ -366,7 +366,7 @@ void CaliPASaveAutoPanel::sync_cali_result(const std::vector<PACalibResult>& cal
|
||||
}
|
||||
}
|
||||
|
||||
comboBox_tray_name->Bind(wxEVT_COMBOBOX, [this, comboBox_tray_name, k_value, n_value](auto& e) {
|
||||
comboBox_tray_name->Bind(wxEVT_COMBOBOX, [comboBox_tray_name](auto& e) {
|
||||
int selection = comboBox_tray_name->GetSelection();
|
||||
auto history = filtered_results[selection];
|
||||
});
|
||||
@@ -744,7 +744,7 @@ void CaliPASaveAutoPanel::sync_cali_result_for_multi_extruder(const std::vector<
|
||||
}
|
||||
}
|
||||
|
||||
comboBox_tray_name->Bind(wxEVT_COMBOBOX, [this, comboBox_tray_name, k_value, n_value](auto &e) {
|
||||
comboBox_tray_name->Bind(wxEVT_COMBOBOX, [comboBox_tray_name](auto &e) {
|
||||
int selection = comboBox_tray_name->GetSelection();
|
||||
auto history = filtered_results[selection];
|
||||
});
|
||||
|
||||
@@ -140,7 +140,7 @@ CameraPopup::CameraPopup(wxWindow *parent)
|
||||
vcamera_guide_link->Wrap(-1);
|
||||
vcamera_guide_link->SetForegroundColour(wxColour(0x1F, 0x8E, 0xEA));
|
||||
auto text_size = vcamera_guide_link->GetTextExtent(text);
|
||||
vcamera_guide_link->Bind(wxEVT_LEFT_DOWN, [this, url](wxMouseEvent& e) {wxLaunchDefaultBrowser(url); });
|
||||
vcamera_guide_link->Bind(wxEVT_LEFT_DOWN, [url](wxMouseEvent& e) {wxLaunchDefaultBrowser(url); });
|
||||
|
||||
link_underline = new wxPanel(m_panel, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
|
||||
link_underline->SetBackgroundColour(wxColour(0x1F, 0x8E, 0xEA));
|
||||
|
||||
@@ -62,10 +62,16 @@ std::string decompose_basic_type_from_source(size_t source_config_idx,
|
||||
auto& project_config = wxGetApp().preset_bundle->project_config;
|
||||
if (auto* filament_id_opt = project_config.option<ConfigOptionStrings>("filament_id")) {
|
||||
if (source_config_idx < filament_id_opt->values.size()) {
|
||||
const std::string& filament_id = filament_id_opt->values[source_config_idx];
|
||||
if (filament_id == kDecomposePetgFilamentId)
|
||||
// Dead in practice: "filament_id" is not in PresetBundle's s_project_options, so this
|
||||
// option() lookup (create=false) always returns null and the block never runs. Kept as
|
||||
// found, with the translation the values would need: they would be our OF ids, and the
|
||||
// two constants are the printer's own ids.
|
||||
auto* agent = wxGetApp().getAgent();
|
||||
const std::string& orca_filament_id = filament_id_opt->values[source_config_idx];
|
||||
const std::string printer_filament_id = agent ? agent->from_orca_filament_id(orca_filament_id) : orca_filament_id;
|
||||
if (printer_filament_id == kDecomposePetgFilamentId)
|
||||
return kDecomposePetgBasicType;
|
||||
if (filament_id == kDecomposePlaFilamentId)
|
||||
if (printer_filament_id == kDecomposePlaFilamentId)
|
||||
return kDecomposePlaBasicType;
|
||||
}
|
||||
}
|
||||
@@ -82,9 +88,14 @@ std::string decompose_basic_type_from_source(size_t source_config_idx,
|
||||
|
||||
std::string decompose_basic_filament_id(const std::string& basic_type)
|
||||
{
|
||||
if (basic_type == kDecomposePetgBasicType)
|
||||
return kDecomposePetgFilamentId;
|
||||
return kDecomposePlaFilamentId;
|
||||
// The result becomes DecomposeOfficialComponent::filament_id, which the rest of this file
|
||||
// reads as one of our OF ids (translating back before it compares against the printer's
|
||||
// ids), so translate on the way out; kDecompose*FilamentId itself stays the printer-side
|
||||
// literal. The only place that would carry it further, project_config's "filament_id", is
|
||||
// dead code: that key is not in PresetBundle's s_project_options.
|
||||
const std::string printer_filament_id = basic_type == kDecomposePetgBasicType ? kDecomposePetgFilamentId : kDecomposePlaFilamentId;
|
||||
auto* agent = wxGetApp().getAgent();
|
||||
return agent ? agent->to_orca_filament_id(printer_filament_id) : printer_filament_id;
|
||||
}
|
||||
|
||||
void set_created_standard_component_metadata(size_t config_idx, const DecomposeOfficialComponent& component)
|
||||
@@ -98,8 +109,11 @@ void set_created_standard_component_metadata(size_t config_idx, const DecomposeO
|
||||
}
|
||||
}
|
||||
|
||||
const std::string type = component.filament_id == kDecomposePetgFilamentId ? kDecomposePetgShortType :
|
||||
component.filament_id == kDecomposePlaFilamentId ? kDecomposePlaShortType : "";
|
||||
// component.filament_id is our OF id; the two constants are the printer's own ids.
|
||||
auto* agent = wxGetApp().getAgent();
|
||||
const std::string printer_filament_id = agent ? agent->from_orca_filament_id(component.filament_id) : component.filament_id;
|
||||
const std::string type = printer_filament_id == kDecomposePetgFilamentId ? kDecomposePetgShortType :
|
||||
printer_filament_id == kDecomposePlaFilamentId ? kDecomposePlaShortType : "";
|
||||
if (!type.empty()) {
|
||||
if (auto* type_opt = project_config.option<ConfigOptionStrings>("filament_type")) {
|
||||
while (type_opt->values.size() <= config_idx)
|
||||
@@ -151,7 +165,12 @@ DecomposeOfficialComponent lookup_decompose_official_component(
|
||||
continue;
|
||||
if (item.contains("fila_color") && item["fila_color"].is_array() && !item["fila_color"].empty())
|
||||
result.color_hex = decompose_normalize_color_hex(item["fila_color"][0].get<std::string>());
|
||||
result.filament_id = item.value("fila_id", result.filament_id);
|
||||
// fila_id from this shipped, Bambu-keyed color table is a printer-side id; translate it so
|
||||
// result.filament_id stays an OF id like the rest of this struct (the fallback default,
|
||||
// result.filament_id, is already OF and passes through unchanged).
|
||||
const std::string fila_id = item.value("fila_id", result.filament_id);
|
||||
auto* agent = wxGetApp().getAgent();
|
||||
result.filament_id = agent ? agent->to_orca_filament_id(fila_id) : fila_id;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -211,8 +230,11 @@ int find_existing_decompose_component(
|
||||
auto* type_opt = project_config.option<ConfigOptionStrings>("filament_type");
|
||||
const PresetBundle& preset_bundle = *wxGetApp().preset_bundle;
|
||||
const size_t num_physical = physical_colors.size();
|
||||
const std::string expected_basic_type = component.filament_id == kDecomposePetgFilamentId ? kDecomposePetgBasicType :
|
||||
component.filament_id == kDecomposePlaFilamentId ? kDecomposePlaBasicType : "";
|
||||
// component.filament_id is our OF id; the two constants are the printer's own ids.
|
||||
auto* agent = wxGetApp().getAgent();
|
||||
const std::string printer_filament_id = agent ? agent->from_orca_filament_id(component.filament_id) : component.filament_id;
|
||||
const std::string expected_basic_type = printer_filament_id == kDecomposePetgFilamentId ? kDecomposePetgBasicType :
|
||||
printer_filament_id == kDecomposePlaFilamentId ? kDecomposePlaBasicType : "";
|
||||
const std::string expected_short_type = expected_basic_type == kDecomposePetgBasicType ? kDecomposePetgShortType :
|
||||
expected_basic_type == kDecomposePlaBasicType ? kDecomposePlaShortType : "";
|
||||
const std::string expected_preset_part = expected_basic_type.empty() ? "" : std::string(kDecomposeBambuPresetPrefix) + expected_basic_type;
|
||||
|
||||
@@ -453,7 +453,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
|
||||
|
||||
if (config->opt_bool("alternate_extra_wall") &&
|
||||
(config->opt_enum<EnsureVerticalShellThickness>("ensure_vertical_shell_thickness") == evstAll)) {
|
||||
wxString msg_text = _(L("Alternate extra wall does't work well when ensure vertical shell thickness is set to All."));
|
||||
wxString msg_text = _(L("Alternate extra wall doesn't work well when ensure vertical shell thickness is set to All."));
|
||||
|
||||
if (is_global_config)
|
||||
msg_text += "\n\n" + _(L("Change these settings automatically?\n"
|
||||
@@ -642,7 +642,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
|
||||
|
||||
if (config->opt_enum<SeamScarfType>("seam_slope_type") != SeamScarfType::None &&
|
||||
config->get_abs_value("seam_slope_start_height") >= layer_height) {
|
||||
const wxString msg_text = _(L("seam_slope_start_height need to be smaller than layer_height.\nReset to 0."));
|
||||
const wxString msg_text = _(L("seam_slope_start_height needs to be smaller than layer_height.\nReset to 0."));
|
||||
MessageDialog dialog(m_msg_dlg_parent, msg_text, "", wxICON_WARNING | wxOK);
|
||||
DynamicPrintConfig new_conf = *config;
|
||||
is_msg_dlg_already_exist = true;
|
||||
@@ -656,7 +656,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
|
||||
float skin_depth = config->opt_float("skin_infill_depth");
|
||||
if (config->opt_float("infill_lock_depth") > skin_depth) {
|
||||
// xgettext:no-c-format, no-boost-format
|
||||
const wxString msg_text = _(L("Lock depth should smaller than skin depth.\nReset to 50% of skin depth."));
|
||||
const wxString msg_text = _(L("Lock depth should be smaller than skin depth.\nReset to 50% of skin depth."));
|
||||
MessageDialog dialog(m_msg_dlg_parent, msg_text, "", wxICON_WARNING | wxOK);
|
||||
DynamicPrintConfig new_conf = *config;
|
||||
is_msg_dlg_already_exist = true;
|
||||
@@ -741,14 +741,21 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in
|
||||
bool have_infill = config->option<ConfigOptionPercent>("sparse_infill_density")->value > 0;
|
||||
// sparse_infill_filament_id uses the same logic as in Print::extruders()
|
||||
for (auto el : { "sparse_infill_pattern", "infill_combination", "fill_multiline","infill_direction",
|
||||
"minimum_sparse_infill_area", "sparse_infill_filament_id", "infill_anchor", "infill_anchor_max","infill_shift_step","sparse_infill_rotate_template","symmetric_infill_y_axis"})
|
||||
"minimum_sparse_infill_area", "sparse_infill_filament_id","infill_shift_step","sparse_infill_rotate_template","symmetric_infill_y_axis"})
|
||||
toggle_line(el, have_infill);
|
||||
|
||||
InfillPattern pattern = config->opt_enum<InfillPattern>("sparse_infill_pattern");
|
||||
|
||||
// Orca: the concentric patterns follow the surface outline instead of crossing it, so there is
|
||||
// nothing for an infill anchor to attach to. Hide the anchor settings for them.
|
||||
bool have_infill_anchor = have_infill && pattern != ipConcentric && pattern != ipSpiralInset;
|
||||
toggle_line("infill_anchor", have_infill_anchor);
|
||||
toggle_line("infill_anchor_max", have_infill_anchor);
|
||||
|
||||
bool have_combined_infill = config->opt_bool("infill_combination") && have_infill;
|
||||
toggle_line("infill_combination_max_layer_height", have_combined_infill);
|
||||
|
||||
// Infill patterns that support multiline infill.
|
||||
InfillPattern pattern = config->opt_enum<InfillPattern>("sparse_infill_pattern");
|
||||
bool have_multiline_infill_pattern = pattern == ipGyroid || pattern == ipGrid || pattern == ipRectilinear || pattern == ipTpmsD || pattern == ipTpmsFK || pattern == ipCrossHatch || pattern == ipHoneycomb || pattern == ipLateralLattice || pattern == ipLateralHoneycomb || pattern == ipConcentric ||
|
||||
pattern == ipCubic || pattern == ipStars || pattern == ipAlignedRectilinear || pattern == ipLightning || pattern == ip3DHoneycomb || pattern == ipAdaptiveCubic || pattern == ipSupportCubic|| pattern == ipTriangles || pattern == ipQuarterCubic|| pattern == ipArchimedeanChords || pattern == ipHilbertCurve || pattern == ipOctagramSpiral;
|
||||
|
||||
@@ -831,7 +838,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in
|
||||
toggle_line("separated_infills", is_internal_infill_separable);
|
||||
|
||||
// Fill order is only meaningful for the center-based surface fill patterns; hide it otherwise.
|
||||
auto is_centered_fill = [](InfillPattern p) { return p == ipConcentric || p == ipArchimedeanChords || p == ipOctagramSpiral; };
|
||||
auto is_centered_fill = [](InfillPattern p) { return p == ipConcentric || p == ipSpiralInset || p == ipArchimedeanChords || p == ipOctagramSpiral; };
|
||||
toggle_line("top_surface_fill_order", has_top_shell && is_centered_fill(config->opt_enum<InfillPattern>("top_surface_pattern")));
|
||||
toggle_line("bottom_surface_fill_order", has_bottom_shell && is_centered_fill(config->opt_enum<InfillPattern>("bottom_surface_pattern")));
|
||||
|
||||
|
||||
@@ -2752,7 +2752,7 @@ ConfigWizard::ConfigWizard(wxWindow *parent)
|
||||
});
|
||||
|
||||
if (wxLinux_gtk3)
|
||||
this->Bind(wxEVT_SHOW, [this, vsizer](const wxShowEvent& e) {
|
||||
this->Bind(wxEVT_SHOW, [](const wxShowEvent& e) {
|
||||
;
|
||||
});
|
||||
|
||||
|
||||
@@ -599,7 +599,9 @@ static char* read_json_file(const std::string &preset_path)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fread(json_contents, 1, file_size, json_file);
|
||||
const size_t read_bytes = fread(json_contents, 1, file_size, json_file);
|
||||
if (read_bytes != static_cast<size_t>(file_size))
|
||||
BOOST_LOG_TRIVIAL(error) << "Read " << read_bytes << " of " << file_size << " bytes from the JSON file";
|
||||
fclose(json_file);
|
||||
|
||||
return json_contents;
|
||||
@@ -1885,7 +1887,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_nozzle_diameter_item(wxWindow *par
|
||||
|
||||
m_custom_nozzle_diameter_ctrl = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE);
|
||||
m_custom_nozzle_diameter_ctrl->SetHint(_L("Input Custom Nozzle Diameter"));
|
||||
m_custom_nozzle_diameter_ctrl->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) {
|
||||
m_custom_nozzle_diameter_ctrl->Bind(wxEVT_CHAR, [](wxKeyEvent &event) {
|
||||
int key = event.GetKeyCode();
|
||||
if (key != 44 && key != 46 && cannot_input_key.find(key) != cannot_input_key.end()) { // "@" can not be inputed
|
||||
event.Skip(false);
|
||||
@@ -3867,14 +3869,14 @@ void ExportConfigsDialog::select_curr_radiobox(std::vector<std::pair<RadioBox *,
|
||||
m_preset_sizer->Add(create_checkbox(m_presets_window, preset.second, printer_name, m_preset), 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT,
|
||||
FromDIP(5));
|
||||
}
|
||||
m_serial_text->SetLabel(_L("Only printer names with user printer presets will be displayed, and each preset you choose will be exported as a zip."));
|
||||
m_serial_text->SetLabel(_L("Only printer names with user printer presets will be displayed, and each preset you choose will be exported as a ZIP archive."));
|
||||
} else if (export_type == m_exprot_type.filament_preset) {
|
||||
for (std::pair<std::string, std::vector<std::pair<std::string, Preset *>>> filament_name_to_preset : m_filament_name_to_presets) {
|
||||
if (filament_name_to_preset.second.empty()) continue;
|
||||
wxString filament_name = wxString::FromUTF8(filament_name_to_preset.first);
|
||||
m_preset_sizer->Add(create_checkbox(m_presets_window, filament_name, m_printer_name), 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, FromDIP(5));
|
||||
}
|
||||
m_serial_text->SetLabel(_L("Only the filament names with user filament presets will be displayed, \nand all user filament presets in each filament name you select will be exported as a zip."));
|
||||
m_serial_text->SetLabel(_L("Only the filament names with user filament presets will be displayed, \nand all user filament presets in each filament name you select will be exported as a ZIP archive."));
|
||||
} else if (export_type == m_exprot_type.process_preset) {
|
||||
for (std::pair<std::string, std::vector<Preset *>> presets : m_process_presets) {
|
||||
Preset * printer_preset = preset_bundle->printers.find_preset(presets.first, false);
|
||||
@@ -3890,7 +3892,7 @@ void ExportConfigsDialog::select_curr_radiobox(std::vector<std::pair<RadioBox *,
|
||||
}
|
||||
|
||||
}
|
||||
m_serial_text->SetLabel(_L("Only printer names with changed process presets will be displayed, \nand all user process presets in each printer name you select will be exported as a zip."));
|
||||
m_serial_text->SetLabel(_L("Only printer names with changed process presets will be displayed, \nand all user process presets in each printer name you select will be exported as a ZIP archive."));
|
||||
}
|
||||
//m_presets_window->SetSizerAndFit(m_preset_sizer);
|
||||
m_presets_window->Layout();
|
||||
|
||||
@@ -74,12 +74,10 @@ private:
|
||||
std::unordered_set<std::string> m_system_filament_types_set;
|
||||
std::set<std::string> m_visible_printers;
|
||||
CreateType m_create_type;
|
||||
Button * m_button_create = nullptr;
|
||||
Button * m_button_cancel = nullptr;
|
||||
ComboBox * m_filament_vendor_combobox = nullptr;
|
||||
::CheckBox * m_can_not_find_vendor_checkbox = nullptr;
|
||||
ComboBox * m_filament_type_combobox = nullptr;
|
||||
ComboBox * m_exist_vendor_combobox = nullptr;
|
||||
ComboBox * m_filament_preset_combobox = nullptr;
|
||||
TextInput * m_filament_custom_vendor_input = nullptr;
|
||||
wxGridSizer * m_filament_presets_sizer = nullptr;
|
||||
|
||||
@@ -16,24 +16,27 @@ namespace Slic3r
|
||||
// This block is never executed at runtime.
|
||||
static void _toolhead_translation_markers()
|
||||
{
|
||||
// Dynamic toolhead display names from JSON config — xgettext cannot scan these
|
||||
L("Main Extruder"); L("Main extruder"); L("main extruder");
|
||||
L("Auxiliary Extruder"); L("Auxiliary extruder"); L("auxiliary extruder");
|
||||
L("Left Extruder"); L("Left extruder"); L("left extruder");
|
||||
L("Right Extruder"); L("Right extruder"); L("right extruder");
|
||||
L("Main Nozzle"); L("Main nozzle"); L("main nozzle");
|
||||
L("Auxiliary Nozzle"); L("Auxiliary nozzle"); L("auxiliary nozzle");
|
||||
L("Left Nozzle"); L("Left nozzle"); L("left nozzle");
|
||||
L("Right Nozzle"); L("Right nozzle"); L("right nozzle");
|
||||
L("Main Hotend"); L("Main hotend"); L("main hotend");
|
||||
L("Auxiliary Hotend"); L("Auxiliary hotend"); L("auxiliary hotend");
|
||||
L("Left Hotend"); L("Left hotend"); L("left hotend");
|
||||
L("Right Hotend"); L("Right hotend"); L("right hotend");
|
||||
// standalone position words (short_name=true runtime results)
|
||||
L("main"); L("auxiliary");
|
||||
L("Main"); L("Auxiliary");
|
||||
L("left"); L("right");
|
||||
L("Left"); L("Right");
|
||||
// Possible runtime values of tool_head_display_names, marked for extraction.
|
||||
static const char *const markers[] = {
|
||||
L("Main Extruder"), L("Main extruder"), L("main extruder"),
|
||||
L("Auxiliary Extruder"), L("Auxiliary extruder"), L("auxiliary extruder"),
|
||||
L("Left Extruder"), L("Left extruder"), L("left extruder"),
|
||||
L("Right Extruder"), L("Right extruder"), L("right extruder"),
|
||||
L("Main Nozzle"), L("Main nozzle"), L("main nozzle"),
|
||||
L("Auxiliary Nozzle"), L("Auxiliary nozzle"), L("auxiliary nozzle"),
|
||||
L("Left Nozzle"), L("Left nozzle"), L("left nozzle"),
|
||||
L("Right Nozzle"), L("Right nozzle"), L("right nozzle"),
|
||||
L("Main Hotend"), L("Main hotend"), L("main hotend"),
|
||||
L("Auxiliary Hotend"), L("Auxiliary hotend"), L("auxiliary hotend"),
|
||||
L("Left Hotend"), L("Left hotend"), L("left hotend"),
|
||||
L("Right Hotend"), L("Right hotend"), L("right hotend"),
|
||||
// standalone position words (short_name=true runtime results)
|
||||
L("main"), L("auxiliary"),
|
||||
L("Main"), L("Auxiliary"),
|
||||
L("left"), L("right"),
|
||||
L("Left"), L("Right"),
|
||||
};
|
||||
(void) markers;
|
||||
}
|
||||
|
||||
std::string DevPrinterConfigUtil::m_resource_file_path = "";
|
||||
|
||||
@@ -241,8 +241,11 @@ void check_filaments(const DevFilaBlacklist::CheckFilamentInfo& check_info, DevF
|
||||
std::set<std::string> white_fila_ids = filament_item.contains("white_fila_ids") ? filament_item["white_fila_ids"].get<std::set<std::string>>() : std::set<std::string>();
|
||||
if (!white_fila_ids.empty() && !check_info.fila_id.empty())
|
||||
{
|
||||
auto it = std::find_if(white_fila_ids.begin(), white_fila_ids.end(), [&check_info](const std::string& white_fila_id) {
|
||||
return white_fila_id == check_info.fila_id;
|
||||
// check_info.fila_id is our OF id; white_fila_ids in filaments_blacklist.json holds the printer's own.
|
||||
auto* agent = Slic3r::GUI::wxGetApp().getAgent();
|
||||
const std::string printer_filament_id = agent ? agent->from_orca_filament_id(check_info.fila_id) : check_info.fila_id;
|
||||
auto it = std::find_if(white_fila_ids.begin(), white_fila_ids.end(), [&printer_filament_id](const std::string& white_fila_id) {
|
||||
return white_fila_id == printer_filament_id;
|
||||
});
|
||||
if (it != white_fila_ids.end()) { continue; }
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// TODO: remove this include
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
#include "slic3r/GUI/GUI_App.hpp"
|
||||
|
||||
#include "DevUtil.h"
|
||||
#include "DevUtilBackend.h"
|
||||
@@ -95,7 +96,12 @@ std::string DevAmsTray::get_filament_type()
|
||||
if (m_fila_type == "Sup.ABS") { return "ABS-S"; }
|
||||
if (m_fila_type == "Support W") { return "PLA-S"; }
|
||||
if (m_fila_type == "Support G") { return "PA-S"; }
|
||||
if (m_fila_type == "Support") { if (setting_id == "GFS00") { m_fila_type = "PLA-S"; } else if (setting_id == "GFS01") { m_fila_type = "PA-S"; } else { return "PLA-S"; } }
|
||||
// setting_id is our OF id; GFS00/GFS01 are the printer's own support-filament ids.
|
||||
if (m_fila_type == "Support") {
|
||||
auto* agent = GUI::wxGetApp().getAgent();
|
||||
const std::string printer_filament_id = agent ? agent->from_orca_filament_id(setting_id) : setting_id;
|
||||
if (printer_filament_id == "GFS00") { m_fila_type = "PLA-S"; } else if (printer_filament_id == "GFS01") { m_fila_type = "PA-S"; } else { return "PLA-S"; }
|
||||
}
|
||||
|
||||
return m_fila_type;
|
||||
}
|
||||
@@ -654,11 +660,14 @@ void DevFilaSystemParser::ParseV1_0(const json& jj, MachineObject* obj, DevFilaS
|
||||
curr_tray->setting_id = (*tray_it)["tray_info_idx"].get<std::string>();
|
||||
//std::string type = (*tray_it)["tray_type"].get<std::string>();
|
||||
std::string type = MachineObject::setting_id_to_type(curr_tray->setting_id, (*tray_it)["tray_type"].get<std::string>());
|
||||
if (curr_tray->setting_id == "GFS00")
|
||||
// curr_tray->setting_id is our OF id; GFS00/GFS01 are the printer's own support-filament ids.
|
||||
auto* agent = GUI::wxGetApp().getAgent();
|
||||
const std::string printer_filament_id = agent ? agent->from_orca_filament_id(curr_tray->setting_id) : curr_tray->setting_id;
|
||||
if (printer_filament_id == "GFS00")
|
||||
{
|
||||
curr_tray->m_fila_type = "PLA-S";
|
||||
}
|
||||
else if (curr_tray->setting_id == "GFS01")
|
||||
else if (printer_filament_id == "GFS01")
|
||||
{
|
||||
curr_tray->m_fila_type = "PA-S";
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
|
||||
std::string id;
|
||||
std::string tag_uid; // tag_uid
|
||||
std::string setting_id; // tray_info_idx
|
||||
std::string setting_id; // tray_info_idx, map to the filament_id
|
||||
std::string filament_setting_id; // setting_id
|
||||
std::string m_fila_type;
|
||||
std::string sub_brands;
|
||||
|
||||
@@ -110,7 +110,9 @@ bool Slic3r::is_stringing_prone_filament(const std::string& filament_id, float n
|
||||
if (filament_id.empty()) return false;
|
||||
const auto* set = pick_stringing_set(nozzle_diameter);
|
||||
if (!set) return false;
|
||||
return set->count(filament_id) > 0;
|
||||
// filament_id is one of our content-addressed OF ids; the table above is keyed by the printer's own.
|
||||
auto* agent = Slic3r::GUI::wxGetApp().getAgent();
|
||||
return set->count(agent ? agent->from_orca_filament_id(filament_id) : filament_id) > 0;
|
||||
}
|
||||
|
||||
wxString Slic3r::get_stage_string(int stage)
|
||||
@@ -5048,10 +5050,13 @@ DevAmsTray MachineObject::parse_vt_tray(json vtray)
|
||||
vt_tray.setting_id = vtray["tray_info_idx"].get<std::string>();
|
||||
//std::string type = vtray["tray_type"].get<std::string>();
|
||||
std::string type = setting_id_to_type(vt_tray.setting_id, vtray["tray_type"].get<std::string>());
|
||||
if (vt_tray.setting_id == "GFS00") {
|
||||
// vt_tray.setting_id is our OF id (translated on the way in); the two support ids below are the printer's own.
|
||||
auto* agent = GUI::wxGetApp().getAgent();
|
||||
const std::string printer_filament_id = agent ? agent->from_orca_filament_id(vt_tray.setting_id) : vt_tray.setting_id;
|
||||
if (printer_filament_id == "GFS00") {
|
||||
vt_tray.m_fila_type = "PLA-S";
|
||||
}
|
||||
else if (vt_tray.setting_id == "GFS01") {
|
||||
else if (printer_filament_id == "GFS01") {
|
||||
vt_tray.m_fila_type = "PA-S";
|
||||
}
|
||||
else {
|
||||
@@ -5592,7 +5597,10 @@ void MachineObject::update_filament_list()
|
||||
|
||||
for (auto it = filament_list.begin(); it != filament_list.end(); it++) {
|
||||
if (m_filament_list.find(it->first) != m_filament_list.end()) {
|
||||
assert(it->first.size() == 8 && it->first[0] == 'P');
|
||||
// User roots may legitimately carry adopted system-shaped ids (GF*/OF*/P-hex
|
||||
// system), so a non-'P' id here is expected, not an invariant violation.
|
||||
if (it->first.size() != 8 || it->first[0] != 'P')
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ": user-root filament_id is not user-shaped: " << it->first;
|
||||
|
||||
if (it->second.first != m_filament_list[it->first].first) {
|
||||
BOOST_LOG_TRIVIAL(info) << "old min temp is not equal to new min temp and filament id: " << it->first;
|
||||
@@ -5654,6 +5662,17 @@ void MachineObject::update_printer_preset_name()
|
||||
void MachineObject::check_ams_filament_valid()
|
||||
{
|
||||
PresetBundle * preset_bundle = Slic3r::GUI::wxGetApp().preset_bundle;
|
||||
// A tray id carried by ANY system filament preset is not a dangling user-preset id
|
||||
// (ten shipped P-hex system ids pass the 'P' shape gates below), so the destructive
|
||||
// tray-wipe / temp-rewrite handling must never fire for it.
|
||||
auto is_system_filament_id = [preset_bundle](const std::string &id) {
|
||||
if (!preset_bundle)
|
||||
return false;
|
||||
for (auto it = preset_bundle->filaments.begin(); it != preset_bundle->filaments.end(); it++)
|
||||
if (it->is_system && it->filament_id == id)
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
auto printer_model = DevPrinterConfigUtil::get_printer_display_name(this->printer_type);
|
||||
std::map<std::string, std::set<std::string>> need_checked_filament_id;
|
||||
for (auto &ams_pair : m_fila_system->GetAmsList()) {
|
||||
@@ -5675,6 +5694,8 @@ void MachineObject::check_ams_filament_valid()
|
||||
auto &checked_filament = data.checked_filament;
|
||||
for (const auto &[slot_id, curr_tray] : ams->GetTrays()) {
|
||||
|
||||
if (curr_tray->setting_id.size() == 8 && curr_tray->setting_id[0] == 'P' && is_system_filament_id(curr_tray->setting_id))
|
||||
continue;
|
||||
if (curr_tray->setting_id.size() == 8 && curr_tray->setting_id[0] == 'P' && filament_list.find(curr_tray->setting_id) == filament_list.end()) {
|
||||
if (checked_filament.find(curr_tray->setting_id) != checked_filament.end()) {
|
||||
need_checked_filament_id[nozzle_diameter_str].insert(curr_tray->setting_id);
|
||||
@@ -5735,6 +5756,8 @@ void MachineObject::check_ams_filament_valid()
|
||||
auto &data = m_nozzle_filament_data[nozzle_diameter_str];
|
||||
auto &checked_filament = data.checked_filament;
|
||||
auto &filament_list = data.filament_list;
|
||||
if (vt_tray.setting_id.size() == 8 && vt_tray.setting_id[0] == 'P' && is_system_filament_id(vt_tray.setting_id))
|
||||
continue;
|
||||
if (vt_tray.setting_id.size() == 8 && vt_tray.setting_id[0] == 'P' && filament_list.find(vt_tray.setting_id) == filament_list.end()) {
|
||||
if (checked_filament.find(vt_tray.setting_id) != checked_filament.end()) {
|
||||
need_checked_filament_id[nozzle_diameter_str].insert(vt_tray.setting_id);
|
||||
|
||||
@@ -705,7 +705,7 @@ ReselectMachineDialog::ReselectMachineDialog(wxWindow* parent)
|
||||
Centre();
|
||||
}
|
||||
|
||||
void ReselectMachineDialog::Update(MachineObject* obj, const std::map<int, int>& best_pos_map, const std::vector<FilamentInfo>& ams_mapping, wxString save_time)
|
||||
void ReselectMachineDialog::UpdateInfo(MachineObject* obj, const std::map<int, int>& best_pos_map, const std::vector<FilamentInfo>& ams_mapping, wxString save_time)
|
||||
{
|
||||
|
||||
if (suggestText)
|
||||
|
||||
@@ -188,7 +188,7 @@ class ReselectMachineDialog : public wxDialog
|
||||
public:
|
||||
ReselectMachineDialog(wxWindow* parent);
|
||||
~ReselectMachineDialog();
|
||||
void Update(MachineObject* obj,
|
||||
void UpdateInfo(MachineObject* obj,
|
||||
const std::map<int, int>& best_pos_map,
|
||||
const std::vector<FilamentInfo>& ams_mapping,
|
||||
wxString save_time);
|
||||
@@ -199,7 +199,6 @@ private:
|
||||
void OnRefreshButton(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
int saveTimes{0};
|
||||
wxBoxSizer* mainSizer{nullptr};
|
||||
wxPanel* textPanel{nullptr};
|
||||
wxBoxSizer* textSizer{nullptr};
|
||||
|
||||
@@ -98,7 +98,7 @@ void uiAmsPercentHumidityDryPopup::Create()
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void uiAmsPercentHumidityDryPopup::Update(int humidiy_level, int humidity_percent, int left_dry_time, float current_temperature)
|
||||
void uiAmsPercentHumidityDryPopup::UpdateInfo(int humidiy_level, int humidity_percent, int left_dry_time, float current_temperature)
|
||||
{
|
||||
if (m_humidity_level != humidiy_level || m_humidity_percent != humidity_percent ||
|
||||
m_left_dry_time != left_dry_time || m_current_temperature != current_temperature)
|
||||
|
||||
@@ -38,14 +38,14 @@ public:
|
||||
~uiAmsPercentHumidityDryPopup() = default;
|
||||
|
||||
public:
|
||||
void Update(uiAmsHumidityInfo *info) { m_ams_id = info->ams_id; Update(info->humidity_display_idx, info->humidity_percent, info->left_dry_time, info->current_temperature); };
|
||||
void UpdateInfo(uiAmsHumidityInfo *info) { m_ams_id = info->ams_id; UpdateInfo(info->humidity_display_idx, info->humidity_percent, info->left_dry_time, info->current_temperature); };
|
||||
|
||||
std::string get_owner_ams_id() const { return m_ams_id; }
|
||||
|
||||
void msw_rescale();
|
||||
|
||||
private:
|
||||
void Update(int humidiy_level, int humidity_percent, int left_dry_time, float current_temperature);
|
||||
void UpdateInfo(int humidiy_level, int humidity_percent, int left_dry_time, float current_temperature);
|
||||
void UpdateContents();
|
||||
|
||||
void Create();
|
||||
|
||||
@@ -399,7 +399,7 @@ void wgtDeviceNozzleRackArea::UpdateNozzleItems(const std::unordered_map<int, wg
|
||||
{
|
||||
for (auto iter : nozzle_items)
|
||||
{
|
||||
iter.second->Update(nozzle_rack);
|
||||
iter.second->UpdateInfo(nozzle_rack);
|
||||
}
|
||||
|
||||
/*update nozzle possition and background*/
|
||||
@@ -837,7 +837,7 @@ void wgtDeviceNozzleRackNozzleItem::SetSelected(bool selected)
|
||||
}
|
||||
}
|
||||
|
||||
void wgtDeviceNozzleRackNozzleItem::Update(const std::shared_ptr<DevNozzleRack> rack, bool on_rack /*= true*/)
|
||||
void wgtDeviceNozzleRackNozzleItem::UpdateInfo(const std::shared_ptr<DevNozzleRack> rack, bool on_rack /*= true*/)
|
||||
{
|
||||
m_rack = rack;
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
wgtDeviceNozzleRackNozzleItem(wxWindow* parent, int nozzle_id);
|
||||
|
||||
public:
|
||||
void Update(const std::shared_ptr<DevNozzleRack> rack, bool on_rack = true); // on_rack is false means extruder nozzle
|
||||
void UpdateInfo(const std::shared_ptr<DevNozzleRack> rack, bool on_rack = true); // on_rack is false means extruder nozzle
|
||||
|
||||
int GetNozzleId() const { return m_nozzle_id; }
|
||||
void SetDisplayIdText(const wxString& text) { m_nozzle_label_id->SetLabel(text);};
|
||||
|
||||
@@ -122,7 +122,6 @@ private:
|
||||
private:
|
||||
int m_ext_nozzle_id = -1;
|
||||
int m_rack_nozzle_id = -1;
|
||||
bool m_isRefreshFinish = false;
|
||||
bool findNozzleImage = false;
|
||||
|
||||
NozzleStatus m_nozzle_status = NOZZLE_STATUS_DC;
|
||||
@@ -154,7 +153,6 @@ private:
|
||||
Label* m_diameter_label;
|
||||
Label* m_flowtype_label;
|
||||
Label* m_type_label;
|
||||
ScalableButton* m_error_button{ nullptr };
|
||||
|
||||
Label* m_sn_label;
|
||||
Label* m_version_label;
|
||||
|
||||
@@ -114,7 +114,7 @@ static void s_update_nozzle_info(wgtDeviceNozzleRackNozzleItem* item,
|
||||
std::shared_ptr<DevNozzleRack> rack,
|
||||
const DevNozzle& nozzle_info)
|
||||
{
|
||||
item->Update(rack, nozzle_info.IsOnRack());
|
||||
item->UpdateInfo(rack, nozzle_info.IsOnRack());
|
||||
if (nozzle_info.IsUnknown()) {
|
||||
if (item->GetToolTipText() != _L("Nozzle information needs to be read")) {
|
||||
item->SetToolTip(_L("Nozzle information needs to be read"));
|
||||
@@ -266,7 +266,7 @@ void wgtDeviceNozzleRackSelect::OnNozzleItemSelected(wxCommandEvent &evt)
|
||||
}
|
||||
|
||||
auto *item = dynamic_cast<wgtDeviceNozzleRackNozzleItem *>(evt.GetEventObject());
|
||||
if (item; auto ptr = m_nozzle_rack.lock()) {
|
||||
if (auto ptr = m_nozzle_rack.lock(); item && ptr) {
|
||||
int to_select_pos_id = sGetNozzlePosId(item, m_toolhead_nozzle_l, m_toolhead_nozzle_r);
|
||||
if (to_select_pos_id > -1 && to_select_pos_id != GetSelectedNozzlePosID()) {
|
||||
SetSelectedNozzle(ptr->GetNozzleSystem()->GetNozzleByPosId(to_select_pos_id));
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/dragimag.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "GUI_App.hpp"
|
||||
#include "MsgDialog.hpp"
|
||||
#include "libslic3r/Preset.hpp"
|
||||
#include <algorithm>
|
||||
#include "I18N.hpp"
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <wx/dcgraph.h>
|
||||
@@ -599,8 +600,10 @@ void ExtrusionCalibration::update_combobox_filaments()
|
||||
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
||||
if (preset_bundle && obj) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "system_preset_bundle filament number=" << preset_bundle->filaments.size();
|
||||
std::string printer_type = obj->printer_type;
|
||||
std::set<std::string> printer_preset_list;
|
||||
double nozzle_value = 0.4;
|
||||
m_comboBox_nozzle_dia->GetValue().ToDouble(&nozzle_value);
|
||||
|
||||
std::vector<PresetWithVendorProfile> printer_profiles;
|
||||
for (auto printer_it = preset_bundle->printers.begin(); printer_it != preset_bundle->printers.end(); printer_it++) {
|
||||
// only use system printer preset
|
||||
if (!printer_it->is_system) continue;
|
||||
@@ -610,49 +613,42 @@ void ExtrusionCalibration::update_combobox_filaments()
|
||||
ConfigOptionFloats* printer_nozzle_vals = nullptr;
|
||||
if (printer_nozzle_opt)
|
||||
printer_nozzle_vals = dynamic_cast<ConfigOptionFloats*>(printer_nozzle_opt);
|
||||
double nozzle_value = 0.4;
|
||||
wxString nozzle_value_str = m_comboBox_nozzle_dia->GetValue();
|
||||
try {
|
||||
nozzle_value_str.ToDouble(&nozzle_value);
|
||||
} catch(...) {
|
||||
;
|
||||
}
|
||||
if (!model_id.empty() && model_id.compare(obj->printer_type) == 0
|
||||
&& printer_nozzle_vals
|
||||
&& abs(printer_nozzle_vals->get_at(0) - nozzle_value) < 1e-3) {
|
||||
printer_preset_list.insert(printer_it->name);
|
||||
printer_profiles.push_back(preset_bundle->printers.get_preset_with_vendor_profile(*printer_it));
|
||||
BOOST_LOG_TRIVIAL(trace) << "extrusion_cali: printer_model = " << model_id;
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(error) << "extrusion_cali: printer_model = " << model_id;
|
||||
}
|
||||
}
|
||||
|
||||
// Unlike the AMS dialogs this one offers every matching preset by full name rather than one
|
||||
// root preset per alias, so it filters the collection itself instead of calling
|
||||
// PresetBundle::get_filament_presets_for_machine().
|
||||
for (auto filament_it = preset_bundle->filaments.begin(); filament_it != preset_bundle->filaments.end(); filament_it++) {
|
||||
ConfigOption* printer_opt = filament_it->config.option("compatible_printers");
|
||||
ConfigOptionStrings* printer_strs = dynamic_cast<ConfigOptionStrings*>(printer_opt);
|
||||
for (auto printer_str : printer_strs->values) {
|
||||
if (printer_preset_list.find(printer_str) != printer_preset_list.end()) {
|
||||
user_filaments.push_back(&(*filament_it));
|
||||
const PresetWithVendorProfile filament = preset_bundle->filaments.get_preset_with_vendor_profile(*filament_it);
|
||||
if (std::none_of(printer_profiles.begin(), printer_profiles.end(),
|
||||
[&filament](const PresetWithVendorProfile &printer) { return is_compatible_with_printer(filament, printer); }))
|
||||
continue;
|
||||
|
||||
// set default filament id
|
||||
filament_index++;
|
||||
if (filament_it->is_system
|
||||
&& !ams_filament_id.empty()
|
||||
&& filament_it->filament_id == ams_filament_id
|
||||
) {
|
||||
curr_selection = filament_index;
|
||||
}
|
||||
user_filaments.push_back(&(*filament_it));
|
||||
|
||||
if (filament_it->name == obj->extrusion_cali_filament_name && !obj->extrusion_cali_filament_name.empty())
|
||||
{
|
||||
curr_selection = filament_index;
|
||||
}
|
||||
|
||||
wxString filament_name = wxString::FromUTF8(filament_it->name);
|
||||
filament_items.Add(filament_name);
|
||||
break;
|
||||
}
|
||||
// set default filament id
|
||||
filament_index++;
|
||||
if (filament_it->is_system
|
||||
&& !ams_filament_id.empty()
|
||||
&& filament_it->filament_id == ams_filament_id
|
||||
) {
|
||||
curr_selection = filament_index;
|
||||
}
|
||||
|
||||
if (filament_it->name == obj->extrusion_cali_filament_name && !obj->extrusion_cali_filament_name.empty())
|
||||
{
|
||||
curr_selection = filament_index;
|
||||
}
|
||||
|
||||
filament_items.Add(wxString::FromUTF8(filament_it->name));
|
||||
}
|
||||
m_comboBox_filament->Set(filament_items);
|
||||
m_comboBox_filament->SetSelection(curr_selection);
|
||||
|
||||
@@ -941,7 +941,11 @@ void TextCtrl::BUILD() {
|
||||
temp->SetToolTip(get_tooltip_text(text_value));
|
||||
|
||||
if (!m_opt.multiline) {
|
||||
text_ctrl->Bind(wxEVT_TEXT_ENTER, ([this, temp](wxEvent &e)
|
||||
text_ctrl->Bind(wxEVT_TEXT_ENTER, ([
|
||||
#if !defined(__WXGTK__)
|
||||
temp,
|
||||
#endif // __WXGTK__
|
||||
this](wxEvent &e)
|
||||
{
|
||||
#if !defined(__WXGTK__)
|
||||
e.Skip();
|
||||
@@ -973,7 +977,11 @@ void TextCtrl::BUILD() {
|
||||
temp->GetToolTip()->Enable(flag);
|
||||
}), text_ctrl->GetId());
|
||||
|
||||
temp->Bind(wxEVT_KILL_FOCUS, ([this, temp](wxEvent &e)
|
||||
temp->Bind(wxEVT_KILL_FOCUS, ([
|
||||
#if !defined(__WXGTK__)
|
||||
temp,
|
||||
#endif // __WXGTK__
|
||||
this](wxEvent &e)
|
||||
{
|
||||
e.Skip();
|
||||
#if !defined(__WXGTK__)
|
||||
@@ -1324,7 +1332,7 @@ void SpinCtrl::BUILD() {
|
||||
bEnterPressed = true;
|
||||
}), temp->GetId());
|
||||
|
||||
temp->GetTextCtrl()->Bind(wxEVT_TEXT, ([this, temp](wxCommandEvent e)
|
||||
temp->GetTextCtrl()->Bind(wxEVT_TEXT, ([this](wxCommandEvent e)
|
||||
{
|
||||
// # On OSX / Cocoa, SpinInput::GetValue() doesn't return the new value
|
||||
// # when it was changed from the text control, so the on_change callback
|
||||
@@ -2597,7 +2605,11 @@ void ColourPicker::BUILD()
|
||||
// // recast as a wxWindow to fit the calling convention
|
||||
window = dynamic_cast<wxWindow*>(temp);
|
||||
|
||||
temp->Bind(wxEVT_COLOURPICKER_CHANGED, ([this,temp](wxCommandEvent e) {
|
||||
temp->Bind(wxEVT_COLOURPICKER_CHANGED, ([
|
||||
#ifdef __WXMSW__
|
||||
temp,
|
||||
#endif
|
||||
this](wxCommandEvent e) {
|
||||
#ifdef __WXMSW__
|
||||
draw_bmp_btn(temp, temp->GetColour());
|
||||
#endif
|
||||
|
||||
@@ -241,7 +241,7 @@ FilamentMapDialog::FilamentMapDialog(wxWindow *parent,
|
||||
|
||||
wxBoxSizer *mode_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
m_auto_btn = new CapsuleButton(this, PageType::ptAuto, only_saving_mode ? _L("Fila Saving") : _L("Auto"), false);
|
||||
m_auto_btn = new CapsuleButton(this, PageType::ptAuto, only_saving_mode ? _L("File Saving") : _L("Auto"), false);
|
||||
m_manual_btn = new CapsuleButton(this, PageType::ptManual, _L("Custom"), false);
|
||||
if (show_default)
|
||||
m_default_btn = new CapsuleButton(this, PageType::ptDefault, _L("Same as Global"), true);
|
||||
|
||||
@@ -642,19 +642,12 @@ void FilamentMapBtnPanel::Select(bool selected)
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void GUI::FilamentMapBtnPanel::Hide()
|
||||
bool GUI::FilamentMapBtnPanel::Show(bool show)
|
||||
{
|
||||
m_btn->Hide();
|
||||
m_label->Hide();
|
||||
m_detail->Hide();
|
||||
wxPanel::Hide();
|
||||
}
|
||||
void GUI::FilamentMapBtnPanel::Show()
|
||||
{
|
||||
m_btn->Show();
|
||||
m_label->Show();
|
||||
m_detail->Show();
|
||||
wxPanel::Show();
|
||||
m_btn->Show(show);
|
||||
m_label->Show(show);
|
||||
m_detail->Show(show);
|
||||
return wxPanel::Show(show);
|
||||
}
|
||||
|
||||
FilamentMapAutoPanel::FilamentMapAutoPanel(wxWindow *parent, FilamentMapMode mode, bool machine_synced) : wxPanel(parent)
|
||||
@@ -694,18 +687,11 @@ FilamentMapAutoPanel::FilamentMapAutoPanel(wxWindow *parent, FilamentMapMode mod
|
||||
Layout();
|
||||
GUI::wxGetApp().UpdateDarkUIWin(this);
|
||||
}
|
||||
void FilamentMapAutoPanel::Hide()
|
||||
bool FilamentMapAutoPanel::Show(bool show)
|
||||
{
|
||||
m_flush_panel->Hide();
|
||||
m_match_panel->Hide();
|
||||
wxPanel::Hide();
|
||||
}
|
||||
|
||||
void FilamentMapAutoPanel::Show()
|
||||
{
|
||||
m_flush_panel->Show();
|
||||
m_match_panel->Show();
|
||||
wxPanel::Show();
|
||||
m_flush_panel->Show(show);
|
||||
m_match_panel->Show(show);
|
||||
return wxPanel::Show(show);
|
||||
}
|
||||
|
||||
void FilamentMapAutoPanel::UpdateStatus()
|
||||
@@ -743,16 +729,10 @@ FilamentMapDefaultPanel::FilamentMapDefaultPanel(wxWindow *parent) : wxPanel(par
|
||||
GUI::wxGetApp().UpdateDarkUIWin(this);
|
||||
}
|
||||
|
||||
void FilamentMapDefaultPanel::Hide()
|
||||
bool FilamentMapDefaultPanel::Show(bool show)
|
||||
{
|
||||
m_label->Hide();
|
||||
wxPanel::Hide();
|
||||
}
|
||||
|
||||
void FilamentMapDefaultPanel::Show()
|
||||
{
|
||||
m_label->Show();
|
||||
wxPanel::Show();
|
||||
m_label->Show(show);
|
||||
return wxPanel::Show(show);
|
||||
}
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
||||
@@ -69,10 +69,9 @@ class FilamentMapBtnPanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
FilamentMapBtnPanel(wxWindow *parent, const wxString &label, const wxString &detail, const std::string &icon_path);
|
||||
void Hide();
|
||||
void Show();
|
||||
bool Show(bool show = true) override;
|
||||
void Select(bool selected);
|
||||
bool Enable(bool enable);
|
||||
bool Enable(bool enable) override;
|
||||
bool IsEnabled() const { return m_enabled; }
|
||||
protected:
|
||||
void OnPaint(wxPaintEvent &event);
|
||||
@@ -99,8 +98,7 @@ class FilamentMapAutoPanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
FilamentMapAutoPanel(wxWindow *parent, FilamentMapMode mode, bool machine_synced);
|
||||
void Hide();
|
||||
void Show();
|
||||
bool Show(bool show = true) override;
|
||||
FilamentMapMode GetMode() const { return m_mode; }
|
||||
|
||||
private:
|
||||
@@ -116,8 +114,7 @@ class FilamentMapDefaultPanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
FilamentMapDefaultPanel(wxWindow *parent);
|
||||
void Hide();
|
||||
void Show();
|
||||
bool Show(bool show = true) override;
|
||||
|
||||
private:
|
||||
Label *m_label;
|
||||
|
||||
@@ -426,11 +426,11 @@ wxScrolledWindow* FilamentPickerDialog::CreateColorGrid()
|
||||
});
|
||||
|
||||
// Hover highlight
|
||||
btn->Bind(wxEVT_ENTER_WINDOW, [btn](wxMouseEvent& evt) {
|
||||
btn->Bind(wxEVT_ENTER_WINDOW, [](wxMouseEvent& evt) {
|
||||
evt.Skip();
|
||||
});
|
||||
|
||||
btn->Bind(wxEVT_LEAVE_WINDOW, [btn](wxMouseEvent& evt) {
|
||||
btn->Bind(wxEVT_LEAVE_WINDOW, [](wxMouseEvent& evt) {
|
||||
evt.Skip();
|
||||
});
|
||||
|
||||
|
||||
@@ -785,6 +785,19 @@ void GCodeViewer::SequentialView::GCodeWindow::load_gcode(const std::string& fil
|
||||
}
|
||||
}
|
||||
|
||||
// Byte offset just past the first count characters of str, or its length if it is shorter.
|
||||
static size_t utf8_offset(const std::string& str, size_t count)
|
||||
{
|
||||
const char* const begin = str.c_str();
|
||||
const char* const end = begin + str.size();
|
||||
const char* pos = begin;
|
||||
for (size_t i = 0; i < count && pos < end; ++i) {
|
||||
unsigned int codepoint = 0;
|
||||
pos += ImTextCharFromUtf8(&codepoint, pos, end);
|
||||
}
|
||||
return pos - begin;
|
||||
}
|
||||
|
||||
//BBS: GUI refactor: move to right
|
||||
void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, float right, uint64_t curr_line_id) const
|
||||
{
|
||||
@@ -796,23 +809,27 @@ void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, f
|
||||
// read line from file
|
||||
const size_t start = id == 1 ? 0 : m_lines_ends[id - 2];
|
||||
const size_t original_len = m_lines_ends[id - 1] - start;
|
||||
const size_t len = std::min(original_len, (size_t) 55);
|
||||
// A character is four bytes at most, so 55 of them always fit in 220.
|
||||
const size_t len = std::min(original_len, (size_t) 55 * 4);
|
||||
std::string gline(m_file.data() + start, len);
|
||||
|
||||
// If original line is longer than 55 characters, truncate and append "..."
|
||||
if (original_len > 55)
|
||||
gline = gline.substr(0, 52) + "...";
|
||||
// If original line is longer than 55 characters, truncate and append "...".
|
||||
// The cut must land on a character boundary or it leaves half a character behind.
|
||||
if (len < original_len || utf8_offset(gline, 55) < gline.size())
|
||||
gline = gline.substr(0, utf8_offset(gline, 52)) + "...";
|
||||
|
||||
std::string command, parameters, comment;
|
||||
// extract comment
|
||||
std::vector<std::string> tokens;
|
||||
boost::split(tokens, gline, boost::is_any_of(";"), boost::token_compress_on);
|
||||
command = tokens.front();
|
||||
if (tokens.size() > 1)
|
||||
comment = ";" + tokens.back();
|
||||
const size_t comment_start = gline.find(';');
|
||||
if (comment_start == std::string::npos)
|
||||
command = gline;
|
||||
else {
|
||||
command = gline.substr(0, comment_start);
|
||||
comment = gline.substr(comment_start);
|
||||
}
|
||||
|
||||
// extract gcode command and parameters
|
||||
if (!command.empty()) {
|
||||
std::vector<std::string> tokens;
|
||||
boost::split(tokens, command, boost::is_any_of(" "), boost::token_compress_on);
|
||||
command = tokens.front();
|
||||
if (tokens.size() > 1) {
|
||||
@@ -2613,7 +2630,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
|
||||
|
||||
return ret;
|
||||
};
|
||||
auto append_item = [icon_size, &imgui, imperial_units, &window_padding, &draw_list, this](const ColorRGBA& color, const std::vector<std::pair<std::string, float>>& columns_offsets)
|
||||
auto append_item = [icon_size, &imgui, &window_padding, &draw_list, this](const ColorRGBA& color, const std::vector<std::pair<std::string, float>>& columns_offsets)
|
||||
{
|
||||
// render icon
|
||||
ImVec2 pos = ImVec2(ImGui::GetCursorScreenPos().x + window_padding * 3, ImGui::GetCursorScreenPos().y);
|
||||
@@ -2648,7 +2665,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
|
||||
}
|
||||
ImGui::Separator();
|
||||
};
|
||||
auto get_used_filament_from_volume = [this, imperial_units, &filament_diameters, &filament_densities](double volume, int extruder_id) {
|
||||
auto get_used_filament_from_volume = [imperial_units, &filament_diameters, &filament_densities](double volume, int extruder_id) {
|
||||
double koef = imperial_units ? 1.0 / GizmoObjectManipulation::in_to_mm : 0.001;
|
||||
std::pair<double, double> ret = { koef * volume / (PI * sqr(0.5 * filament_diameters[extruder_id])),
|
||||
volume * filament_densities[extruder_id] * 0.001 };
|
||||
@@ -3233,7 +3250,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
//ImVec2(pos_rect.x + ImGui::GetWindowWidth() + ImGui::GetFrameHeight(),pos_rect.y + ImGui::GetFrameHeight() + window_padding * 2.5),
|
||||
//ImGui::GetColorU32(ImVec4(0,0,0,0.3)));
|
||||
|
||||
auto append_item = [icon_size, &imgui, imperial_units, &window_padding, &draw_list, this](
|
||||
auto append_item = [icon_size, &imgui, &window_padding, &draw_list, this](
|
||||
EItemType type,
|
||||
const ColorRGBA& color,
|
||||
const std::vector<std::pair<std::string, float>>& columns_offsets,
|
||||
@@ -3368,7 +3385,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
return ret;
|
||||
};
|
||||
|
||||
auto calculate_offsets = [&imgui, max_width, window_padding, this](const std::vector<std::pair<std::string, std::vector<::string>>>& title_columns, float extra_size = 0.0f) {
|
||||
auto calculate_offsets = [max_width, this](const std::vector<std::pair<std::string, std::vector<::string>>>& title_columns, float extra_size = 0.0f) {
|
||||
const ImGuiStyle& style = ImGui::GetStyle();
|
||||
std::vector<float> offsets;
|
||||
// ORCA increase spacing for more readable format. Using direct number requires much less code change in here. GetTextLineHeight for additional spacing for icon_size
|
||||
@@ -3856,7 +3873,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
columns_offsets.push_back({ distance_text, offsets[3] });
|
||||
if (full_layout && !count_text.empty())
|
||||
columns_offsets.push_back({ count_text, distance_text.empty() ? offsets[3] : offsets[4] });
|
||||
append_item(EItemType::Rect, color, columns_offsets, true, offsets.back()/*ORCA checkbox_pos*/, visible, [this, type, visible]() {
|
||||
append_item(EItemType::Rect, color, columns_offsets, true, offsets.back()/*ORCA checkbox_pos*/, visible, [this, type]() {
|
||||
m_viewer.toggle_option_visibility(type);
|
||||
update_moves_slider();
|
||||
});
|
||||
@@ -3913,7 +3930,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
columns_offsets.push_back({used_filaments_length[i], offsets[3]});
|
||||
columns_offsets.push_back({used_filaments_weight[i], offsets[4]});
|
||||
append_item(EItemType::Rect, libvgcode::convert(m_viewer.get_extrusion_role_color(role)), columns_offsets,
|
||||
true, offsets.back(), visible, [this, role, visible]() {
|
||||
true, offsets.back(), visible, [this, role]() {
|
||||
m_viewer.toggle_extrusion_role_visibility(role);
|
||||
update_moves_slider();
|
||||
});
|
||||
@@ -3932,7 +3949,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
columns_offsets.push_back({ travel_percent, offsets[2] });
|
||||
columns_offsets.push_back({ travel_distance, offsets[3] }); // Usage column
|
||||
columns_offsets.push_back({ travel_moves, offsets[4] }); // Usage column
|
||||
append_item(EItemType::Rect, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), columns_offsets, true, offsets.back()/*ORCA checkbox_pos*/, visible, [this, item, visible]() {
|
||||
append_item(EItemType::Rect, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), columns_offsets, true, offsets.back()/*ORCA checkbox_pos*/, visible, [this, item]() {
|
||||
m_viewer.toggle_option_visibility(item);
|
||||
update_moves_slider();
|
||||
});
|
||||
@@ -3951,7 +3968,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} });
|
||||
const bool travel_visible = m_viewer.is_option_visible(libvgcode::EOptionType::Travels);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f));
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this, travel_visible]() {
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this]() {
|
||||
m_viewer.toggle_option_visibility(libvgcode::EOptionType::Travels);
|
||||
// refresh(*m_gcode_result, wxGetApp().plater()->get_extruder_colors_from_plater_config(m_gcode_result));
|
||||
update_moves_slider();
|
||||
@@ -3968,7 +3985,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} });
|
||||
const bool travel_visible = m_viewer.is_option_visible(libvgcode::EOptionType::Travels);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f));
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this, travel_visible]() {
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this]() {
|
||||
m_viewer.toggle_option_visibility(libvgcode::EOptionType::Travels);
|
||||
// refresh(*m_gcode_result, wxGetApp().plater()->get_extruder_colors_from_plater_config(m_gcode_result));
|
||||
update_moves_slider();
|
||||
@@ -3985,7 +4002,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} });
|
||||
const bool travel_visible = m_viewer.is_option_visible(libvgcode::EOptionType::Travels);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f));
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this, travel_visible]() {
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this]() {
|
||||
m_viewer.toggle_option_visibility(libvgcode::EOptionType::Travels);
|
||||
update_moves_slider();
|
||||
});
|
||||
@@ -4001,7 +4018,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} });
|
||||
const bool travel_visible = m_viewer.is_option_visible(libvgcode::EOptionType::Travels);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f));
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this, travel_visible]() {
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this]() {
|
||||
m_viewer.toggle_option_visibility(libvgcode::EOptionType::Travels);
|
||||
update_moves_slider();
|
||||
});
|
||||
@@ -4121,7 +4138,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
}
|
||||
|
||||
float checkbox_pos = std::max(predictable_icon_pos, color_print_offsets[_u8L("Display")]); // ORCA prefer predictable_icon_pos when header not reacing end
|
||||
append_item(EItemType::Rect, libvgcode::convert(tool_colors[extruder_idx]), columns_offsets, false, checkbox_pos/*ORCA*/, true, [this, extruder_idx]() {});
|
||||
append_item(EItemType::Rect, libvgcode::convert(tool_colors[extruder_idx]), columns_offsets, false, checkbox_pos/*ORCA*/, true, []() {});
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@ public:
|
||||
float m_model_z_offset{ 0.5f };
|
||||
bool m_visible{ true };
|
||||
bool m_is_dark = false;
|
||||
bool m_fixed_screen_size{ false };
|
||||
float m_scale_factor{ 1.0f };
|
||||
#if ENABLE_ACTUAL_SPEED_DEBUG
|
||||
ActualSpeedImguiWidget m_actual_speed_imgui_widget;
|
||||
|
||||
@@ -4274,7 +4274,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
// https://github.com/OrcaSlicer/OrcaSlicer/pull/14999#issuecomment-5151344759
|
||||
// We solve this by correcting the state of the event from the actual mouse state querying with `wxGetMouseState()`
|
||||
// so it works like on other platforms.
|
||||
{
|
||||
// Only fill in state the event does not carry, to preserve wx's synthetic right button for Ctrl+left.
|
||||
if (!evt.ButtonIsDown(wxMOUSE_BTN_ANY)) {
|
||||
const auto state = wxGetMouseState();
|
||||
evt.SetLeftDown(state.LeftIsDown());
|
||||
evt.SetMiddleDown(state.MiddleIsDown());
|
||||
@@ -9463,7 +9464,7 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
||||
ImVec2 size = ImVec2(button_width, button_height);
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y);
|
||||
// ORCA show additional information depends on state
|
||||
auto draw_info_btn = [end_pos, f_scale, margin, window_bg](std::string str, ImVec4 bg_color, ImVec4 fg_color){
|
||||
auto draw_info_btn = [end_pos, f_scale, margin](std::string str, ImVec4 bg_color, ImVec4 fg_color){
|
||||
GImGui->FontSize = 15.0f * f_scale;
|
||||
ImVec2 txt_slice_sz = ImGui::CalcTextSize(str.c_str());
|
||||
ImVec2 btn_pad = ImVec2(8.f, 1.f) * f_scale;
|
||||
@@ -9719,7 +9720,7 @@ void GLCanvas3D::_render_canvas_toolbar()
|
||||
Plater* p = wxGetApp().plater();
|
||||
AppConfig* cfg = wxGetApp().app_config;
|
||||
|
||||
auto create_menu_item = [this, sc](
|
||||
auto create_menu_item = [sc](
|
||||
const std::string& name,
|
||||
bool enable,
|
||||
bool condition,
|
||||
@@ -9736,7 +9737,7 @@ void GLCanvas3D::_render_canvas_toolbar()
|
||||
create_menu_item( _utf8(L("3D Navigator")),
|
||||
m_canvas_type != ECanvasType::CanvasAssembleView, // not work on assembly
|
||||
wxGetApp().show_3d_navigator(),
|
||||
[this]{
|
||||
[]{
|
||||
wxGetApp().toggle_show_3d_navigator();
|
||||
ImGui::CloseCurrentPopup(); // Close popup to show changes on UI
|
||||
}
|
||||
@@ -9745,7 +9746,7 @@ void GLCanvas3D::_render_canvas_toolbar()
|
||||
create_menu_item( _utf8(L("Zoom button")),
|
||||
true, // work on all
|
||||
wxGetApp().show_canvas_zoom_button(),
|
||||
[this]{
|
||||
[]{
|
||||
wxGetApp().toggle_canvas_zoom_button();
|
||||
ImGui::CloseCurrentPopup(); // Close popup to show changes on UI
|
||||
}
|
||||
@@ -9756,13 +9757,13 @@ void GLCanvas3D::_render_canvas_toolbar()
|
||||
create_menu_item( _utf8(L("Overhangs")),
|
||||
m_canvas_type == ECanvasType::CanvasView3D, // work only on prepare
|
||||
p->is_view3D_overhang_shown(),
|
||||
[this, p]{p->show_view3D_overhang(!p->is_view3D_overhang_shown());}
|
||||
[p]{p->show_view3D_overhang(!p->is_view3D_overhang_shown());}
|
||||
);
|
||||
|
||||
create_menu_item( _utf8(L("Outline")),
|
||||
m_canvas_type != ECanvasType::CanvasPreview, // not work on preview
|
||||
wxGetApp().show_outline(),
|
||||
[this]{wxGetApp().toggle_show_outline();}
|
||||
[]{wxGetApp().toggle_show_outline();}
|
||||
);
|
||||
|
||||
create_menu_item( _utf8(L("Wireframe")),
|
||||
@@ -9774,7 +9775,7 @@ void GLCanvas3D::_render_canvas_toolbar()
|
||||
create_menu_item( _utf8(L("Realistic View")),
|
||||
m_canvas_type != ECanvasType::CanvasPreview, // not work on preview
|
||||
cfg->get_bool(SETTING_OPENGL_REALISTIC_MODE),
|
||||
[this, &cfg]{
|
||||
[&cfg]{
|
||||
cfg->set_bool(SETTING_OPENGL_REALISTIC_MODE, !cfg->get_bool(SETTING_OPENGL_REALISTIC_MODE));
|
||||
cfg->save();
|
||||
}
|
||||
@@ -9785,7 +9786,7 @@ void GLCanvas3D::_render_canvas_toolbar()
|
||||
create_menu_item( _utf8(L("Perspective")),
|
||||
true, // work on all
|
||||
cfg->get_bool("use_perspective_camera"),
|
||||
[this, &cfg]{
|
||||
[&cfg]{
|
||||
cfg->set_bool("use_perspective_camera", !(cfg->get_bool("use_perspective_camera")));
|
||||
wxGetApp().update_ui_from_settings();
|
||||
}
|
||||
@@ -9802,7 +9803,7 @@ void GLCanvas3D::_render_canvas_toolbar()
|
||||
create_menu_item( _utf8(L("Gridlines")),
|
||||
m_canvas_type != ECanvasType::CanvasAssembleView, // not work on assembly
|
||||
wxGetApp().show_plate_gridlines(),
|
||||
[this]{wxGetApp().toggle_show_plate_gridlines();}
|
||||
[]{wxGetApp().toggle_show_plate_gridlines();}
|
||||
);
|
||||
|
||||
ImGui::Separator();
|
||||
@@ -9810,7 +9811,7 @@ void GLCanvas3D::_render_canvas_toolbar()
|
||||
create_menu_item( _utf8(L("Labels")),
|
||||
m_canvas_type == ECanvasType::CanvasView3D, // work only on prepare
|
||||
p->are_view3D_labels_shown(),
|
||||
[this, p]{p->show_view3D_labels(!p->are_view3D_labels_shown());}
|
||||
[p]{p->show_view3D_labels(!p->are_view3D_labels_shown());}
|
||||
);
|
||||
|
||||
ImGui::PopItemFlag();
|
||||
|
||||
@@ -327,7 +327,6 @@ private:
|
||||
GLTexture m_icons_texture;
|
||||
bool m_icons_texture_dirty;
|
||||
mutable GLTexture m_images_texture;
|
||||
mutable bool m_images_texture_dirty;
|
||||
BackgroundTexture m_background_texture;
|
||||
GLTexture m_arrow_texture;
|
||||
Layout m_layout;
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
#include "slic3r/GUI/TaskManager.hpp"
|
||||
#include "format.hpp"
|
||||
#include "libslic3r_version.h"
|
||||
#include "BuildCommit.hpp"
|
||||
#include "Downloader.hpp"
|
||||
#include <boost/chrono/duration.hpp>
|
||||
#include <boost/locale/encoding_utf.hpp>
|
||||
#include <boost/log/detail/native_typeof.hpp>
|
||||
#include <libslic3r/Config.hpp>
|
||||
#include <mutex>
|
||||
@@ -2580,7 +2582,7 @@ void GUI_App::init_app_config()
|
||||
set_log_path_and_level(log_filename, 3);
|
||||
#endif
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("gui mode, Current OrcaSlicer Version %1% build %2%") % SoftFever_VERSION % GIT_COMMIT_HASH;
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("gui mode, Current OrcaSlicer Version %1% build %2%") % SoftFever_VERSION % build_commit_label;
|
||||
|
||||
//BBS: remove GCodeViewer as seperate APP logic
|
||||
if (!app_config)
|
||||
@@ -2641,7 +2643,7 @@ std::string GUI_App::get_bbl_client_version()
|
||||
void GUI_App::on_start_subscribe_again(std::string dev_id)
|
||||
{
|
||||
auto start_subscribe_timer = new wxTimer(this, wxID_ANY);
|
||||
Bind(wxEVT_TIMER, [this, start_subscribe_timer, dev_id](auto& e) {
|
||||
Bind(wxEVT_TIMER, [start_subscribe_timer, dev_id](auto& e) {
|
||||
start_subscribe_timer->Stop();
|
||||
Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) return;
|
||||
@@ -3231,7 +3233,7 @@ bool GUI_App::on_init_inner()
|
||||
}
|
||||
});
|
||||
|
||||
Bind(EVT_SHOW_NO_NEW_VERSION, [this](const wxCommandEvent& evt) {
|
||||
Bind(EVT_SHOW_NO_NEW_VERSION, [](const wxCommandEvent& evt) {
|
||||
wxString msg = _L("This is the newest version.");
|
||||
InfoDialog dlg(nullptr, _L("Info"), msg);
|
||||
dlg.ShowModal();
|
||||
@@ -5256,7 +5258,7 @@ std::string GUI_App::handle_web_request(std::string cmd)
|
||||
}
|
||||
}
|
||||
else if (command_str.compare("begin_network_plugin_download") == 0) {
|
||||
CallAfter([this] { wxGetApp().ShowDownNetPluginDlg(); });
|
||||
CallAfter([] { wxGetApp().ShowDownNetPluginDlg(); });
|
||||
}
|
||||
else if (command_str.compare("get_web_shortcut") == 0) {
|
||||
if (root.get_child_optional("key_event") != boost::none) {
|
||||
@@ -8297,7 +8299,7 @@ bool GUI_App::show_modal_ip_address_enter_dialog(bool input_sn, wxString title)
|
||||
dlg.set_machine_obj(obj);
|
||||
if (!title.empty()) dlg.update_title(title);
|
||||
|
||||
dlg.Bind(EVT_ENTER_IP_ADDRESS, [this, obj](wxCommandEvent& e) {
|
||||
dlg.Bind(EVT_ENTER_IP_ADDRESS, [obj](wxCommandEvent& e) {
|
||||
auto selection_data_arr = wxSplit(e.GetString().ToStdString(), '|');
|
||||
|
||||
if (selection_data_arr.size() == 2) {
|
||||
@@ -8777,7 +8779,7 @@ bool GUI_App::check_and_keep_current_preset_changes(const wxString& caption, con
|
||||
if (!no_need_change && dlg.ShowModal() == wxID_CANCEL)
|
||||
return false;
|
||||
|
||||
auto reset_modifications = [this, is_called_from_configwizard]() {
|
||||
auto reset_modifications = [this]() {
|
||||
//if (is_called_from_configwizard)
|
||||
// return; // no need to discared changes. It will be done fromConfigWizard closing
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ void AuxiliaryList::on_context_menu(wxDataViewEvent& evt)
|
||||
}
|
||||
else {
|
||||
append_menu_item(menu, wxID_ANY, _L("Open"), wxEmptyString,
|
||||
[this, node](wxCommandEvent&)
|
||||
[node](wxCommandEvent&)
|
||||
{
|
||||
wxLaunchDefaultApplication(node->path, 0);
|
||||
});
|
||||
|
||||
@@ -1414,7 +1414,7 @@ void MenuFactory::create_default_menu()
|
||||
|
||||
append_menu_check_item(&m_default_menu, wxID_ANY, _L("Show Labels"), "",
|
||||
[](wxCommandEvent&) { plater()->show_view3D_labels(!plater()->are_view3D_labels_shown()); plater()->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, &m_default_menu,
|
||||
[]() { return plater()->is_view3D_shown(); }, [this]() { return plater()->are_view3D_labels_shown(); }, m_parent);
|
||||
[]() { return plater()->is_view3D_shown(); }, []() { return plater()->are_view3D_labels_shown(); }, m_parent);
|
||||
}
|
||||
|
||||
void MenuFactory::create_common_object_menu(wxMenu* menu)
|
||||
@@ -2090,7 +2090,7 @@ void MenuFactory::append_menu_item_clone(wxMenu* menu)
|
||||
static const wxString ctrl = _L("Ctrl+");
|
||||
#endif
|
||||
append_menu_item(menu, wxID_ANY, _L("Clone") + "\t" + ctrl + "K", "",
|
||||
[this](wxCommandEvent&) {
|
||||
[](wxCommandEvent&) {
|
||||
plater()->clone_selection();
|
||||
}, "", nullptr,
|
||||
[]() {
|
||||
@@ -2115,7 +2115,7 @@ void MenuFactory::append_menu_item_smooth_mesh(wxMenu *menu)
|
||||
void MenuFactory::append_menu_item_center(wxMenu* menu)
|
||||
{
|
||||
append_menu_item(menu, wxID_ANY, _L("Center") , "",
|
||||
[this](wxCommandEvent&) {
|
||||
[](wxCommandEvent&) {
|
||||
plater()->center_selection();
|
||||
}, "", nullptr,
|
||||
[]() {
|
||||
@@ -2134,7 +2134,7 @@ void MenuFactory::append_menu_item_center(wxMenu* menu)
|
||||
void MenuFactory::append_menu_item_drop(wxMenu* menu)
|
||||
{
|
||||
append_menu_item(menu, wxID_ANY, _L("Drop") , "",
|
||||
[this](wxCommandEvent&) {
|
||||
[](wxCommandEvent&) {
|
||||
plater()->drop_selection();
|
||||
}, "", nullptr,
|
||||
[]() {
|
||||
@@ -2309,7 +2309,7 @@ void MenuFactory::append_menu_item_set_printable(wxMenu* menu)
|
||||
}
|
||||
}
|
||||
|
||||
wxMenuItem* menu_item_set_printable = append_menu_check_item(menu, wxID_ANY, _L("Printable") + "\t" + "V", "", [this, all_printable](wxCommandEvent&) {
|
||||
wxMenuItem* menu_item_set_printable = append_menu_check_item(menu, wxID_ANY, _L("Printable") + "\t" + "V", "", [all_printable](wxCommandEvent&) {
|
||||
Selection& selection = plater()->canvas3D()->get_selection();
|
||||
selection.set_printable(!all_printable);
|
||||
}, menu);
|
||||
@@ -2329,7 +2329,7 @@ void MenuFactory::append_menu_item_set_auto_drop(wxMenu* menu)
|
||||
wxString menu_tooltip = _L("Automatically snaps the selected object to the build plate.");
|
||||
wxMenuItem* menu_item_set_auto_drop = append_menu_check_item(
|
||||
menu, wxID_ANY, menu_text, menu_tooltip,
|
||||
[this, current_auto_drop](wxCommandEvent&) {
|
||||
[current_auto_drop](wxCommandEvent&) {
|
||||
Selection& selection = plater()->canvas3D()->get_selection();
|
||||
selection.set_auto_drop(!current_auto_drop);
|
||||
},
|
||||
@@ -2384,7 +2384,7 @@ void MenuFactory::append_menu_item_plate_name(wxMenu *menu)
|
||||
|
||||
auto item = append_menu_item(
|
||||
menu, wxID_ANY, name, "",
|
||||
[plate](wxCommandEvent &e) {
|
||||
[](wxCommandEvent &e) {
|
||||
int hover_idx =plater()->canvas3D()->GetHoverId();
|
||||
if (hover_idx == -1) {
|
||||
int plate_idx=plater()->GetPlateIndexByRightMenuInLeftUI();
|
||||
|
||||
@@ -48,7 +48,7 @@ void ObjectLayers::select_editor(LayerRangeEditor* editor, const bool is_last_ed
|
||||
* And as a result we couldn't edit this control.
|
||||
* */
|
||||
#ifdef __WXOSX__
|
||||
wxTheApp->CallAfter([editor]() {
|
||||
wxTheApp->CallAfter([]() {
|
||||
#endif
|
||||
//editor->SetFocus();
|
||||
//editor->SelectAll();
|
||||
@@ -223,7 +223,7 @@ void ObjectLayers::update_layers_list()
|
||||
|
||||
// only call sizer->Clear(true) via CallAfter, otherwise crash happens in Linux when press enter in Height Range
|
||||
// because an element cannot be destroyed while there are pending events for this element.(https://github.com/wxWidgets/Phoenix/issues/1854)
|
||||
wxGetApp().CallAfter([this, type, objects_ctrl, range]() {
|
||||
wxGetApp().CallAfter([this, type, range]() {
|
||||
m_og->ctrl_parent()->Freeze();
|
||||
|
||||
// Delete all controls from options group
|
||||
|
||||
@@ -2324,7 +2324,7 @@ void ObjectList::load_modifier(const wxArrayString& input_files, ModelObject& mo
|
||||
bool split_compound = wxGetApp().app_config->get_bool("is_split_compound");
|
||||
model = Model::read_from_step(
|
||||
input_file, LoadStrategy::LoadModel, nullptr, nullptr,
|
||||
[this, &is_user_cancel, &linear, &angle, &split_compound](Slic3r::Step& file, double& linear_value,
|
||||
[&is_user_cancel, &linear, &angle, &split_compound](Slic3r::Step& file, double& linear_value,
|
||||
double& angle_value, bool& is_split) -> int {
|
||||
if (wxGetApp().app_config->get_bool("enable_step_mesh_setting")) {
|
||||
StepMeshDialog mesh_dlg(nullptr, file, linear, angle);
|
||||
@@ -3317,7 +3317,7 @@ void ObjectList::boolean()
|
||||
}
|
||||
}
|
||||
|
||||
TriangleMesh mesh = Plater::combine_mesh_fff(*object, -1, [this](const std::string& msg) {return wxGetApp().notification_manager()->push_plater_error_notification(msg); });
|
||||
TriangleMesh mesh = Plater::combine_mesh_fff(*object, -1, [](const std::string& msg) {return wxGetApp().notification_manager()->push_plater_error_notification(msg); });
|
||||
|
||||
// add mesh to model as a new object, keep the original object's name and config
|
||||
Model* model = object->get_model();
|
||||
@@ -6267,7 +6267,7 @@ void GUI::ObjectList::smooth_mesh()
|
||||
get_selection_indexes(obj_idxs, vol_idxs);
|
||||
auto object_idx = obj_idxs.front();
|
||||
ModelObject *obj{nullptr};
|
||||
auto show_warning_dlg = [this](int cur_face_count,std::string name,bool is_part) {
|
||||
auto show_warning_dlg = [](int cur_face_count,std::string name,bool is_part) {
|
||||
int limit_face_count = 1000000;
|
||||
if (cur_face_count > limit_face_count) {
|
||||
auto name_str = wxString::FromUTF8(name);
|
||||
@@ -6280,7 +6280,7 @@ void GUI::ObjectList::smooth_mesh()
|
||||
}
|
||||
return false;
|
||||
};
|
||||
auto show_smooth_mesh_error_dlg = [this](std::string name) {
|
||||
auto show_smooth_mesh_error_dlg = [](std::string name) {
|
||||
auto name_str = wxString::FromUTF8(name);
|
||||
auto content = wxString::Format(_L("\"%s\" part's mesh contains errors. Please repair it first."), name_str);
|
||||
WarningDialog dlg(static_cast<wxWindow *>(wxGetApp().mainframe), content, wxEmptyString, wxOK);
|
||||
|
||||
@@ -3520,13 +3520,13 @@ void GridCellTextEditor::BeginEdit(int row, int col, wxGrid *grid)
|
||||
Text()->GetTextCtrl()->SetInsertionPointEnd();
|
||||
|
||||
|
||||
m_control->Bind(wxEVT_TEXT_ENTER, [this, row, col, grid](wxCommandEvent &e) {
|
||||
m_control->Bind(wxEVT_TEXT_ENTER, [grid](wxCommandEvent &e) {
|
||||
grid->HideCellEditControl();
|
||||
grid->SaveEditControlValue();
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
m_control->Bind(wxEVT_CHAR_HOOK, [this, row, col, grid](wxKeyEvent &e) {
|
||||
m_control->Bind(wxEVT_CHAR_HOOK, [grid](wxKeyEvent &e) {
|
||||
if (e.GetKeyCode() == WXK_ESCAPE) {
|
||||
grid->HideCellEditControl();
|
||||
grid->SaveEditControlValue();
|
||||
|
||||
@@ -184,7 +184,7 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_
|
||||
btn->Bind(EVT_LOCK_ENABLE, [this, btn](auto &e) { btn->SetBitmap(m_bmp_reset_focus.bmp()); });
|
||||
#endif
|
||||
|
||||
btn->Bind(wxEVT_BUTTON, [btn, opt_key, this, is_object, object, config, group_category](wxEvent &event) {
|
||||
btn->Bind(wxEVT_BUTTON, [opt_key, this, is_object, object, config, group_category](wxEvent &event) {
|
||||
//wxGetApp().plater()->take_snapshot(from_u8((boost::format(_utf8(L("Reset Option %s"))) % opt_key).str()));
|
||||
config->erase(opt_key);
|
||||
//btn->Hide();
|
||||
@@ -204,10 +204,13 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_
|
||||
this->m_parent->Thaw();
|
||||
|
||||
#ifdef __WXOSX_MAC__
|
||||
if (!btn->IsEnabled()) {
|
||||
btn->SetBitmap(m_bmp_reset_disable.bmp());
|
||||
} else {
|
||||
btn->SetBitmap(m_bmp_reset_focus.bmp());
|
||||
// The handler is bound on the button, so the event source is that button.
|
||||
if (auto *btn = dynamic_cast<ScalableButton *>(event.GetEventObject())) {
|
||||
if (!btn->IsEnabled()) {
|
||||
btn->SetBitmap(m_bmp_reset_disable.bmp());
|
||||
} else {
|
||||
btn->SetBitmap(m_bmp_reset_focus.bmp());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
});
|
||||
@@ -284,13 +287,13 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_
|
||||
m_settings_list_sizer->Add(optgroup->sizer, 0, wxEXPAND | wxALL, 0);
|
||||
m_og_settings.push_back(optgroup);
|
||||
|
||||
auto toggle_field = [this, optgroup](const t_config_option_key & opt_key, bool toggle, int opt_index)
|
||||
auto toggle_field = [optgroup](const t_config_option_key & opt_key, bool toggle, int opt_index)
|
||||
{
|
||||
Field* field = optgroup->get_fieldc(opt_key, opt_index);;
|
||||
if (field)
|
||||
field->toggle(toggle);
|
||||
};
|
||||
auto toggle_line = [this, optgroup](const t_config_option_key &opt_key, bool toggle, int opt_index)
|
||||
auto toggle_line = [optgroup](const t_config_option_key &opt_key, bool toggle, int opt_index)
|
||||
{
|
||||
Line* line = optgroup->get_line(opt_key);
|
||||
if (line) line->toggle_visible = toggle;
|
||||
|
||||
@@ -3596,7 +3596,7 @@ void GLGizmoCut3D::perform_cut(const Selection& selection)
|
||||
// model_name failing reason
|
||||
std::vector<std::pair<std::string, std::string>> failed_models;
|
||||
auto plater = wxGetApp().plater();
|
||||
auto fix_and_update_progress = [this, plater, keep_painting](ModelObject *model_object, const int vol_idx, const string &model_name, ProgressDialog &progress_dlg,
|
||||
auto fix_and_update_progress = [keep_painting](ModelObject *model_object, const int vol_idx, const string &model_name, ProgressDialog &progress_dlg,
|
||||
std::vector<std::string> &succes_models, std::vector<std::pair<std::string, std::string>> &failed_models) {
|
||||
wxString msg = _L("Repairing model object");
|
||||
msg += ": " + from_u8(model_name) + "\n";
|
||||
|
||||
@@ -86,7 +86,6 @@ private:
|
||||
boost::thread m_thread;
|
||||
// Mutex and condition variable to synchronize m_thread with the UI thread.
|
||||
std::mutex m_mutex;
|
||||
int m_generate_count;
|
||||
|
||||
// This map holds all translated description texts, so they can be easily referenced during layout calculations
|
||||
// etc. When language changes, GUI is recreated and this class constructed again, so the change takes effect.
|
||||
|
||||
@@ -223,7 +223,7 @@ void GLGizmoMeshBoolean::on_render_input_window(float x, float y, float bottom_l
|
||||
|
||||
const int select_btn_length = 2 * ImGui::GetStyle().FramePadding.x + std::max(ImGui::CalcTextSize(("1 " + _u8L("selected")).c_str()).x, ImGui::CalcTextSize(_u8L("Select").c_str()).x);
|
||||
|
||||
auto selectable = [this](const std::string& label, bool selected, const ImVec2& size_arg) {
|
||||
auto selectable = [](const std::string& label, bool selected, const ImVec2& size_arg) {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, { 0,0 });
|
||||
|
||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||
|
||||
@@ -1456,7 +1456,7 @@ void TriangleSelectorPatch::update_triangles_per_patch()
|
||||
return touching_triangles;
|
||||
};
|
||||
|
||||
auto calc_fragment_area = [this](const TrianglePatch& patch, float max_limit_area, int stride) {
|
||||
auto calc_fragment_area = [](const TrianglePatch& patch, float max_limit_area, int stride) {
|
||||
double total_area = 0.f;
|
||||
const std::vector<int>& ti = patch.triangle_indices;
|
||||
/*for (int i = 0; i < ti.size() / 3; i++) {
|
||||
|
||||
@@ -1021,7 +1021,7 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt)
|
||||
// number waits briefly for a second one.
|
||||
const int digit = keyCode - '0';
|
||||
const int shortcut_max = int(GLGizmoMmuSegmentation::EXTRUDERS_LIMIT);
|
||||
auto can_start_two_digit = [shortcut_max](int d) { return d > 0 && d * 10 <= shortcut_max; };
|
||||
auto can_start_two_digit = [](int d) { return d > 0 && d * 10 <= shortcut_max; };
|
||||
auto select = [mmu_seg](int number) { return number > 0 && mmu_seg->on_number_key_down(number); };
|
||||
|
||||
if (m_timer_set_color.IsRunning() && m_pending_color_shortcut_tens > 0) {
|
||||
|
||||
@@ -239,7 +239,7 @@ void GizmoObjectManipulation::update_if_dirty()
|
||||
};
|
||||
|
||||
for (int i = 0; i < 3; ++ i) {
|
||||
auto update = [this, i](Vec3d &cached, Vec3d &cached_rounded, const Vec3d &new_value) {
|
||||
auto update = [i](Vec3d &cached, Vec3d &cached_rounded, const Vec3d &new_value) {
|
||||
//wxString new_text = double_to_string(new_value(i), 2);
|
||||
double new_rounded = round(new_value(i)*100)/100.0;
|
||||
//new_text.ToDouble(&new_rounded);
|
||||
|
||||
@@ -46,7 +46,7 @@ int get_hms_info_version(std::string& version)
|
||||
std::string url = (boost::format("https://%1%/GetVersion.php?%2%") % hms_host % query_params).str();
|
||||
Slic3r::Http http = Slic3r::Http::get(url);
|
||||
http.timeout_max(10)
|
||||
.on_complete([&result, &version](std::string body, unsigned status){
|
||||
.on_complete([&version](std::string body, unsigned status){
|
||||
try {
|
||||
json j = json::parse(body);
|
||||
if (j.contains("ver")) {
|
||||
@@ -95,7 +95,7 @@ int HMSQuery::download_hms_related(const std::string& hms_type, const std::strin
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "hms: download url = " << url;
|
||||
Slic3r::Http http = Slic3r::Http::get(url);
|
||||
http.on_complete([this, receive_json, hms_type, &to_save_local, &j, & local_version](std::string body, unsigned status) {
|
||||
http.on_complete([receive_json, hms_type, &to_save_local, &j, & local_version](std::string body, unsigned status) {
|
||||
try {
|
||||
j = json::parse(body);
|
||||
if (j.contains("result")) {
|
||||
|
||||
@@ -176,7 +176,6 @@ private:
|
||||
// Use those values to disable selection of active extruders
|
||||
bool m_is_dark = false;
|
||||
|
||||
bool is_osx{false};
|
||||
int m_min_value;
|
||||
int m_max_value;
|
||||
int m_lower_value;
|
||||
@@ -201,10 +200,6 @@ private:
|
||||
void *m_one_layer_on_hover_id;
|
||||
void *m_one_layer_off_id;
|
||||
void *m_one_layer_off_hover_id;
|
||||
void* m_one_layer_on_light_id;
|
||||
void* m_one_layer_on_hover_light_id;
|
||||
void* m_one_layer_off_light_id;
|
||||
void* m_one_layer_off_hover_light_id;
|
||||
void* m_one_layer_on_dark_id;
|
||||
void* m_one_layer_on_hover_dark_id;
|
||||
void* m_one_layer_off_dark_id;
|
||||
|
||||
@@ -2482,6 +2482,19 @@ static const ImWchar ranges_keyboard_shortcuts[] =
|
||||
};
|
||||
#endif // __APPLE__
|
||||
|
||||
// Names drawn through the atlas come from file names and CAD data, not from the UI language.
|
||||
// GetGlyphRangesDefault() already gives every language the CJK ideographs, which is why a
|
||||
// Chinese file name renders under an English UI; these are the alphabetic scripts it omits.
|
||||
// Codepoints the font lacks are skipped at build time, so only existing glyphs cost anything.
|
||||
static const ImWchar ranges_language_independent[] =
|
||||
{
|
||||
0x0100, 0x024F, // Latin Extended-A and Extended-B
|
||||
0x0370, 0x03FF, // Greek and Coptic
|
||||
0x0400, 0x04FF, // Cyrillic
|
||||
0x1E00, 0x1EFF, // Latin Extended Additional (Vietnamese)
|
||||
0,
|
||||
};
|
||||
|
||||
|
||||
std::vector<unsigned char> ImGuiWrapper::load_svg(const std::string& bitmap_name, unsigned target_width, unsigned target_height, unsigned *outwidth, unsigned *outheight)
|
||||
{
|
||||
@@ -2792,6 +2805,7 @@ void ImGuiWrapper::init_font(bool compress)
|
||||
ImFontAtlas::GlyphRangesBuilder builder;
|
||||
builder.AddRanges(m_glyph_ranges);
|
||||
builder.AddRanges(ImGui::GetIO().Fonts->GetGlyphRangesDefault());
|
||||
builder.AddRanges(ranges_language_independent);
|
||||
#ifdef __APPLE__
|
||||
if (m_font_cjk)
|
||||
// Apple keyboard shortcuts are only contained in the CJK fonts.
|
||||
@@ -2813,12 +2827,17 @@ void ImGuiWrapper::init_font(bool compress)
|
||||
// Orca: temp fix for Korean font
|
||||
auto font_name_regular = "HarmonyOS_Sans_SC_Regular.ttf";
|
||||
auto font_name_bold = "HarmonyOS_Sans_SC_Bold.ttf";
|
||||
// The Korean and Thai fonts cover their own script and little else, so they need the
|
||||
// default font merged in behind them to reach the full range.
|
||||
bool needs_glyph_fallback = false;
|
||||
if(m_glyph_ranges == ImGui::GetIO().Fonts->GetGlyphRangesKorean()) {
|
||||
font_name_regular = "NanumGothic-Regular.ttf";
|
||||
font_name_bold = "NanumGothic-Bold.ttf";
|
||||
needs_glyph_fallback = true;
|
||||
} else if (m_glyph_ranges == ImGui::GetIO().Fonts->GetGlyphRangesThai()) {
|
||||
font_name_regular = "Sarabun-Medium.ttf";
|
||||
font_name_bold = "Sarabun-SemiBold.ttf";
|
||||
needs_glyph_fallback = true;
|
||||
}
|
||||
default_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + font_name_regular).c_str(), m_font_size, &cfg, ranges.Data);
|
||||
if (default_font == nullptr) {
|
||||
@@ -2828,11 +2847,12 @@ void ImGuiWrapper::init_font(bool compress)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_glyph_ranges == ImGui::GetIO().Fonts->GetGlyphRangesThai()) {
|
||||
// A merged font only supplies glyphs the font ahead of it lacks, so this fills the gaps
|
||||
// without restyling anything the script font already covers.
|
||||
if (needs_glyph_fallback) {
|
||||
ImFontConfig fallback_cfg = cfg;
|
||||
fallback_cfg.MergeMode = true;
|
||||
static constexpr ImWchar celsius_range[] = { 0x2103, 0x2103, 0 };
|
||||
io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/HarmonyOS_Sans_SC_Regular.ttf").c_str(), m_font_size, &fallback_cfg, celsius_range);
|
||||
io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/HarmonyOS_Sans_SC_Regular.ttf").c_str(), m_font_size, &fallback_cfg, ranges.Data);
|
||||
}
|
||||
|
||||
bold_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + font_name_bold).c_str(), m_font_size, &cfg, ranges.Data);
|
||||
@@ -2841,11 +2861,10 @@ void ImGuiWrapper::init_font(bool compress)
|
||||
if (bold_font == nullptr) { throw Slic3r::RuntimeError("ImGui: Could not load deafult font"); }
|
||||
}
|
||||
|
||||
if (m_glyph_ranges == ImGui::GetIO().Fonts->GetGlyphRangesThai()) {
|
||||
if (needs_glyph_fallback) {
|
||||
ImFontConfig fallback_cfg = cfg;
|
||||
fallback_cfg.MergeMode = true;
|
||||
static constexpr ImWchar celsius_range[] = { 0x2103, 0x2103, 0 };
|
||||
io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/HarmonyOS_Sans_SC_Bold.ttf").c_str(), m_font_size, &fallback_cfg, celsius_range);
|
||||
io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/HarmonyOS_Sans_SC_Bold.ttf").c_str(), m_font_size, &fallback_cfg, ranges.Data);
|
||||
}
|
||||
|
||||
if (m_glyph_ranges == ImGui::GetIO().Fonts->GetGlyphRangesThai()) {
|
||||
@@ -2897,13 +2916,18 @@ void ImGuiWrapper::init_font(bool compress)
|
||||
glsafe(::glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_max_tex_size));
|
||||
constexpr int max_retries = 6;
|
||||
for (int attempt = 0; attempt < max_retries && io.Fonts->TexHeight > gl_max_tex_size; ++attempt) {
|
||||
io.Fonts->TexDesiredWidth = (io.Fonts->TexDesiredWidth > 0 ? io.Fonts->TexDesiredWidth : io.Fonts->TexWidth) * 2;
|
||||
const int width = io.Fonts->TexDesiredWidth > 0 ? io.Fonts->TexDesiredWidth : io.Fonts->TexWidth;
|
||||
// Both dimensions share the same limit, so widening past it would only trade an
|
||||
// illegal height for an illegal width.
|
||||
if (width * 2 > gl_max_tex_size)
|
||||
break;
|
||||
io.Fonts->TexDesiredWidth = width * 2;
|
||||
io.Fonts->Build();
|
||||
}
|
||||
if (io.Fonts->TexHeight > gl_max_tex_size) {
|
||||
// Shouldn't really happen
|
||||
BOOST_LOG_TRIVIAL(error) << "Font atlas height " << io.Fonts->TexHeight
|
||||
<< " still exceeds GL_MAX_TEXTURE_SIZE (" << gl_max_tex_size << ")"
|
||||
// Needs both a very large glyph set and a small GL_MAX_TEXTURE_SIZE.
|
||||
BOOST_LOG_TRIVIAL(error) << "Font atlas " << io.Fonts->TexWidth << "x" << io.Fonts->TexHeight
|
||||
<< " does not fit GL_MAX_TEXTURE_SIZE (" << gl_max_tex_size << ")"
|
||||
<< " after " << max_retries << " attempts; rendering may be incomplete";
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ void FillBedJob::prepare()
|
||||
ap.poly = m_selected.front().poly;
|
||||
ap.bed_idx = PartPlateList::MAX_PLATES_COUNT;
|
||||
ap.itemid = -1;
|
||||
ap.setter = [this, mi, offset](const ArrangePolygon &p) {
|
||||
ap.setter = [this, offset](const ArrangePolygon &p) {
|
||||
ModelObject *mo = m_plater->model().objects[m_object_idx];
|
||||
ModelObject *obj;
|
||||
if (m_instances) {
|
||||
|
||||
@@ -79,9 +79,12 @@ class PlaterWorker: public Worker {
|
||||
steady_clock::time_point finalize_end = steady_clock::now();
|
||||
long long finalize_duration = duration_cast<milliseconds>(finalize_end - finalize_start).count();
|
||||
|
||||
// Bound first so typeid's operand is not a call. typeid evaluates it for a
|
||||
// polymorphic type, which clang reports as -Wpotentially-evaluated-expression.
|
||||
const Job &job = *m_job;
|
||||
BOOST_LOG_TRIVIAL(info)
|
||||
<< std::fixed // do not use scientific notations
|
||||
<< "Job '" << typeid(*m_job).name() << "' "
|
||||
<< "Job '" << typeid(job).name() << "' "
|
||||
<< "spend " << m_process_duration + finalize_duration << "ms "
|
||||
<< "(process " << m_process_duration << "ms + finalize " << finalize_duration << "ms)";
|
||||
|
||||
|
||||
@@ -135,7 +135,6 @@ void PrintJob::process(Ctl &ctl)
|
||||
{
|
||||
/* display info */
|
||||
std::string msg;
|
||||
wxString error_str;
|
||||
int curr_percent = 10;
|
||||
NetworkAgent* m_agent = wxGetApp().getAgent();
|
||||
AppConfig* config = wxGetApp().app_config;
|
||||
@@ -402,9 +401,7 @@ void PrintJob::process(Ctl &ctl)
|
||||
&is_try_lan_mode,
|
||||
&is_try_lan_mode_failed,
|
||||
&msg,
|
||||
&error_str,
|
||||
&curr_percent,
|
||||
&error_text,
|
||||
StagePercentPoint
|
||||
](int stage, int code, std::string info) {
|
||||
|
||||
@@ -491,7 +488,7 @@ void PrintJob::process(Ctl &ctl)
|
||||
DeviceManager* dev = wxGetApp().getDeviceManager();
|
||||
MachineObject* obj = dev->get_selected_machine();
|
||||
|
||||
auto wait_fn = [this, &ctl, curr_percent, &obj](int state, std::string job_info) {
|
||||
auto wait_fn = [&ctl, &obj](int state, std::string job_info) {
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: get_job_info = " << job_info;
|
||||
|
||||
if (!obj->is_support_wait_sending_finish) {
|
||||
|
||||
@@ -55,7 +55,7 @@ void RotoptimizeJob::process(Ctl &ctl)
|
||||
sla::RotOptimizeParams{}
|
||||
.accuracy(m_accuracy)
|
||||
.print_config(&m_default_print_cfg)
|
||||
.statucb([this, &prev_status, &ctl/*, &statustxt*/](int s)
|
||||
.statucb([&ctl/*, &statustxt*/](int s)
|
||||
{
|
||||
return !ctl.was_canceled();
|
||||
});
|
||||
|
||||
@@ -213,7 +213,6 @@ void SendJob::process(Ctl &ctl)
|
||||
params.password = m_access_code;
|
||||
params.use_ssl_for_ftp = m_local_use_ssl_for_ftp;
|
||||
params.use_ssl_for_mqtt = m_local_use_ssl;
|
||||
wxString error_text;
|
||||
std::string msg_text;
|
||||
|
||||
const int StagePercentPoint[(int)PrintingStageFinished + 1] = {
|
||||
@@ -227,7 +226,7 @@ void SendJob::process(Ctl &ctl)
|
||||
};
|
||||
|
||||
auto update_fn = [this, &ctl,
|
||||
&msg, &curr_percent, &error_text, StagePercentPoint](int stage, int code, std::string info) {
|
||||
&msg, &curr_percent, StagePercentPoint](int stage, int code, std::string info) {
|
||||
if (stage == SendingPrintJobStage::PrintingStageCreate) {
|
||||
if (this->connection_type == "lan") {
|
||||
msg = _u8L("Sending G-code file over LAN");
|
||||
|
||||
@@ -750,7 +750,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
|
||||
evt.Skip();
|
||||
});
|
||||
|
||||
Bind(wxEVT_SHOW, [this](wxShowEvent &evt) {
|
||||
Bind(wxEVT_SHOW, [](wxShowEvent &evt) {
|
||||
DeviceManager *manger = wxGetApp().getDeviceManager();
|
||||
if (manger) {
|
||||
evt.IsShown() ? manger->start_refresher() : manger->stop_refresher();
|
||||
@@ -2906,12 +2906,12 @@ void MainFrame::init_menubar_as_editor()
|
||||
[this](wxCommandEvent&) { if (m_plater) { m_plater->add_model(); } }, "", nullptr,
|
||||
[this](){return can_add_models(); }, this);
|
||||
#endif
|
||||
append_menu_item(import_menu, wxID_ANY, _L("Import Zip Archive") + dots, _L("Load models contained within a zip archive"),
|
||||
append_menu_item(import_menu, wxID_ANY, _L("Import ZIP Archive") + dots, _L("Load models contained within a ZIP archive"),
|
||||
[this](wxCommandEvent&) { if (m_plater) m_plater->import_zip_archive(); }, "menu_import", nullptr,
|
||||
[this]() { return can_add_models(); });
|
||||
append_menu_item(import_menu, wxID_ANY, _L("Import Configs") + dots /*+ "\t" + ctrl + "I"*/, _L("Load configs"),
|
||||
[this](wxCommandEvent&) { load_config_file(); }, "menu_import", nullptr,
|
||||
[this](){return true; }, this);
|
||||
[](){return true; }, this);
|
||||
|
||||
append_submenu(fileMenu, import_menu, wxID_ANY, _L("Import"), "");
|
||||
|
||||
@@ -3024,7 +3024,7 @@ void MainFrame::init_menubar_as_editor()
|
||||
_L("Duplicate the current plate"),[this](wxCommandEvent&) {
|
||||
m_plater->duplicate_plate();
|
||||
},
|
||||
"menu_remove", nullptr, [this](){return true;}, this);
|
||||
"menu_remove", nullptr, [](){return true;}, this);
|
||||
editMenu->AppendSeparator();
|
||||
#else
|
||||
// BBS undo
|
||||
@@ -3124,10 +3124,10 @@ void MainFrame::init_menubar_as_editor()
|
||||
"", nullptr, [this](){return can_clone(); }, this);
|
||||
editMenu->AppendSeparator();
|
||||
append_menu_item(editMenu, wxID_ANY, _L("Duplicate Current Plate"),
|
||||
_L("Duplicate the current plate"),[this, handle_key_event](wxCommandEvent&) {
|
||||
_L("Duplicate the current plate"),[this](wxCommandEvent&) {
|
||||
m_plater->duplicate_plate();
|
||||
},
|
||||
"", nullptr, [this](){return true;}, this);
|
||||
"", nullptr, [](){return true;}, this);
|
||||
editMenu->AppendSeparator();
|
||||
|
||||
#endif
|
||||
@@ -3191,13 +3191,13 @@ void MainFrame::init_menubar_as_editor()
|
||||
//BBS perspective view
|
||||
wxWindowID camera_id_base = wxWindow::NewControlId(int(wxID_CAMERA_COUNT));
|
||||
auto perspective_item = append_menu_radio_item(viewMenu, wxID_CAMERA_PERSPECTIVE + camera_id_base, _L("Use Perspective View"), _L("Use Perspective View"),
|
||||
[this](wxCommandEvent&) {
|
||||
[](wxCommandEvent&) {
|
||||
wxGetApp().app_config->set_bool("use_perspective_camera", true);
|
||||
wxGetApp().update_ui_from_settings();
|
||||
}, nullptr);
|
||||
//BBS 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&) {
|
||||
[](wxCommandEvent&) {
|
||||
wxGetApp().app_config->set_bool("use_perspective_camera", false);
|
||||
wxGetApp().update_ui_from_settings();
|
||||
}, nullptr);
|
||||
@@ -3213,7 +3213,7 @@ void MainFrame::init_menubar_as_editor()
|
||||
m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
|
||||
},
|
||||
this, [this]() { return is_prepare_or_preview_tab(); },
|
||||
[this]() { return wxGetApp().app_config->get_bool("auto_perspective"); }, this);
|
||||
[]() { return wxGetApp().app_config->get_bool("auto_perspective"); }, this);
|
||||
|
||||
viewMenu->AppendSeparator();
|
||||
append_menu_check_item(viewMenu, wxID_ANY, _L("Show &G-code Window") + sep + "C", _L("Show G-code window in Preview scene."),
|
||||
@@ -3222,7 +3222,7 @@ void MainFrame::init_menubar_as_editor()
|
||||
m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
|
||||
},
|
||||
this, [this]() { return m_tabpanel->GetSelectedPageName() == TAB_ID_PREVIEW; },
|
||||
[this]() { return wxGetApp().show_gcode_window(); }, this);
|
||||
[]() { return wxGetApp().show_gcode_window(); }, this);
|
||||
|
||||
append_menu_check_item(
|
||||
viewMenu, wxID_ANY, _L("Show 3D Navigator"), _L("Show 3D navigator in Prepare and Preview scene."),
|
||||
@@ -3231,7 +3231,7 @@ void MainFrame::init_menubar_as_editor()
|
||||
m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
|
||||
},
|
||||
this, [this]() { return is_prepare_or_preview_tab(); },
|
||||
[this]() { return wxGetApp().show_3d_navigator(); }, this);
|
||||
[]() { return wxGetApp().show_3d_navigator(); }, this);
|
||||
|
||||
append_menu_check_item(viewMenu, wxID_ANY, _L("Show Gridlines"), _L("Show Gridlines on plate"),
|
||||
[this](wxCommandEvent&) {
|
||||
@@ -3239,7 +3239,7 @@ void MainFrame::init_menubar_as_editor()
|
||||
m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
|
||||
}, this,
|
||||
[this]() { return is_prepare_or_preview_tab(); },
|
||||
[this]() { return wxGetApp().show_plate_gridlines(); }, this);
|
||||
[]() { return wxGetApp().show_plate_gridlines(); }, this);
|
||||
|
||||
append_menu_item(
|
||||
viewMenu, wxID_ANY, _L("Reset Window Layout"), _L("Reset to default window layout"),
|
||||
@@ -3268,7 +3268,7 @@ void MainFrame::init_menubar_as_editor()
|
||||
m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
|
||||
},
|
||||
this, [this]() { return m_tabpanel->GetSelectedPageName() == TAB_ID_PREPARE; },
|
||||
[this]() { return wxGetApp().show_outline(); }, this);
|
||||
[]() { return wxGetApp().show_outline(); }, this);
|
||||
|
||||
/*viewMenu->AppendSeparator();
|
||||
append_menu_check_item(viewMenu, wxID_ANY, _L("Show &Wireframe") + "\t" + ctrl + shift + _L("Enter"), _L("Show wireframes in 3D scene."),
|
||||
@@ -3394,11 +3394,11 @@ void MainFrame::init_menubar_as_editor()
|
||||
//parent_menu->Insert(0, about_item);
|
||||
append_menu_item(
|
||||
parent_menu, wxID_ANY, _L(about_title), "",
|
||||
[this](wxCommandEvent &) { Slic3r::GUI::about();},
|
||||
[](wxCommandEvent &) { Slic3r::GUI::about();},
|
||||
"", nullptr, []() { return true; }, this, 0);
|
||||
append_menu_item(
|
||||
parent_menu, wxID_ANY, _L("Preferences") + "\t" + ctrl + ",", "",
|
||||
[this](wxCommandEvent &) {
|
||||
[](wxCommandEvent &) {
|
||||
wxGetApp().open_preferences();
|
||||
},
|
||||
"", nullptr, []() { return true; }, this, 1);
|
||||
@@ -3417,7 +3417,7 @@ void MainFrame::init_menubar_as_editor()
|
||||
|
||||
append_menu_item(
|
||||
m_topbar->GetTopMenu(), wxID_ANY, _L("Preferences") + "\t" + ctrl + "P", "",
|
||||
[this](wxCommandEvent &) {
|
||||
[](wxCommandEvent &) {
|
||||
// Orca: Use GUI_App::open_preferences instead of direct call so windows associations are updated on exit
|
||||
wxGetApp().open_preferences();
|
||||
},
|
||||
@@ -3449,14 +3449,14 @@ void MainFrame::init_menubar_as_editor()
|
||||
into_u8(_L("Syncing presets from cloud\u2026")));
|
||||
wxGetApp().restart_sync_user_preset();
|
||||
}, "", nullptr,
|
||||
[this]() {
|
||||
[]() {
|
||||
return wxGetApp().is_user_login() && !wxGetApp().app_config->get_stealth_mode();
|
||||
}, this);
|
||||
|
||||
top_menu->AppendSeparator();
|
||||
append_menu_item(
|
||||
top_menu, wxID_ANY, _L("Plugins") + "\t", "",
|
||||
[this](wxCommandEvent &) {
|
||||
[](wxCommandEvent &) {
|
||||
wxGetApp().open_plugins_dialog();
|
||||
},
|
||||
"", nullptr, []() { return true; }, this);
|
||||
@@ -3557,7 +3557,7 @@ void MainFrame::init_menubar_as_editor()
|
||||
[this]() {return m_plater->is_view3D_shown();; }, this);
|
||||
|
||||
// help
|
||||
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Calibration Guide"), _L("Calibration Guide"), [this](wxCommandEvent &)
|
||||
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Calibration Guide"), _L("Calibration Guide"), [](wxCommandEvent &)
|
||||
{ wxLaunchDefaultBrowser("https://www.orcaslicer.com/wiki/calibration_guide", wxBROWSER_NEW_WINDOW); }, "", nullptr, [this]()
|
||||
{return m_plater->is_view3D_shown();; }, this);
|
||||
|
||||
@@ -3586,13 +3586,13 @@ void MainFrame::init_menubar_as_editor()
|
||||
into_u8(_L("Syncing presets from cloud\u2026")));
|
||||
wxGetApp().restart_sync_user_preset();
|
||||
}, "", nullptr,
|
||||
[this]() {
|
||||
[]() {
|
||||
return wxGetApp().is_user_login() && !wxGetApp().app_config->get_stealth_mode();
|
||||
}, this);
|
||||
|
||||
fileMenu->AppendSeparator();
|
||||
append_menu_item(
|
||||
fileMenu, wxID_ANY, _L("Plugins"), "", [this](wxCommandEvent&) { wxGetApp().open_plugins_dialog(); }, "", nullptr,
|
||||
fileMenu, wxID_ANY, _L("Plugins"), "", [](wxCommandEvent&) { wxGetApp().open_plugins_dialog(); }, "", nullptr,
|
||||
[]() { return true; }, this);
|
||||
|
||||
fileMenu->AppendSeparator();
|
||||
@@ -3696,7 +3696,7 @@ void MainFrame::init_menubar_as_editor()
|
||||
[this]() {return m_plater->is_view3D_shown();; }, this);
|
||||
// help
|
||||
append_menu_item(calib_menu, wxID_ANY, _L("Calibration Guide"), _L("Calibration Guide"),
|
||||
[this](wxCommandEvent&) { wxLaunchDefaultBrowser("https://www.orcaslicer.com/wiki/calibration_guide", wxBROWSER_NEW_WINDOW); }, "", nullptr,
|
||||
[](wxCommandEvent&) { wxLaunchDefaultBrowser("https://www.orcaslicer.com/wiki/calibration_guide", wxBROWSER_NEW_WINDOW); }, "", nullptr,
|
||||
[this]() {return m_plater->is_view3D_shown();; }, this);
|
||||
|
||||
m_menubar->Append(calib_menu,wxString::Format("&%s", _L("Calibration")));
|
||||
|
||||
@@ -61,7 +61,6 @@ private:
|
||||
::Button *m_button_year = nullptr;
|
||||
::Button *m_button_month = nullptr;
|
||||
::Button *m_button_all = nullptr;
|
||||
::Label *m_switch_label = nullptr;
|
||||
|
||||
::StaticBox * m_type_panel = nullptr;
|
||||
::Button * m_button_video = nullptr;
|
||||
|
||||
@@ -39,13 +39,14 @@ static std::map<int, std::string> error_messages = {
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const wxPoint &pos, const wxSize &size)
|
||||
MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl3 *media_ctrl, const wxPoint &pos, const wxSize &size)
|
||||
: wxPanel(parent, wxID_ANY, pos, size)
|
||||
, m_media_ctrl(media_ctrl)
|
||||
{
|
||||
SetLabel("MediaPlayCtrl");
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
m_media_ctrl->Bind(wxEVT_MEDIA_STATECHANGED, &MediaPlayCtrl::onStateChanged, this);
|
||||
m_media_ctrl->SetIdleImage(from_u8(resources_dir() + "/images/live_stream_default.png"));
|
||||
|
||||
m_button_play = new Button(this, "", "media_play", wxBORDER_NONE);
|
||||
m_button_play->SetCanFocus(false);
|
||||
@@ -177,13 +178,6 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
||||
if (machine == m_machine) {
|
||||
if (m_last_state == MEDIASTATE_IDLE && IsEnabled())
|
||||
Play();
|
||||
else if (m_last_state == MEDIASTATE_LOADING && m_tutk_state == "disable"
|
||||
&& m_last_user_play + wxTimeSpan::Seconds(3) < wxDateTime::Now()) {
|
||||
// resend ttcode to printer
|
||||
if (auto agent = wxGetApp().getAgent())
|
||||
agent->get_camera_url(machine, [](auto) {}, wxGetApp().get_printer_cloud_provider());
|
||||
m_last_user_play = wxDateTime::Now();
|
||||
}
|
||||
return;
|
||||
}
|
||||
m_machine = machine;
|
||||
@@ -313,7 +307,7 @@ void MediaPlayCtrl::Play()
|
||||
// !m_lan_mode && !m_remote_proto && m_lan_proto == LVL_None (x)
|
||||
|
||||
if (m_lan_proto <= MachineObject::LVL_Disable && (m_lan_mode || !m_remote_proto)) {
|
||||
Stop(m_lan_proto == MachineObject::LVL_None
|
||||
Stop(m_lan_proto == MachineObject::LVL_None
|
||||
? _L("A problem occurred. Please update the printer firmware and try again.")
|
||||
: _L("LAN Only Liveview is off. Please turn on the liveview on printer screen."));
|
||||
return;
|
||||
@@ -351,7 +345,7 @@ void MediaPlayCtrl::Play()
|
||||
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
||||
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_passwd(url,
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_passwd(url,
|
||||
{"?uid=", "authkey=", "passwd=", "license=", "token="});
|
||||
CallAfter([this, m, url] {
|
||||
if (m != m_machine) {
|
||||
@@ -426,7 +420,7 @@ void MediaPlayCtrl::Stop(wxString const &msg, wxString const &msg2)
|
||||
auto tunnel = m_url.empty() ? "" : into_u8(wxURI(m_url).GetPath()).substr(1);
|
||||
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
|
||||
if (last_state != wxMEDIASTATE_PLAYING && m_failed_code != 0
|
||||
&& m_last_failed_codes.find(m_failed_code) == m_last_failed_codes.end()
|
||||
&& (m_user_triggered || m_failed_retry > 3)) {
|
||||
m_last_failed_codes.insert(m_failed_code);
|
||||
@@ -500,13 +494,13 @@ void MediaPlayCtrl::ToggleStream()
|
||||
DownloadProgressDialog2(MediaPlayCtrl *ctrl) : DownloadProgressDialog(_L("Downloading Virtual Camera Tools")), ctrl(ctrl) {}
|
||||
struct UpgradeNetworkJob2 : UpgradeNetworkJob
|
||||
{
|
||||
UpgradeNetworkJob2(std::shared_ptr<ProgressIndicator> pri) : UpgradeNetworkJob() {
|
||||
UpgradeNetworkJob2() {
|
||||
name = "cameratools";
|
||||
package_name = "camera_tools.zip";
|
||||
}
|
||||
};
|
||||
std::shared_ptr<UpgradeNetworkJob> make_job(std::shared_ptr<ProgressIndicator> pri)
|
||||
{ return std::make_shared<UpgradeNetworkJob2>(pri); }
|
||||
std::unique_ptr<UpgradeNetworkJob> make_job() override
|
||||
{ return std::make_unique<UpgradeNetworkJob2>(); }
|
||||
void on_finish() override
|
||||
{
|
||||
ctrl->CallAfter([ctrl = this->ctrl] { ctrl->ToggleStream(); });
|
||||
@@ -560,7 +554,7 @@ void MediaPlayCtrl::ToggleStream()
|
||||
url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid");
|
||||
url += "&cli_ver=" + std::string(SLIC3R_VERSION);
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_passwd(url,
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_passwd(url,
|
||||
{"?uid=", "authkey=", "passwd=", "license=", "token="});
|
||||
CallAfter([this, m, url] {
|
||||
if (m != m_machine) return;
|
||||
@@ -580,8 +574,8 @@ void MediaPlayCtrl::ToggleStream()
|
||||
}, wxGetApp().get_printer_cloud_provider());
|
||||
}
|
||||
|
||||
void MediaPlayCtrl::msw_rescale() {
|
||||
m_button_play->Rescale();
|
||||
void MediaPlayCtrl::msw_rescale() {
|
||||
m_button_play->Rescale();
|
||||
}
|
||||
|
||||
void MediaPlayCtrl::jump_to_play()
|
||||
@@ -715,7 +709,9 @@ void MediaPlayCtrl::media_proc()
|
||||
break;
|
||||
}
|
||||
else if (url == "<play>") {
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: start play";
|
||||
m_media_ctrl->Play();
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: end play";
|
||||
}
|
||||
else {
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: start load";
|
||||
@@ -771,15 +767,15 @@ bool MediaPlayCtrl::start_stream_service(bool *need_install)
|
||||
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::process::child process_source(file_source, file_url2.ToStdWstring(), boost::process::start_dir(tools_dir),
|
||||
boost::process::windows::create_no_window,
|
||||
boost::process::child process_source(file_source, file_url2.ToStdWstring(), boost::process::start_dir(tools_dir),
|
||||
boost::process::windows::create_no_window,
|
||||
boost::process::std_out > intermediate, boost::process::limit_handles);
|
||||
boost::process::child process_ffmpeg(file_ffmpeg, configss, boost::process::windows::create_no_window,
|
||||
boost::process::child process_ffmpeg(file_ffmpeg, configss, boost::process::windows::create_no_window,
|
||||
boost::process::std_in < intermediate, boost::process::limit_handles);
|
||||
#else
|
||||
boost::filesystem::permissions(file_source, boost::filesystem::owner_exe | boost::filesystem::add_perms);
|
||||
boost::filesystem::permissions(file_ffmpeg, boost::filesystem::owner_exe | boost::filesystem::add_perms);
|
||||
boost::process::child process_source(file_source, file_url2.data().AsInternal(), boost::process::start_dir(start_dir),
|
||||
boost::process::child process_source(file_source, file_url2.data().AsInternal(), boost::process::start_dir(start_dir),
|
||||
boost::process::std_out > intermediate, boost::process::limit_handles);
|
||||
boost::process::child process_ffmpeg(file_ffmpeg, configss, boost::process::std_in < intermediate, boost::process::limit_handles);
|
||||
#endif
|
||||
@@ -830,27 +826,16 @@ bool MediaPlayCtrl::get_stream_url(std::string *url)
|
||||
|
||||
}}
|
||||
|
||||
void wxMediaCtrl2::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
void wxMediaCtrl_OnSize(wxWindow * ctrl, wxSize const & videoSize, int width, int height)
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
wxWindow::DoSetSize(x, y, width, height, sizeFlags);
|
||||
#else
|
||||
wxMediaCtrl::DoSetSize(x, y, width, height, sizeFlags);
|
||||
#endif
|
||||
#if defined(__LINUX__) && defined(__WXGTK__)
|
||||
if (m_gtk_video_window) {
|
||||
const wxSize client_size = GetClientSize();
|
||||
m_gtk_video_window->SetSize(0, 0, client_size.GetWidth(), client_size.GetHeight());
|
||||
}
|
||||
#endif
|
||||
if (sizeFlags & wxSIZE_USE_EXISTING) return;
|
||||
wxSize size = m_video_size;
|
||||
wxSize size = videoSize;
|
||||
if (!size.IsFullySpecified()) size = {16, 9};
|
||||
int maxHeight = (width * size.GetHeight() + size.GetHeight() - 1) / size.GetWidth();
|
||||
if (maxHeight != GetMaxHeight()) {
|
||||
// BOOST_LOG_TRIVIAL(info) << "wxMediaCtrl2::DoSetSize: width: " << width << ", height: " << height << ", maxHeight: " << maxHeight;
|
||||
SetMaxSize({-1, maxHeight});
|
||||
CallAfter([this] {
|
||||
if (auto p = GetParent()) {
|
||||
if (maxHeight != ctrl->GetMaxHeight()) {
|
||||
// BOOST_LOG_TRIVIAL(info) << "wxMediaCtrl_OnSize: width: " << width << ", height: " << height << ", maxHeight: " << maxHeight;
|
||||
ctrl->SetMaxSize({-1, maxHeight});
|
||||
ctrl->CallAfter([ctrl] {
|
||||
if (auto p = ctrl->GetParent()) {
|
||||
p->Layout();
|
||||
p->Refresh();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#ifndef MediaPlayCtrl_h
|
||||
#define MediaPlayCtrl_h
|
||||
|
||||
#include "wxMediaCtrl2.h"
|
||||
#include "wxMediaCtrl3.h"
|
||||
|
||||
#include <wx/panel.h>
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace GUI {
|
||||
class MediaPlayCtrl : public wxPanel
|
||||
{
|
||||
public:
|
||||
MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize);
|
||||
MediaPlayCtrl(wxWindow *parent, wxMediaCtrl3 *media_ctrl, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize);
|
||||
|
||||
~MediaPlayCtrl();
|
||||
|
||||
@@ -75,7 +75,7 @@ private:
|
||||
// token
|
||||
std::shared_ptr<int> m_token = std::make_shared<int>(0);
|
||||
|
||||
wxMediaCtrl2 * m_media_ctrl;
|
||||
wxMediaCtrl3 * m_media_ctrl;
|
||||
wxMediaState m_last_state = MEDIASTATE_IDLE;
|
||||
std::string m_machine;
|
||||
int m_lan_proto = 0;
|
||||
@@ -90,7 +90,7 @@ private:
|
||||
bool m_device_busy = false;
|
||||
bool m_disable_lan = false;
|
||||
wxString m_url;
|
||||
|
||||
|
||||
std::deque<wxString> m_tasks;
|
||||
boost::mutex m_mutex;
|
||||
boost::condition_variable m_cond;
|
||||
|
||||
@@ -86,11 +86,8 @@ private:
|
||||
|
||||
/* side tools */
|
||||
SideTools* m_side_tools{nullptr};
|
||||
wxStaticBitmap* m_bitmap_printer_type;
|
||||
wxStaticBitmap* m_bitmap_arrow;
|
||||
wxStaticText* m_staticText_printer_name;
|
||||
wxStaticBitmap* m_bitmap_wifi_signal;
|
||||
wxBoxSizer * m_side_tools_sizer;
|
||||
SelectMachinePopup m_select_machine;
|
||||
|
||||
/* images */
|
||||
@@ -101,7 +98,6 @@ private:
|
||||
wxBitmap m_printer_img;
|
||||
wxBitmap m_arrow_img;
|
||||
|
||||
int last_wifi_signal = -1;
|
||||
int last_status;
|
||||
bool m_initialized { false };
|
||||
bool update_flag{false};
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "Widgets/AxisCtrlButton.hpp"
|
||||
#include "Widgets/TextInput.hpp"
|
||||
#include "Widgets/StaticLine.hpp"
|
||||
#include "wxMediaCtrl2.h"
|
||||
#include "MediaPlayCtrl.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -217,7 +217,7 @@ std::vector<DeviceItem*> selected_machines(const std::vector<DeviceItem*>& dev_i
|
||||
|
||||
SortItem::SortItem()
|
||||
{
|
||||
sort_map.emplace(std::make_pair(SortRule::SR_None, [this](const DeviceItem* d1, const DeviceItem* d2) {
|
||||
sort_map.emplace(std::make_pair(SortRule::SR_None, [](const DeviceItem* d1, const DeviceItem* d2) {
|
||||
return d1->state_dev_name > d2->state_dev_name;
|
||||
}));
|
||||
sort_map.emplace(std::make_pair(SortRule::SR_DEV_NAME, [this](const DeviceItem* d1, const DeviceItem* d2) {
|
||||
|
||||
@@ -19,7 +19,7 @@ MultiMachineItem::MultiMachineItem(wxWindow* parent, MachineObject* obj)
|
||||
Bind(wxEVT_LEAVE_WINDOW, &MultiMachineItem::OnLeaveWindow, this);
|
||||
Bind(wxEVT_LEFT_DOWN, &MultiMachineItem::OnLeftDown, this);
|
||||
Bind(wxEVT_MOTION, &MultiMachineItem::OnMove, this);
|
||||
Bind(EVT_MULTI_DEVICE_VIEW, [this, obj](auto& e) {
|
||||
Bind(EVT_MULTI_DEVICE_VIEW, [obj](auto& e) {
|
||||
wxGetApp().mainframe->jump_to_monitor(obj->get_dev_id());
|
||||
if (wxGetApp().mainframe->m_monitor->get_status_panel()->get_media_play_ctrl()) {
|
||||
wxGetApp().mainframe->m_monitor->get_status_panel()->get_media_play_ctrl()->jump_to_play();
|
||||
|
||||
@@ -88,7 +88,6 @@ private:
|
||||
Button* m_task_name{ nullptr };
|
||||
Button* m_status{ nullptr };
|
||||
Button* m_action{ nullptr };
|
||||
Button* m_stop_all_botton{nullptr};
|
||||
|
||||
// tip when no device
|
||||
wxStaticText* m_tip_text{ nullptr };
|
||||
|
||||
@@ -80,7 +80,7 @@ void MultiMachinePage::init_tabpanel()
|
||||
sizer_side_tools->Add(m_side_tools, 1, wxEXPAND, 0);
|
||||
m_tabpanel = new Tabbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, sizer_side_tools, wxNB_LEFT | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
||||
m_tabpanel->SetBackgroundColour(wxColour("#FEFFFF"));
|
||||
m_tabpanel->Bind(wxEVT_BOOKCTRL_PAGE_CHANGED, [this](wxBookCtrlEvent& e) {; });
|
||||
m_tabpanel->Bind(wxEVT_BOOKCTRL_PAGE_CHANGED, [](wxBookCtrlEvent& e) {; });
|
||||
|
||||
m_local_task_manager = new LocalTaskManagerPage(m_tabpanel);
|
||||
m_cloud_task_manager = new CloudTaskManagerPage(m_tabpanel);
|
||||
|
||||
@@ -783,7 +783,7 @@ void LocalTaskManagerPage::refresh_user_device(bool clear)
|
||||
mtitem->m_send_time = task_state_info->get_sent_time();
|
||||
mtitem->state_local_task = task_state_info->state();
|
||||
|
||||
task_state_info->set_state_changed_fn([this, mtitem](TaskState state, int percent) {
|
||||
task_state_info->set_state_changed_fn([mtitem](TaskState state, int percent) {
|
||||
mtitem->state_local_task = state;
|
||||
if (state == TaskState::TS_SEND_COMPLETED) {
|
||||
|
||||
|
||||
@@ -156,14 +156,14 @@ void NetworkPluginDownloadDialog::create_update_available_ui(const std::string&
|
||||
|
||||
auto daa_chk = new CheckBox(this);
|
||||
daa_chk->SetValue(cfg->is_network_update_prompt_disabled());
|
||||
daa_chk->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& e){
|
||||
daa_chk->Bind(wxEVT_TOGGLEBUTTON, [](wxCommandEvent& e){
|
||||
auto cfg = wxGetApp().app_config;
|
||||
cfg->set_network_update_prompt_disabled(e.IsChecked());
|
||||
cfg->save();
|
||||
});
|
||||
|
||||
auto daa_str = new Label(this, _L("Don't Ask Again"));
|
||||
auto on_toggle = [this, daa_chk]() {
|
||||
auto on_toggle = [daa_chk]() {
|
||||
daa_chk->SetValue(!daa_chk->GetValue());
|
||||
wxCommandEvent evt(wxEVT_TOGGLEBUTTON, daa_chk->GetId());
|
||||
evt.SetEventObject(daa_chk);
|
||||
|
||||
@@ -268,7 +268,7 @@ void NetworkTestDialog::start_test_url(TestJob job, wxString name, wxString url)
|
||||
|
||||
int result = -1;
|
||||
http.timeout_max(10)
|
||||
.on_complete([this, &result](std::string body, unsigned status) {
|
||||
.on_complete([&result](std::string body, unsigned status) {
|
||||
try {
|
||||
if (status == 200) {
|
||||
result = 0;
|
||||
|
||||
@@ -56,7 +56,7 @@ ButtonsListCtrl::ButtonsListCtrl(wxWindow *parent, wxBoxSizer* side_tools) :
|
||||
|
||||
// BBS: disable custom paint
|
||||
//this->Bind(wxEVT_PAINT, &ButtonsListCtrl::OnPaint, this);
|
||||
Bind(wxEVT_SYS_COLOUR_CHANGED, [this](auto& e){
|
||||
Bind(wxEVT_SYS_COLOUR_CHANGED, [](auto& e){
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
|
||||
ctrl_line.height = size.y;
|
||||
};
|
||||
|
||||
auto add_buttons_width = [&h_pos, this] (int blinking_button_width) {
|
||||
auto add_buttons_width = [&h_pos] (int blinking_button_width) {
|
||||
#ifndef DISABLE_BLINKING
|
||||
# ifndef DISABLE_UNDO_SYS
|
||||
h_pos += 3 * blinking_button_width;
|
||||
|
||||
@@ -254,7 +254,7 @@ ObjColorPanel::ObjColorPanel(wxWindow *parent, Slic3r::ObjDialogInOut &in_out, c
|
||||
m_color_cluster_num_by_user_ebox->Bind(wxEVT_TEXT_ENTER, on_apply_color_cluster_text_modify);
|
||||
m_color_cluster_num_by_user_ebox->Bind(wxEVT_SPINCTRL, on_apply_color_cluster_text_modify);
|
||||
|
||||
m_color_cluster_num_by_user_ebox->Bind(wxEVT_CHAR, [this](wxKeyEvent &e) {
|
||||
m_color_cluster_num_by_user_ebox->Bind(wxEVT_CHAR, [](wxKeyEvent &e) {
|
||||
int keycode = e.GetKeyCode();
|
||||
wxString input_char = wxString::Format("%c", keycode);
|
||||
long value;
|
||||
|
||||
@@ -79,7 +79,6 @@ private:
|
||||
std::vector<wxBoxSizer *> m_row_col_boxsizer_list;
|
||||
std::vector<ButtonState*> m_result_icon_list;
|
||||
int m_last_cluster_num{-1};
|
||||
const int m_combox_width{50};
|
||||
int m_combox_icon_width;
|
||||
int m_combox_icon_height;
|
||||
wxButton * m_image_button = nullptr;
|
||||
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
|
||||
OptionsGroup(wxWindow *_parent, const wxString &title, const wxString &icon, bool is_tab_opt = false,
|
||||
column_t extra_clmn = nullptr);
|
||||
~OptionsGroup() { clear(true); }
|
||||
virtual ~OptionsGroup() { clear(true); }
|
||||
|
||||
wxGridSizer* get_grid_sizer() { return m_grid_sizer; }
|
||||
const std::vector<Line>& get_lines() { return m_lines; }
|
||||
|
||||
@@ -128,7 +128,7 @@ wxBoxSizer *TipsDialog::create_item_checkbox(wxString title, wxWindow *parent, w
|
||||
m_show_again = wxGetApp().app_config->has(param);
|
||||
checkbox->SetValue(m_show_again);
|
||||
|
||||
checkbox->Bind(wxEVT_TOGGLEBUTTON, [this, checkbox, param](wxCommandEvent &e) {
|
||||
checkbox->Bind(wxEVT_TOGGLEBUTTON, [this, param](wxCommandEvent &e) {
|
||||
m_show_again = m_show_again ? false : true;
|
||||
e.Skip();
|
||||
});
|
||||
@@ -290,11 +290,11 @@ ParamsPanel::ParamsPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, c
|
||||
|
||||
m_compare_btn = new ScalableButton(m_top_panel, wxID_ANY, "compare", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true);
|
||||
m_compare_btn->SetToolTip(_L("Compare presets"));
|
||||
m_compare_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) { wxGetApp().mainframe->diff_dialog.show(); }));
|
||||
m_compare_btn->Bind(wxEVT_BUTTON, ([](wxCommandEvent e) { wxGetApp().mainframe->diff_dialog.show(); }));
|
||||
|
||||
m_setting_btn = new ScalableButton(m_top_panel, wxID_ANY, "table", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true);
|
||||
m_setting_btn->SetToolTip(_L("View all object's settings"));
|
||||
m_setting_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &) { wxGetApp().plater()->PopupObjectTable(-1, -1, {0, 0}); });
|
||||
m_setting_btn->Bind(wxEVT_BUTTON, [](wxCommandEvent &) { wxGetApp().plater()->PopupObjectTable(-1, -1, {0, 0}); });
|
||||
|
||||
m_highlighter.set_timer_owner(this, 0);
|
||||
this->Bind(wxEVT_TIMER, [this](wxTimerEvent &)
|
||||
|
||||
@@ -157,7 +157,7 @@ PartPlate::PartPlate()
|
||||
init();
|
||||
}
|
||||
|
||||
PartPlate::PartPlate(PartPlateList *partplate_list, Vec3d origin, int width, int depth, int height, Plater* platerObj, Model* modelObj, bool printable, PrinterTechnology tech)
|
||||
PartPlate::PartPlate(PartPlateList *partplate_list, Vec3d origin, int width, int depth, double height, Plater* platerObj, Model* modelObj, bool printable, PrinterTechnology tech)
|
||||
:m_partplate_list(partplate_list), m_plater(platerObj), m_model(modelObj), printer_technology(tech), m_origin(origin), m_width(width), m_depth(depth), m_height(height), m_printable(printable)
|
||||
{
|
||||
init();
|
||||
@@ -1757,26 +1757,25 @@ std::vector<int> PartPlate::get_extruders_under_cli(bool conside_custom_gcode, D
|
||||
else
|
||||
obj_support = glb_support;
|
||||
|
||||
if (!obj_support)
|
||||
continue;
|
||||
if (obj_support) {
|
||||
int obj_support_intf_extr = 0;
|
||||
const ConfigOption* support_intf_extr_opt = object->config.option("support_interface_filament");
|
||||
if (support_intf_extr_opt != nullptr)
|
||||
obj_support_intf_extr = support_intf_extr_opt->getInt();
|
||||
if (obj_support_intf_extr != 0)
|
||||
plate_extruders.push_back(obj_support_intf_extr);
|
||||
else if (glb_support_intf_extr != 0)
|
||||
plate_extruders.push_back(glb_support_intf_extr);
|
||||
|
||||
int obj_support_intf_extr = 0;
|
||||
const ConfigOption* support_intf_extr_opt = object->config.option("support_interface_filament");
|
||||
if (support_intf_extr_opt != nullptr)
|
||||
obj_support_intf_extr = support_intf_extr_opt->getInt();
|
||||
if (obj_support_intf_extr != 0)
|
||||
plate_extruders.push_back(obj_support_intf_extr);
|
||||
else if (glb_support_intf_extr != 0)
|
||||
plate_extruders.push_back(glb_support_intf_extr);
|
||||
|
||||
int obj_support_extr = 0;
|
||||
const ConfigOption* support_extr_opt = object->config.option("support_filament");
|
||||
if (support_extr_opt != nullptr)
|
||||
obj_support_extr = support_extr_opt->getInt();
|
||||
if (obj_support_extr != 0)
|
||||
plate_extruders.push_back(obj_support_extr);
|
||||
else if (glb_support_extr != 0)
|
||||
plate_extruders.push_back(glb_support_extr);
|
||||
int obj_support_extr = 0;
|
||||
const ConfigOption* support_extr_opt = object->config.option("support_filament");
|
||||
if (support_extr_opt != nullptr)
|
||||
obj_support_extr = support_extr_opt->getInt();
|
||||
if (obj_support_extr != 0)
|
||||
plate_extruders.push_back(obj_support_extr);
|
||||
else if (glb_support_extr != 0)
|
||||
plate_extruders.push_back(glb_support_extr);
|
||||
}
|
||||
|
||||
int obj_outer_wall_extr = 0;
|
||||
if (const ConfigOption* wall_opt = object->config.option("outer_wall_filament_id"); wall_opt != nullptr)
|
||||
@@ -2473,7 +2472,7 @@ void PartPlate::clear(bool clear_sliced_result)
|
||||
|
||||
/* size and position related functions*/
|
||||
//set position and size
|
||||
void PartPlate::set_pos_and_size(Vec3d& origin, int width, int depth, int height, bool with_instance_move, bool do_clear)
|
||||
void PartPlate::set_pos_and_size(Vec3d& origin, int width, int depth, double height, bool with_instance_move, bool do_clear)
|
||||
{
|
||||
bool size_changed = false; //size changed means the machine changed
|
||||
bool pos_changed = false;
|
||||
@@ -2772,10 +2771,10 @@ bool PartPlate::check_outside(int obj_id, int instance_id, BoundingBoxf3* boundi
|
||||
|
||||
if (instance_box.min.z() < SINKING_Z_THRESHOLD) {
|
||||
// Orca: For sinking object, we use a more expensive algorithm so part below build plate won't be considered
|
||||
// m_plater is null in CLI mode.
|
||||
if (m_plater && plate_box.intersects(instance_box)) {
|
||||
// m_height mirrors the printer's printable height and is set in CLI mode too, unlike m_plater.
|
||||
if (plate_box.intersects(instance_box)) {
|
||||
// TODO: FIXME: this does not take exclusion area into account
|
||||
const BuildVolume build_volume(get_shape(), m_plater->build_volume().printable_height(), m_extruder_areas, m_extruder_heights);
|
||||
const BuildVolume build_volume(get_shape(), m_height, m_extruder_areas, m_extruder_heights);
|
||||
const auto state = instance->calc_print_volume_state(build_volume);
|
||||
outside = state == ModelInstancePVS_Partly_Outside;
|
||||
}
|
||||
@@ -4101,7 +4100,7 @@ void PartPlate::on_filament_deleted(int filament_count, int filament_id)
|
||||
|
||||
|
||||
/* PartPlate List related functions*/
|
||||
PartPlateList::PartPlateList(int width, int depth, int height, Plater* platerObj, Model* modelObj, PrinterTechnology tech)
|
||||
PartPlateList::PartPlateList(int width, int depth, double height, Plater* platerObj, Model* modelObj, PrinterTechnology tech)
|
||||
:m_plate_width(width), m_plate_depth(depth), m_plate_height(height), m_plater(platerObj), m_model(modelObj), printer_technology(tech),
|
||||
unprintable_plate(this, Vec3d(0.0 + width * (1. + LOGICAL_PART_PLATE_GAP), 0.0, 0.0), width, depth, height, platerObj, modelObj, false, tech)
|
||||
{
|
||||
@@ -4546,7 +4545,7 @@ void PartPlateList::set_default_wipe_tower_pos_for_plate(int plate_idx, bool ini
|
||||
}
|
||||
|
||||
//this may be happened after machine changed
|
||||
void PartPlateList::reset_size(int width, int depth, int height, bool reload_objects, bool update_shapes)
|
||||
void PartPlateList::reset_size(int width, int depth, double height, bool reload_objects, bool update_shapes)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(":before size: plate_width %1%, plate_depth %2%, plate_height %3%") % m_plate_width % m_plate_depth % m_plate_height;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(":after size: plate_width %1%, plate_depth %2%, plate_height %3%") % width % depth % height;
|
||||
@@ -6472,7 +6471,7 @@ int PartPlateList::store_to_3mf_structure(PlateDataPtrs& plate_data_list, bool w
|
||||
plate_data_item->filament_change_sequence = m_plate_list[i]->m_gcode_result->filament_change_sequence;
|
||||
plate_data_item->nozzle_change_sequence = m_plate_list[i]->m_gcode_result->nozzle_change_sequence;
|
||||
plate_data_item->optimal_assignment = m_plate_list[i]->m_gcode_result->optimal_assignment;
|
||||
plate_data_item->first_layer_time = std::to_string(m_plate_list[i]->cali_bboxes_data.first_layer_time);
|
||||
plate_data_item->first_layer_time = std::to_string(m_plate_list[i]->get_slice_result()->initial_layer_time);
|
||||
Print *print = nullptr;
|
||||
m_plate_list[i]->get_print((PrintBase **) &print, nullptr, nullptr);
|
||||
if (print) {
|
||||
@@ -6701,7 +6700,7 @@ int PartPlateList::load_gcode_files()
|
||||
//BoundingBoxf3 print_volume = m_plate_list[i]->get_bounding_box(false);
|
||||
//print_volume.max(2) = this->m_plate_height;
|
||||
//print_volume.min(2) = -1e10;
|
||||
m_model->update_print_volume_state({m_plate_list[i]->get_shape(), (double)this->m_plate_height, m_plate_list[i]->get_extruder_areas(), m_plate_list[i]->get_extruder_heights() });
|
||||
m_model->update_print_volume_state({m_plate_list[i]->get_shape(), this->m_plate_height, m_plate_list[i]->get_extruder_areas(), m_plate_list[i]->get_extruder_heights() });
|
||||
|
||||
if (!m_plate_list[i]->load_gcode_from_file(m_plate_list[i]->m_gcode_path_from_3mf))
|
||||
ret ++;
|
||||
|
||||
@@ -96,7 +96,7 @@ private:
|
||||
Vec3d m_origin;
|
||||
int m_width;
|
||||
int m_depth;
|
||||
int m_height;
|
||||
double m_height;
|
||||
float m_height_to_lid;
|
||||
float m_height_to_rod;
|
||||
bool m_printable;
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
static void load_render_colors();
|
||||
|
||||
PartPlate();
|
||||
PartPlate(PartPlateList *partplate_list, Vec3d origin, int width, int depth, int height, Plater* platerObj, Model* modelObj, bool printable=true, PrinterTechnology tech = ptFFF);
|
||||
PartPlate(PartPlateList *partplate_list, Vec3d origin, int width, int depth, double height, Plater* platerObj, Model* modelObj, bool printable=true, PrinterTechnology tech = ptFFF);
|
||||
~PartPlate();
|
||||
|
||||
bool operator<(PartPlate&) const;
|
||||
@@ -328,7 +328,7 @@ public:
|
||||
Vec3d get_center_origin();
|
||||
/* size and position related functions*/
|
||||
//set position and size
|
||||
void set_pos_and_size(Vec3d& origin, int width, int depth, int height, bool with_instance_move, bool do_clear = true);
|
||||
void set_pos_and_size(Vec3d& origin, int width, int depth, double height, bool with_instance_move, bool do_clear = true);
|
||||
|
||||
// BBS
|
||||
Vec2d get_size() const { return Vec2d(m_width, m_depth); }
|
||||
@@ -590,7 +590,7 @@ class PartPlateList : public ObjectBase
|
||||
|
||||
int m_plate_width;
|
||||
int m_plate_depth;
|
||||
int m_plate_height;
|
||||
double m_plate_height;
|
||||
|
||||
float m_height_to_lid;
|
||||
float m_height_to_rod;
|
||||
@@ -675,16 +675,6 @@ public:
|
||||
offset = Vec2d(0, 0);
|
||||
}
|
||||
|
||||
TexturePart(const TexturePart& part) {
|
||||
this->x = part.x;
|
||||
this->y = part.y;
|
||||
this->w = part.w;
|
||||
this->h = part.h;
|
||||
this->offset = part.offset;
|
||||
this->buffer = part.buffer;
|
||||
this->filename = part.filename;
|
||||
this->texture = part.texture;
|
||||
}
|
||||
void update_pos(float xx, float yy, float ww, float hh) {
|
||||
x = xx;
|
||||
y = yy;
|
||||
@@ -708,12 +698,12 @@ public:
|
||||
static bool is_load_cali_texture;
|
||||
static bool is_load_extruder_only_area_textures;
|
||||
|
||||
PartPlateList(int width, int depth, int height, Plater* platerObj, Model* modelObj, PrinterTechnology tech = ptFFF);
|
||||
PartPlateList(int width, int depth, double height, Plater* platerObj, Model* modelObj, PrinterTechnology tech = ptFFF);
|
||||
PartPlateList(Plater* platerObj, Model* modelObj, PrinterTechnology tech = ptFFF);
|
||||
~PartPlateList();
|
||||
|
||||
//this may be happened after machine changed
|
||||
void reset_size(int width, int depth, int height, bool reload_objects = true, bool update_shapes = false);
|
||||
void reset_size(int width, int depth, double height, bool reload_objects = true, bool update_shapes = false);
|
||||
//clear all the instances in the plate, but keep the plates
|
||||
void clear(bool delete_plates = false, bool release_print_list = false, bool except_locked = false, int plate_index = -1);
|
||||
//clear all the instances in the plate, and delete the plates, only keep the first default plate
|
||||
@@ -727,7 +717,7 @@ public:
|
||||
//get the plate stride
|
||||
double plate_stride_x();
|
||||
double plate_stride_y();
|
||||
void get_plate_size(int& width, int& depth, int& height) {
|
||||
void get_plate_size(int& width, int& depth, double& height) {
|
||||
width = m_plate_width;
|
||||
depth = m_plate_depth;
|
||||
height = m_plate_height;
|
||||
|
||||
@@ -128,7 +128,6 @@ private:
|
||||
bool is_drag_mode();
|
||||
|
||||
boost::shared_ptr<PrinterFileSystem> m_file_sys;
|
||||
bool m_file_sys_result{false};
|
||||
std::string m_timestamp;
|
||||
std::string m_tmp_path;
|
||||
std::vector<string> m_local_paths;
|
||||
|
||||
@@ -33,7 +33,6 @@ class PhysicalPrinterDialog : public DPIDialog
|
||||
Button* m_printhost_test_btn {nullptr};
|
||||
Button* m_printhost_logout_btn {nullptr};
|
||||
Button* m_printhost_cafile_browse_btn {nullptr};
|
||||
Button* m_printhost_client_cert_browse_btn {nullptr};
|
||||
Button* m_printhost_port_browse_btn {nullptr};
|
||||
|
||||
RoundedRectangle* m_input_area {nullptr};
|
||||
|
||||
+50
-40
@@ -1343,7 +1343,7 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title
|
||||
if (index >= 0) label_flow->SetMinSize({FromDIP(80), -1});
|
||||
auto combo_flow = new ComboBox(this, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY);
|
||||
combo_flow->GetDropDown().SetUseContentWidth(true);
|
||||
combo_flow->Bind(wxEVT_COMBOBOX, [this, index, combo_flow](wxCommandEvent &evt) {
|
||||
combo_flow->Bind(wxEVT_COMBOBOX, [index, combo_flow](wxCommandEvent &evt) {
|
||||
auto printer_tab = dynamic_cast<TabPrinter *>(wxGetApp().get_tab(Preset::TYPE_PRINTER));
|
||||
NozzleVolumeType volume_type = NozzleVolumeType(intptr_t(combo_flow->GetClientData(evt.GetInt())));
|
||||
printer_tab->set_extruder_volume_type(index, volume_type);
|
||||
@@ -1403,7 +1403,7 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title
|
||||
|
||||
btn_up = new ScalableButton(this, wxID_ANY, "page_up", "", {FromDIP(14), FromDIP(14)}, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 14);
|
||||
btn_up->SetBackgroundColour(*wxWHITE);
|
||||
btn_up->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this, index](auto &evt) {
|
||||
btn_up->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &evt) {
|
||||
if (page_cur > 0)
|
||||
--page_cur;
|
||||
update_ams();
|
||||
@@ -1411,7 +1411,7 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title
|
||||
btn_up->Hide();
|
||||
btn_down = new ScalableButton(this, wxID_ANY, "page_down", "", {FromDIP(14), FromDIP(14)}, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 14);
|
||||
btn_down->SetBackgroundColour(*wxWHITE);
|
||||
btn_down->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this, index](auto &evt) {
|
||||
btn_down->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &evt) {
|
||||
if (page_cur + 1 < page_num)
|
||||
++page_cur;
|
||||
update_ams();
|
||||
@@ -2028,7 +2028,7 @@ bool Sidebar::priv::sync_extruder_list(bool &only_external_material, bool is_man
|
||||
if (!this->plater)
|
||||
return false;
|
||||
|
||||
this->plater->update_objects_position_when_select_preset([&obj, machine_preset]() {
|
||||
this->plater->update_objects_position_when_select_preset([machine_preset]() {
|
||||
Tab *printer_tab = GUI::wxGetApp().get_tab(Preset::Type::TYPE_PRINTER);
|
||||
printer_tab->select_preset(machine_preset->name);
|
||||
});
|
||||
@@ -2173,7 +2173,7 @@ bool Sidebar::priv::sync_extruder_list(bool &only_external_material, bool is_man
|
||||
void Sidebar::priv::update_sync_status(const MachineObject *obj)
|
||||
{
|
||||
StateColor not_synced_colour(std::pair<wxColour, int>(wxColour("#009688"), StateColor::Normal));
|
||||
auto clear_all_sync_status = [this, ¬_synced_colour]() {
|
||||
auto clear_all_sync_status = [this]() {
|
||||
panel_printer_preset->ShowBadge(false);
|
||||
panel_printer_bed->ShowBadge(false);
|
||||
panel_nozzle_dia->ShowBadge(false); // ORCA add support for nozzle sync
|
||||
@@ -2477,7 +2477,7 @@ Sidebar::Sidebar(Plater *parent)
|
||||
p->m_printer_icon = new ScalableButton(p->m_panel_printer_title, wxID_ANY, "printer");
|
||||
p->m_text_printer_settings = new Label(p->m_panel_printer_title, _L("Printer"), LB_PROPAGATE_MOUSE_EVENT | wxST_ELLIPSIZE_END);
|
||||
|
||||
p->m_printer_icon->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {
|
||||
p->m_printer_icon->Bind(wxEVT_BUTTON, [](wxCommandEvent& e) {
|
||||
//auto wizard_t = new ConfigWizard(wxGetApp().mainframe);
|
||||
//wizard_t->run(ConfigWizard::RR_USER, ConfigWizard::SP_CUSTOM);
|
||||
});
|
||||
@@ -2498,7 +2498,7 @@ Sidebar::Sidebar(Plater *parent)
|
||||
});
|
||||
|
||||
p->m_printer_setting = new ScalableButton(p->m_panel_printer_title, wxID_ANY, "settings");
|
||||
p->m_printer_setting->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
p->m_printer_setting->Bind(wxEVT_BUTTON, [](wxCommandEvent &e) {
|
||||
// p->editing_filament = -1;
|
||||
// wxGetApp().params_dialog()->Popup();
|
||||
// wxGetApp().get_tab(Preset::TYPE_FILAMENT)->restore_last_select_item();
|
||||
@@ -2613,8 +2613,8 @@ Sidebar::Sidebar(Plater *parent)
|
||||
p->image_printer->SetBackgroundColour(bg_color);
|
||||
p->combo_printer->SetBackgroundColour(bg_color); // paints margins instead combo background
|
||||
};
|
||||
p->combo_printer->Bind(wxEVT_SET_FOCUS, [this, printer_focus_bg](auto& e) {printer_focus_bg(true ); e.Skip();});
|
||||
p->combo_printer->Bind(wxEVT_KILL_FOCUS, [this, printer_focus_bg](auto& e) {printer_focus_bg(false); e.Skip();});
|
||||
p->combo_printer->Bind(wxEVT_SET_FOCUS, [printer_focus_bg](auto& e) {printer_focus_bg(true ); e.Skip();});
|
||||
p->combo_printer->Bind(wxEVT_KILL_FOCUS, [printer_focus_bg](auto& e) {printer_focus_bg(false); e.Skip();});
|
||||
|
||||
/* ORCA This part moved to titlebar
|
||||
p->btn_connect_printer = new ScalableButton(p->panel_printer_preset, wxID_ANY, "monitor_signal_strong");
|
||||
@@ -2691,8 +2691,8 @@ Sidebar::Sidebar(Plater *parent)
|
||||
p->label_nozzle_type->SetBackgroundColour(bg_color);
|
||||
p->combo_nozzle_dia->SetBackgroundColour(bg_color); // paints margins instead combo background
|
||||
};
|
||||
p->combo_nozzle_dia->Bind(wxEVT_SET_FOCUS, [this, nozzle_focus_bg](auto& e) {nozzle_focus_bg(true ); e.Skip();});
|
||||
p->combo_nozzle_dia->Bind(wxEVT_KILL_FOCUS, [this, nozzle_focus_bg](auto& e) {nozzle_focus_bg(false); e.Skip();});
|
||||
p->combo_nozzle_dia->Bind(wxEVT_SET_FOCUS, [nozzle_focus_bg](auto& e) {nozzle_focus_bg(true ); e.Skip();});
|
||||
p->combo_nozzle_dia->Bind(wxEVT_KILL_FOCUS, [nozzle_focus_bg](auto& e) {nozzle_focus_bg(false); e.Skip();});
|
||||
|
||||
p->label_nozzle_type = new Label(p->panel_nozzle_dia, "Brass", LB_PROPAGATE_MOUSE_EVENT | wxST_ELLIPSIZE_END | wxALIGN_CENTRE_HORIZONTAL);
|
||||
p->label_nozzle_type->SetFont(Label::Body_10);
|
||||
@@ -2766,8 +2766,8 @@ Sidebar::Sidebar(Plater *parent)
|
||||
p->image_printer_bed->SetBackgroundColour(bg_color);
|
||||
p->combo_printer_bed->SetBackgroundColour(bg_color); // paints margins instead combo background
|
||||
};
|
||||
p->combo_printer_bed->Bind(wxEVT_SET_FOCUS, [this, bed_focus_bg](auto& e) {bed_focus_bg(true ); e.Skip();});
|
||||
p->combo_printer_bed->Bind(wxEVT_KILL_FOCUS, [this, bed_focus_bg](auto& e) {bed_focus_bg(false); e.Skip();});
|
||||
p->combo_printer_bed->Bind(wxEVT_SET_FOCUS, [bed_focus_bg](auto& e) {bed_focus_bg(true ); e.Skip();});
|
||||
p->combo_printer_bed->Bind(wxEVT_KILL_FOCUS, [bed_focus_bg](auto& e) {bed_focus_bg(false); e.Skip();});
|
||||
|
||||
// highlight border on hover
|
||||
auto printer_bed_hovered = std::make_shared<std::unordered_set<wxWindow*>>();
|
||||
@@ -2981,7 +2981,7 @@ Sidebar::Sidebar(Plater *parent)
|
||||
|
||||
ScalableButton* add_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "add_filament");
|
||||
add_btn->SetToolTip(_L("Add one filament"));
|
||||
add_btn->Bind(wxEVT_BUTTON, [this, scrolled_sizer](wxCommandEvent& e){
|
||||
add_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e){
|
||||
add_filament();
|
||||
update_filaments_counter();
|
||||
});
|
||||
@@ -2991,7 +2991,7 @@ Sidebar::Sidebar(Plater *parent)
|
||||
|
||||
ScalableButton* del_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "delete_filament");
|
||||
del_btn->SetToolTip(_L("Remove last filament"));
|
||||
del_btn->Bind(wxEVT_BUTTON, [this, scrolled_sizer](wxCommandEvent &e) {
|
||||
del_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
delete_filament();
|
||||
update_filaments_counter();
|
||||
});
|
||||
@@ -3005,7 +3005,7 @@ Sidebar::Sidebar(Plater *parent)
|
||||
ams_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "ams_fila_sync", wxEmptyString, wxDefaultSize, wxDefaultPosition,
|
||||
wxBU_EXACTFIT | wxNO_BORDER, false, 16); // ORCA match icon size with other icons as 16x16
|
||||
ams_btn->SetToolTip(_L("Synchronize filament list from AMS"));
|
||||
ams_btn->Bind(wxEVT_BUTTON, [this, scrolled_sizer](wxCommandEvent &e) {
|
||||
ams_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
sync_ams_list();
|
||||
});
|
||||
|
||||
@@ -3685,7 +3685,7 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
||||
extruder.combo_flow->SetSelection(select);
|
||||
};
|
||||
|
||||
auto update_extruder_diameter = [&diameters, &diameter, &nozzle_diameter](int extruder_index,ExtruderGroup & extruder) {
|
||||
auto update_extruder_diameter = [&diameters, &nozzle_diameter](int extruder_index,ExtruderGroup & extruder) {
|
||||
extruder.combo_diameter->Clear();
|
||||
int select = -1;
|
||||
// ORCA get the actual nozzle diameter from printer config
|
||||
@@ -3991,16 +3991,16 @@ void Sidebar::update_mixed_filament_list()
|
||||
p->m_panel_mixed_warning->Show(false);
|
||||
|
||||
// Show/dismiss 3D canvas notification for broken mixed filaments
|
||||
if (has_mixed && !broken_set.empty()) {
|
||||
auto* notify = wxGetApp().plater()->get_notification_manager();
|
||||
if (notify)
|
||||
auto* notify = plater->get_notification_manager();
|
||||
GLCanvas3D* view3d_canvas = plater->get_view3D_canvas3D();
|
||||
if(view3d_canvas && view3d_canvas->is_initialized() && notify){
|
||||
if (has_mixed && !broken_set.empty()) {
|
||||
notify->push_notification(NotificationType::BBLMixedFilamentBroken,
|
||||
NotificationManager::NotificationLevel::ErrorNotificationLevel,
|
||||
_u8L("Mixed filament has invalid or mismatched components. Please re-edit affected entries."));
|
||||
} else {
|
||||
auto* notify = wxGetApp().plater()->get_notification_manager();
|
||||
if (notify)
|
||||
} else {
|
||||
notify->close_notification_of_type(NotificationType::BBLMixedFilamentBroken);
|
||||
}
|
||||
}
|
||||
|
||||
if (has_mixed) {
|
||||
@@ -7500,7 +7500,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
|
||||
// Keep tracking the current sidebar size, by storing it using `best_size`, which will be stored
|
||||
// in the config and re-applied when the app is opened again.
|
||||
this->sidebar->Bind(wxEVT_IDLE, [&sidebar, this](wxIdleEvent& e) {
|
||||
this->sidebar->Bind(wxEVT_IDLE, [&sidebar](wxIdleEvent& e) {
|
||||
if (sidebar.IsShown() && sidebar.IsDocked() && sidebar.rect.GetWidth() > 0) {
|
||||
sidebar.BestSize(sidebar.rect.GetWidth(), sidebar.best_size.GetHeight());
|
||||
}
|
||||
@@ -7799,8 +7799,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
wxGetApp().removable_drive_manager()->init(this->q);
|
||||
#ifdef _WIN32
|
||||
//Trigger enumeration of removable media on Win32 notification.
|
||||
this->q->Bind(EVT_VOLUME_ATTACHED, [this](VolumeAttachedEvent &evt) { wxGetApp().removable_drive_manager()->volumes_changed(); });
|
||||
this->q->Bind(EVT_VOLUME_DETACHED, [this](VolumeDetachedEvent &evt) { wxGetApp().removable_drive_manager()->volumes_changed(); });
|
||||
this->q->Bind(EVT_VOLUME_ATTACHED, [](VolumeAttachedEvent &evt) { wxGetApp().removable_drive_manager()->volumes_changed(); });
|
||||
this->q->Bind(EVT_VOLUME_DETACHED, [](VolumeDetachedEvent &evt) { wxGetApp().removable_drive_manager()->volumes_changed(); });
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
@@ -8281,7 +8281,8 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
bool dlg_cont = true;
|
||||
bool is_user_cancel = false;
|
||||
bool translate_old = false;
|
||||
int current_width = 0, current_depth = 0, current_height = 0, project_filament_count = 1;
|
||||
int current_width = 0, current_depth = 0, project_filament_count = 1;
|
||||
double current_height = 0;
|
||||
|
||||
if (input_files.empty())
|
||||
return std::vector<size_t>();
|
||||
@@ -8360,7 +8361,6 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
const float LOAD_MODEL_RATIO = 0.9;
|
||||
|
||||
for (size_t i = 0; i < input_files.size(); ++i) {
|
||||
int file_percent = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
auto path = input_files[i];
|
||||
@@ -8409,7 +8409,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
q->skip_thumbnail_invalid = true;
|
||||
model = Slic3r::Model::read_from_archive(path.string(), &config_loaded, &config_substitutions, en_3mf_file_type, strategy, &plate_data, &project_presets,
|
||||
&file_version,
|
||||
[this, &dlg, real_filename, &progress_percent, &file_percent, stage_percent, INPUT_FILES_RATIO, total_files, i,
|
||||
[&dlg, real_filename, &progress_percent, stage_percent, INPUT_FILES_RATIO, total_files, i,
|
||||
&is_user_cancel](int import_stage, int current, int total, bool &cancel) {
|
||||
bool cont = true;
|
||||
float percent_float = (100.0f * (float)i / (float)total_files) + INPUT_FILES_RATIO * ((float)stage_percent[import_stage] + (float)current * (float)(stage_percent[import_stage + 1] - stage_percent[import_stage]) /(float) total) / (float)total_files;
|
||||
@@ -8830,6 +8830,11 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
if (wipe_tower_y_opt)
|
||||
file_wipe_tower_y = *wipe_tower_y_opt;
|
||||
|
||||
if (auto* agent = wxGetApp().getAgent()) {
|
||||
if (auto* ids = config.opt<ConfigOptionStrings>("filament_ids"))
|
||||
for (std::string& id : ids->values)
|
||||
id = agent->to_orca_filament_id(id);
|
||||
}
|
||||
preset_bundle->load_config_model(filename.string(), std::move(config), file_version);
|
||||
|
||||
ConfigOption* bed_type_opt = preset_bundle->project_config.option("curr_bed_type");
|
||||
@@ -8992,7 +8997,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
Semver file_version;
|
||||
|
||||
//ObjImportColorFn obj_color_fun=nullptr;
|
||||
auto obj_color_fun = [this, &path](ObjDialogInOut &in_out) {
|
||||
auto obj_color_fun = [&path](ObjDialogInOut &in_out) {
|
||||
|
||||
if (!boost::iends_with(path.string(), ".obj")) { return; }
|
||||
const std::vector<std::string> extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config();
|
||||
@@ -9009,7 +9014,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
if (angle <= 0) angle = 0.5;
|
||||
bool split_compound = wxGetApp().app_config->get_bool("is_split_compound");
|
||||
model = Slic3r::Model:: read_from_step(path.string(), strategy,
|
||||
[this, &dlg, real_filename, &progress_percent, &file_percent, step_percent, INPUT_FILES_RATIO, total_files, i](int load_stage, int current, int total, bool &cancel)
|
||||
[&dlg, real_filename, &progress_percent, step_percent, INPUT_FILES_RATIO, total_files, i](int load_stage, int current, int total, bool &cancel)
|
||||
{
|
||||
bool cont = true;
|
||||
float percent_float = (100.0f * (float)i / (float)total_files) + INPUT_FILES_RATIO * ((float)step_percent[load_stage] + (float)current * (float)(step_percent[load_stage + 1] - step_percent[load_stage]) / (float)total) / (float)total_files;
|
||||
@@ -9023,7 +9028,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
if (!isUtf8StepFile) {
|
||||
const auto no_warn = wxGetApp().app_config->get_bool("step_not_utf8_no_warn");
|
||||
if (!no_warn) {
|
||||
MessageDialog dlg(nullptr, _L("Component name(s) inside step file not in UTF8 format!") + "\n\n" + _L("Because of unsupported text encoding, garbage characters may appear!"),
|
||||
MessageDialog dlg(nullptr, _L("Component name(s) inside step file not in UTF-8 format!") + "\n\n" + _L("Because of unsupported text encoding, garbage characters may appear!"),
|
||||
wxString(SLIC3R_APP_FULL_NAME " - ") + _L("Attention!"), wxOK | wxICON_INFORMATION);
|
||||
dlg.show_dsa_button(_L("Remember my choice."));
|
||||
dlg.ShowModal();
|
||||
@@ -9033,7 +9038,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
}
|
||||
}
|
||||
},
|
||||
[this, &path, &is_user_cancel, &linear, &angle, &split_compound](Slic3r::Step& file, double& linear_value, double& angle_value, bool& is_split)-> int {
|
||||
[&is_user_cancel, &linear, &angle, &split_compound](Slic3r::Step& file, double& linear_value, double& angle_value, bool& is_split)-> int {
|
||||
if (wxGetApp().app_config->get_bool("enable_step_mesh_setting")) {
|
||||
StepMeshDialog mesh_dlg(nullptr, file, linear, angle);
|
||||
if (mesh_dlg.ShowModal() == wxID_OK) {
|
||||
@@ -9054,7 +9059,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
}else {
|
||||
model = Slic3r::Model:: read_from_file(
|
||||
path.string(), nullptr, nullptr, strategy, &plate_data, &project_presets, &is_xxx, &file_version, nullptr,
|
||||
[this, &dlg, real_filename, &progress_percent, &file_percent, INPUT_FILES_RATIO, total_files, i, &designer_model_id, &designer_country_code](int current, int total, bool &cancel, std::string &mode_id, std::string &code)
|
||||
[&dlg, real_filename, &progress_percent, INPUT_FILES_RATIO, total_files, i, &designer_model_id, &designer_country_code](int current, int total, bool &cancel, std::string &mode_id, std::string &code)
|
||||
{
|
||||
designer_model_id = mode_id;
|
||||
designer_country_code = code;
|
||||
@@ -9136,7 +9141,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
else if (model.looks_like_saved_in_meters()) {
|
||||
// BBS do not handle look like in meters
|
||||
MessageDialog dlg(q,
|
||||
format_wxstr(_L("The object from file %s is too small, and may be in meters or inches.\n Do you want to scale to millimeters\?"),
|
||||
format_wxstr(_L("The object from file %s is too small, and may be in meters or inches.\nDo you want to scale to millimeters\?"),
|
||||
from_path(filename)),
|
||||
_L("Object too small"), wxICON_QUESTION | wxYES_NO);
|
||||
int answer = dlg.ShowModal();
|
||||
@@ -9144,7 +9149,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
} else if (model.looks_like_imperial_units()) {
|
||||
// BBS do not handle look like in meters
|
||||
MessageDialog dlg(q,
|
||||
format_wxstr(_L("The object from file %s is too small, and may be in meters or inches.\n Do you want to scale to millimeters\?"),
|
||||
format_wxstr(_L("The object from file %s is too small, and may be in meters or inches.\nDo you want to scale to millimeters\?"),
|
||||
from_path(filename)),
|
||||
_L("Object too small"), wxICON_QUESTION | wxYES_NO);
|
||||
int answer = dlg.ShowModal();
|
||||
@@ -11325,7 +11330,7 @@ void Plater::priv::reload_from_disk()
|
||||
// load one file at a time
|
||||
for (size_t i = 0; i < input_paths.size(); ++i) {
|
||||
const auto& path = input_paths[i].string();
|
||||
auto obj_color_fun = [this, &path](ObjDialogInOut &in_out) {
|
||||
auto obj_color_fun = [&path](ObjDialogInOut &in_out) {
|
||||
if (!boost::iends_with(path, ".obj")) { return; }
|
||||
const std::vector<std::string> extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config();
|
||||
ObjColorDialog color_dlg(nullptr, in_out, extruder_colours, Sidebar::should_show_SEMM_buttons());
|
||||
@@ -15309,7 +15314,7 @@ void Plater::import_model_id(wxString download_info)
|
||||
p->project.reset();
|
||||
|
||||
/* prepare project and profile */
|
||||
boost::thread import_thread = Slic3r::create_thread([&percent, &cont, &cancel, &retry_count, max_retries, &msg, &target_path, &download_ok, download_url, &filename] {
|
||||
boost::thread import_thread = Slic3r::create_thread([&percent, &cont, &retry_count, &msg, &target_path, &download_ok, download_url, &filename] {
|
||||
|
||||
// Orca: NetworkAgent is not needed and only prevents this from running
|
||||
// NetworkAgent* m_agent = Slic3r::GUI::wxGetApp().getAgent();
|
||||
@@ -15416,7 +15421,7 @@ void Plater::import_model_id(wxString download_info)
|
||||
msg = wxString::Format(_L("Project downloaded %d%%"), percent);
|
||||
}
|
||||
})
|
||||
.on_error([&msg, &cont, &retry_count, max_retries](std::string body, std::string error, unsigned http_status) {
|
||||
.on_error([&msg, &cont, &retry_count](std::string body, std::string error, unsigned http_status) {
|
||||
(void)body;
|
||||
BOOST_LOG_TRIVIAL(error) << format("Error getting: `%1%`: HTTP %2%, %3%",
|
||||
body,
|
||||
@@ -16316,6 +16321,7 @@ void Plater::calib_retraction(const Calib_Params& params)
|
||||
obj->config.set_key_value("wall_sequence", new ConfigOptionEnum<WallSequence>(WallSequence::InnerOuter));
|
||||
obj->config.set_key_value("overhang_reverse", new ConfigOptionBool(false));
|
||||
obj->config.set_key_value("precise_z_height", new ConfigOptionBool(false));
|
||||
obj->config.set_key_value("seam_slope_type", new ConfigOptionEnum<SeamScarfType>(SeamScarfType::None));
|
||||
|
||||
|
||||
changed_objects({ 0 });
|
||||
@@ -18718,6 +18724,8 @@ int Plater::export_3mf(const boost::filesystem::path& output_path, SaveStrategy
|
||||
nozzle_diameter_str = nozzle_diameter_option->serialize();
|
||||
|
||||
std::string printer_model_id = preset_bundle.printers.get_edited_preset().get_printer_type(&preset_bundle);
|
||||
// The printer reads slice_info.config and knows only its own catalog ids.
|
||||
auto* id_agent = preset_bundle.is_bbl_vendor() ? wxGetApp().getAgent() : nullptr;
|
||||
|
||||
for (int i = 0; i < plate_data_list.size(); i++) {
|
||||
PlateData *plate_data = plate_data_list[i];
|
||||
@@ -18727,6 +18735,8 @@ int Plater::export_3mf(const boost::filesystem::path& output_path, SaveStrategy
|
||||
std::string display_filament_type;
|
||||
it->type = cfg.get_filament_type(display_filament_type, it->id);
|
||||
it->filament_id = filament_id_opt ? filament_id_opt->get_at(it->id) : "";
|
||||
if (id_agent)
|
||||
it->filament_id = id_agent->from_orca_filament_id(it->filament_id);
|
||||
it->color = filament_color ? filament_color->get_at(it->id) : "#FFFFFF";
|
||||
// save filament info used in curr plate
|
||||
int index = p->partplate_list.get_curr_plate_index();
|
||||
@@ -21683,7 +21693,7 @@ void Plater::show_object_info()
|
||||
auto mesh_errors = p->sidebar->obj_list()->get_mesh_errors_info(&info_manifold, &non_manifold_edges);
|
||||
|
||||
if (non_manifold_edges > 0) {
|
||||
info_manifold += into_u8("\n" + _L("Tips:") + "\n" + _L("Use \"Fix Model\" to repair the mesh."));
|
||||
info_manifold += "\n" + _L("Tips:") + "\n" + _L("Use \"Fix Model\" to repair the mesh.");
|
||||
}
|
||||
|
||||
info_manifold = "<Error>" + info_manifold + "</Error>";
|
||||
|
||||
@@ -348,7 +348,7 @@ wxBoxSizer *PreferencesDialog::create_item_language_combobox(wxString title, wxS
|
||||
wxLanguage supported_languages[]{
|
||||
wxLANGUAGE_ENGLISH,
|
||||
wxLANGUAGE_CHINESE_SIMPLIFIED,
|
||||
wxLANGUAGE_CHINESE,
|
||||
wxLANGUAGE_CHINESE_TRADITIONAL,
|
||||
wxLANGUAGE_GERMAN,
|
||||
wxLANGUAGE_CZECH,
|
||||
wxLANGUAGE_FRENCH,
|
||||
@@ -409,7 +409,7 @@ wxBoxSizer *PreferencesDialog::create_item_language_combobox(wxString title, wxS
|
||||
if (vlist[i] == wxLocale::GetLanguageInfo(wxLANGUAGE_CHINESE_SIMPLIFIED)) {
|
||||
language_name = wxString::FromUTF8("\xe4\xb8\xad\xe6\x96\x87\x28\xe7\xae\x80\xe4\xbd\x93\x29");
|
||||
}
|
||||
else if (vlist[i] == wxLocale::GetLanguageInfo(wxLANGUAGE_CHINESE)) {
|
||||
else if (vlist[i] == wxLocale::GetLanguageInfo(wxLANGUAGE_CHINESE_TRADITIONAL)) {
|
||||
language_name = wxString::FromUTF8("\xe4\xb8\xad\xe6\x96\x87\x28\xe7\xb9\x81\xe9\xab\x94\x29");
|
||||
}
|
||||
else if (vlist[i] == wxLocale::GetLanguageInfo(wxLANGUAGE_SPANISH)) {
|
||||
@@ -521,7 +521,7 @@ wxBoxSizer *PreferencesDialog::create_item_language_combobox(wxString title, wxS
|
||||
}
|
||||
}
|
||||
|
||||
auto check = [this](bool yes_or_no) {
|
||||
auto check = [](bool yes_or_no) {
|
||||
// if (yes_or_no)
|
||||
// return true;
|
||||
int act_btns = ActionButtons::SAVE;
|
||||
@@ -1202,7 +1202,7 @@ wxBoxSizer* PreferencesDialog::create_item_button(wxString title, wxString title
|
||||
m_button_download->SetStyle(title2 == _L("Clear") ? ButtonStyle::Alert : ButtonStyle::Regular, ButtonType::Parameter);
|
||||
m_button_download->SetToolTip(tooltip2.IsEmpty() ? tooltip : tooltip2); // use label tooltip if button tooltip empty
|
||||
|
||||
m_button_download->Bind(wxEVT_BUTTON, [this, onclick](auto &e) { onclick(); });
|
||||
m_button_download->Bind(wxEVT_BUTTON, [onclick](auto &e) { onclick(); });
|
||||
|
||||
m_sizer->Add(m_button_download, 0, wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
@@ -1492,7 +1492,7 @@ void PreferencesDialog::create()
|
||||
m_sizer_body = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_pref_tabs = new TabCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES | wxBORDER_NONE | wxWANTS_CHARS | wxTR_FULL_ROW_HIGHLIGHT);
|
||||
m_pref_tabs->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable right select
|
||||
m_pref_tabs->Bind(wxEVT_RIGHT_DOWN, [](auto &e) {}); // disable right select
|
||||
m_pref_tabs->SetFont(Label::Body_14);
|
||||
|
||||
create_items();
|
||||
|
||||
@@ -873,10 +873,15 @@ PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset
|
||||
auto fila_type = Preset::remove_suffix_modified(GetValue().ToUTF8().data());
|
||||
bool is_official = boost::algorithm::starts_with(fila_type, "Bambu");
|
||||
if (is_official) {
|
||||
// Get filament_id from filament_presets
|
||||
// Get filament_id from filament_presets. FilamentPickerDialog looks up
|
||||
// filaments_color_codes.json, which is downloaded from Bambu and keyed by the
|
||||
// printer's own ids, so translate our OF id (the "GFA00" fallback is already one).
|
||||
const std::string& preset_name = m_preset_bundle->filament_presets[m_filament_idx];
|
||||
const Preset* selected_preset = m_collection->find_preset(preset_name);
|
||||
wxString fila_id = selected_preset ? wxString::FromUTF8(selected_preset->filament_id) : "GFA00";
|
||||
auto* agent = wxGetApp().getAgent();
|
||||
wxString fila_id = "GFA00";
|
||||
if (selected_preset)
|
||||
fila_id = wxString::FromUTF8(agent ? agent->from_orca_filament_id(selected_preset->filament_id) : selected_preset->filament_id);
|
||||
FilamentColor fila_color = get_cur_color_info();
|
||||
|
||||
// Show filament picker dialog
|
||||
@@ -1653,7 +1658,7 @@ void TabPresetComboBox::OnSelect(wxCommandEvent &evt)
|
||||
default: break;
|
||||
}
|
||||
if (sp != ConfigWizard::SP_WELCOME) {
|
||||
wxTheApp->CallAfter([this, sp]() {
|
||||
wxTheApp->CallAfter([sp]() {
|
||||
run_wizard(sp);
|
||||
});
|
||||
}
|
||||
@@ -1949,7 +1954,7 @@ GUI::CalibrateFilamentComboBox::CalibrateFilamentComboBox(wxWindow *parent)
|
||||
{
|
||||
clr_picker->SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE));
|
||||
clr_picker->SetToolTip("");
|
||||
clr_picker->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {});
|
||||
clr_picker->Bind(wxEVT_BUTTON, [](wxCommandEvent& e) {});
|
||||
}
|
||||
|
||||
GUI::CalibrateFilamentComboBox::~CalibrateFilamentComboBox()
|
||||
|
||||
@@ -2062,7 +2062,7 @@ void CrealityPrintHostSendDialog::init()
|
||||
}
|
||||
|
||||
for (auto* c : m_slot_combos) {
|
||||
c->Bind(wxEVT_COMBOBOX, [this, ext_slot_idx](wxCommandEvent& e) {
|
||||
c->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent& e) {
|
||||
int sel = e.GetSelection();
|
||||
if (sel >= 0 && sel < (int)m_printer_slots.size() &&
|
||||
m_printer_slots[sel].box_id == 0) {
|
||||
|
||||
@@ -164,7 +164,7 @@ void PrinterFileSystem::ListAllFiles()
|
||||
req["storage"] = m_file_storage;
|
||||
req["api_version"] = 2;
|
||||
req["notify"] = "DETAIL";
|
||||
SendRequest<FileList>(LIST_INFO, req, [this, type = m_file_type](json const& resp, FileList & list, auto) -> int {
|
||||
SendRequest<FileList>(LIST_INFO, req, [type = m_file_type](json const& resp, FileList & list, auto) -> int {
|
||||
json files = resp["file_lists"];
|
||||
for (auto& f : files) {
|
||||
std::string name = f["name"];
|
||||
@@ -1230,7 +1230,7 @@ boost::uint32_t PrinterFileSystem::RequestMediaAbility(int api_version)
|
||||
req["api_version"] = api_version;
|
||||
|
||||
return SendRequest<MediaAbilityList>(
|
||||
REQUEST_MEDIA_ABILITY, req, [this](const json &resp, MediaAbilityList &list, auto) -> int {
|
||||
REQUEST_MEDIA_ABILITY, req, [](const json &resp, MediaAbilityList &list, auto) -> int {
|
||||
json abliity_list = resp["storage"];
|
||||
list = abliity_list.get<MediaAbilityList>();
|
||||
return 0;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user