mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-02-01 16:38:43 +03:00
Prusa 2.7.3
This commit is contained in:
@@ -60,7 +60,7 @@ CopyrightsDialog::CopyrightsDialog()
|
||||
m_html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition,
|
||||
wxSize(40 * em_unit(), 20 * em_unit()), wxHW_SCROLLBAR_AUTO);
|
||||
|
||||
wxFont font = get_default_font(this);
|
||||
wxFont font = this->GetFont();// get_default_font(this);
|
||||
const int fs = font.GetPointSize();
|
||||
const int fs2 = static_cast<int>(1.2f*fs);
|
||||
int size[] = { fs, fs, fs, fs, fs2, fs2, fs2 };
|
||||
@@ -289,7 +289,7 @@ AboutDialog::AboutDialog()
|
||||
"<a href=\"https://qidi3d.com/\">%6%</a>"
|
||||
"<br /><br />"
|
||||
"%7%<br />"
|
||||
"%8% © 2016-2023 Prusa Research. <br />"
|
||||
"%8% © 2016-2024 Prusa Research. <br />"
|
||||
"%9% © 2011-2018 Alessandro Ranellucci. <br />"
|
||||
"<a href=\"http://slic3r.org/\">Slic3r</a> %10% "
|
||||
"<a href=\"http://www.gnu.org/licenses/agpl-3.0.html\">%11%</a>."
|
||||
|
||||
@@ -287,7 +287,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
|
||||
bool have_default_acceleration = config->opt_float("default_acceleration") > 0;
|
||||
for (auto el : { "perimeter_acceleration", "infill_acceleration", "top_solid_infill_acceleration",
|
||||
"solid_infill_acceleration", "external_perimeter_acceleration",
|
||||
"bridge_acceleration", "first_layer_acceleration" })
|
||||
"bridge_acceleration", "first_layer_acceleration", "wipe_tower_acceleration"})
|
||||
toggle_field(el, have_default_acceleration);
|
||||
|
||||
bool have_skirt = config->opt_int("skirts") > 0;
|
||||
@@ -351,7 +351,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
|
||||
|
||||
bool have_wipe_tower = config->opt_bool("wipe_tower");
|
||||
for (auto el : { "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_brim_width", "wipe_tower_cone_angle",
|
||||
"wipe_tower_extra_spacing", "wipe_tower_bridging", "wipe_tower_no_sparse_layers", "single_extruder_multi_material_priming" })
|
||||
"wipe_tower_extra_spacing", "wipe_tower_extra_flow", "wipe_tower_bridging", "wipe_tower_no_sparse_layers", "single_extruder_multi_material_priming" })
|
||||
toggle_field(el, have_wipe_tower);
|
||||
|
||||
bool have_non_zero_mmu_segmented_region_max_width = config->opt_float("mmu_segmented_region_max_width") > 0.;
|
||||
|
||||
@@ -1512,11 +1512,11 @@ PageDownloader::PageDownloader(ConfigWizard* parent)
|
||||
));
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
|
||||
append_text(wxString::Format(_L(
|
||||
"On Linux systems the process of registration also creates desktop integration files for this version of application."
|
||||
)));
|
||||
#endif
|
||||
#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
|
||||
|
||||
box_allow_downloads->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& event) { this->m_downloader->allow(event.IsChecked()); });
|
||||
|
||||
@@ -1575,8 +1575,8 @@ bool DownloaderUtils::Worker::perform_register(const std::string& path_override/
|
||||
key_full = key_string;
|
||||
#elif __APPLE__
|
||||
// Apple registers for custom url in info.plist thus it has to be already registered since build.
|
||||
// The url will always trigger opening of qidislicer and we have to check that user has allowed it. (GUI_App::MacOpenURL is the triggered method)
|
||||
#else
|
||||
// The url will always trigger opening of prusaslicer and we have to check that user has allowed it. (GUI_App::MacOpenURL is the triggered method)
|
||||
#elif defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
|
||||
// the performation should be called later during desktop integration
|
||||
perform_registration_linux = true;
|
||||
#endif
|
||||
@@ -1594,7 +1594,7 @@ void DownloaderUtils::Worker::deregister()
|
||||
key_full = key_string;
|
||||
#elif __APPLE__
|
||||
// TODO
|
||||
#else
|
||||
#elif defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
|
||||
BOOST_LOG_TRIVIAL(debug) << "DesktopIntegrationDialog::undo_downloader_registration";
|
||||
DesktopIntegrationDialog::undo_downloader_registration();
|
||||
perform_registration_linux = false;
|
||||
@@ -2781,10 +2781,12 @@ bool ConfigWizard::priv::on_bnt_finish()
|
||||
{
|
||||
wxBusyCursor wait;
|
||||
|
||||
#if !defined(__linux__) || (defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION))
|
||||
if (!page_downloader->on_finish_downloader()) {
|
||||
index->go_to(page_downloader);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
/* If some printers were added/deleted, but related MaterialPage wasn't activated,
|
||||
* than last changes wouldn't be updated for filaments/materials.
|
||||
* SO, do that before check_and_install_missing_materials()
|
||||
@@ -3066,14 +3068,14 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
|
||||
if ((check_unsaved_preset_changes = install_bundles.size() > 0))
|
||||
header = _L_PLURAL("A new vendor was installed and one of its printers will be activated", "New vendors were installed and one of theirs printers will be activated", install_bundles.size());
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
|
||||
// Desktop integration on Linux
|
||||
BOOST_LOG_TRIVIAL(debug) << "ConfigWizard::priv::apply_config integrate_desktop" << page_welcome->integrate_desktop() << " perform_registration_linux " << page_downloader->m_downloader->get_perform_registration_linux();
|
||||
if (page_welcome->integrate_desktop())
|
||||
DesktopIntegrationDialog::perform_desktop_integration();
|
||||
if (page_downloader->m_downloader->get_perform_registration_linux())
|
||||
DesktopIntegrationDialog::perform_downloader_desktop_integration();
|
||||
#endif
|
||||
#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
|
||||
|
||||
// Decide whether to create snapshot based on run_reason and the reset profile checkbox
|
||||
bool snapshot = true;
|
||||
@@ -3412,7 +3414,9 @@ ConfigWizard::ConfigWizard(wxWindow *parent)
|
||||
|
||||
|
||||
p->add_page(p->page_update = new PageUpdate(this));
|
||||
#if !defined(__linux__) || (defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION))
|
||||
p->add_page(p->page_downloader = new PageDownloader(this));
|
||||
#endif
|
||||
p->add_page(p->page_reload_from_disk = new PageReloadFromDisk(this));
|
||||
#ifdef _WIN32
|
||||
p->add_page(p->page_files_association = new PageFilesAssociation(this));
|
||||
|
||||
@@ -2989,13 +2989,7 @@ void GUI_App::MacOpenFiles(const wxArrayString &fileNames)
|
||||
|
||||
void GUI_App::MacOpenURL(const wxString& url)
|
||||
{
|
||||
if (app_config && !app_config->get_bool("downloader_url_registered"))
|
||||
{
|
||||
notification_manager()->push_notification(NotificationType::URLNotRegistered);
|
||||
BOOST_LOG_TRIVIAL(error) << "Recieved command to open URL, but it is not allowed in app configuration. URL: " << url;
|
||||
return;
|
||||
}
|
||||
start_download(boost::nowide::narrow(url));
|
||||
start_download(into_u8(url));
|
||||
}
|
||||
|
||||
#endif /* __APPLE */
|
||||
@@ -3166,6 +3160,9 @@ void GUI_App::show_desktop_integration_dialog()
|
||||
|
||||
void GUI_App::show_downloader_registration_dialog()
|
||||
{
|
||||
#if defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION)
|
||||
return;
|
||||
#endif
|
||||
InfoDialog msg(nullptr
|
||||
, format_wxstr(_L("Welcome to %1% version %2%."), SLIC3R_APP_NAME, SLIC3R_VERSION)
|
||||
, format_wxstr(_L(
|
||||
@@ -3177,10 +3174,10 @@ void GUI_App::show_downloader_registration_dialog()
|
||||
if (msg.ShowModal() == wxID_YES) {
|
||||
auto downloader_worker = new DownloaderUtils::Worker(nullptr);
|
||||
downloader_worker->perform_register(app_config->get("url_downloader_dest"));
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
if (downloader_worker->get_perform_registration_linux())
|
||||
DesktopIntegrationDialog::perform_downloader_desktop_integration();
|
||||
#endif // __linux__
|
||||
#endif //(__linux__)
|
||||
} else {
|
||||
app_config->set("downloader_url_registered", "0");
|
||||
}
|
||||
@@ -3567,6 +3564,17 @@ void GUI_App::start_download(std::string url)
|
||||
BOOST_LOG_TRIVIAL(error) << "Could not start URL download: plater is nullptr.";
|
||||
return;
|
||||
}
|
||||
// Windows register and deregister executable path to registry - cant get here when not registered
|
||||
// Apple registers via info.plist attached to exectable - might get here
|
||||
// Linux registers via desktop integration file - might get here only if such file was created outside Slicer.
|
||||
// Desktop integration is limited with SLIC3R_DESKTOP_INTEGRATION (cmake option).
|
||||
#if defined(__APPLE__) || (defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION))
|
||||
if (app_config && app_config->get_bool("downloader_url_registered")) {
|
||||
notification_manager()->push_notification(NotificationType::URLNotRegistered);
|
||||
BOOST_LOG_TRIVIAL(error) << "Recieved command to open URL, but it is not allowed in app configuration. URL: " << url;
|
||||
return;
|
||||
}
|
||||
#endif //defined(__APPLE__) || (defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION))
|
||||
//lets always init so if the download dest folder was changed, new dest is used
|
||||
boost::filesystem::path dest_folder(app_config->get("url_downloader_dest"));
|
||||
if (dest_folder.empty() || !boost::filesystem::is_directory(dest_folder)) {
|
||||
|
||||
@@ -179,7 +179,7 @@ void ImGuiWrapper::set_language(const std::string &language)
|
||||
0,
|
||||
};
|
||||
m_font_cjk = false;
|
||||
if (lang == "cs" || lang == "pl" || lang == "hu") {
|
||||
if (lang == "cs" || lang == "pl" || lang == "hu" || lang == "sl") {
|
||||
ranges = ranges_latin2;
|
||||
} else if (lang == "ru" || lang == "uk" || lang == "be") {
|
||||
ranges = ImGui::GetIO().Fonts->GetGlyphRangesCyrillic(); // Default + about 400 Cyrillic characters
|
||||
|
||||
@@ -501,19 +501,23 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
|
||||
sizer->Add(m_wiping_dialog_button, 0, wxALIGN_CENTER_VERTICAL);
|
||||
m_wiping_dialog_button->Bind(wxEVT_BUTTON, ([parent](wxCommandEvent& e)
|
||||
{
|
||||
auto &project_config = wxGetApp().preset_bundle->project_config;
|
||||
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
||||
DynamicPrintConfig& project_config = preset_bundle->project_config;
|
||||
const bool use_custom_matrix = (project_config.option<ConfigOptionBool>("wiping_volumes_use_custom_matrix"))->value;
|
||||
const std::vector<double> &init_matrix = (project_config.option<ConfigOptionFloats>("wiping_volumes_matrix"))->values;
|
||||
const std::vector<double> &init_extruders = (project_config.option<ConfigOptionFloats>("wiping_volumes_extruders"))->values;
|
||||
|
||||
const std::vector<std::string> extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config();
|
||||
|
||||
WipingDialog dlg(parent, cast<float>(init_matrix), cast<float>(init_extruders), extruder_colours);
|
||||
// Extract the relevant config options, even values from possibly modified presets.
|
||||
const double default_purge = static_cast<const ConfigOptionFloat*>(preset_bundle->printers.get_edited_preset().config.option("multimaterial_purging"))->value;
|
||||
std::vector<double> filament_purging_multipliers = preset_bundle->get_config_options_for_current_filaments<ConfigOptionPercents>("filament_purge_multiplier");
|
||||
|
||||
WipingDialog dlg(parent, cast<float>(init_matrix), extruder_colours, default_purge, filament_purging_multipliers, use_custom_matrix);
|
||||
|
||||
if (dlg.ShowModal() == wxID_OK) {
|
||||
std::vector<float> matrix = dlg.get_matrix();
|
||||
std::vector<float> extruders = dlg.get_extruders();
|
||||
(project_config.option<ConfigOptionFloats>("wiping_volumes_matrix"))->values = std::vector<double>(matrix.begin(), matrix.end());
|
||||
(project_config.option<ConfigOptionFloats>("wiping_volumes_extruders"))->values = std::vector<double>(extruders.begin(), extruders.end());
|
||||
(project_config.option<ConfigOptionBool>("wiping_volumes_use_custom_matrix"))->value = dlg.get_use_custom_matrix();
|
||||
// Update Project dirty state, update application title bar.
|
||||
wxGetApp().plater()->update_project_dirty_from_presets();
|
||||
wxPostEvent(parent, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, parent));
|
||||
@@ -946,7 +950,8 @@ Sidebar::Sidebar(Plater *parent)
|
||||
int bmp_px_cnt = 32;
|
||||
#endif //__APPLE__
|
||||
ScalableBitmap bmp = ScalableBitmap(this, icon_name, bmp_px_cnt);
|
||||
*btn = new ScalableButton(this, wxID_ANY, bmp, "", wxBU_EXACTFIT);
|
||||
*btn = new ScalableButton(this, wxID_ANY, bmp, label, wxBU_EXACTFIT);
|
||||
(*btn)->SetFont(wxGetApp().bold_font());
|
||||
wxGetApp().SetWindowVariantForButton((*btn));
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -964,9 +969,10 @@ Sidebar::Sidebar(Plater *parent)
|
||||
(*btn)->Hide();
|
||||
};
|
||||
|
||||
init_scalable_btn(&p->btn_send_gcode , "export_gcode", _L("Send to printer") + " " +GUI::shortkey_ctrl_prefix() + "Shift+G");
|
||||
init_scalable_btn(&p->btn_send_gcode, "export_gcode", _L("Send to printer"), _L("Send to printer") + " " + GUI::shortkey_ctrl_prefix() + "Shift+G");
|
||||
// init_scalable_btn(&p->btn_eject_device, "eject_sd" , _L("Remove device ") + GUI::shortkey_ctrl_prefix() + "T");
|
||||
init_scalable_btn(&p->btn_export_gcode_removable, "export_to_sd", _L("Export to SD card / Flash drive") + " " + GUI::shortkey_ctrl_prefix() + "U");
|
||||
init_scalable_btn(&p->btn_export_gcode_removable, "export_to_sd", _L("Export"), _L("Export to SD card / Flash drive") + " " + GUI::shortkey_ctrl_prefix() + "U");
|
||||
//Y14
|
||||
// regular buttons "Slice now" and "Export G-code"
|
||||
|
||||
// const int scaled_height = p->btn_eject_device->GetBitmapHeight() + 4;
|
||||
@@ -2118,7 +2124,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
, config(Slic3r::DynamicPrintConfig::new_from_defaults_keys({
|
||||
"bed_shape", "bed_custom_texture", "bed_custom_model", "complete_objects", "duplicate_distance", "extruder_clearance_radius", "skirts", "skirt_distance",
|
||||
"brim_width", "brim_separation", "brim_type", "variable_layer_height", "nozzle_diameter", "single_extruder_multi_material",
|
||||
"wipe_tower", "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_brim_width", "wipe_tower_cone_angle", "wipe_tower_extra_spacing", "wipe_tower_extruder",
|
||||
"wipe_tower", "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_brim_width", "wipe_tower_cone_angle", "wipe_tower_extra_spacing", "wipe_tower_extra_flow", "wipe_tower_extruder",
|
||||
"extruder_colour", "filament_colour", "material_colour", "max_print_height", "printer_model", "printer_notes", "printer_technology",
|
||||
// These values are necessary to construct SlicingParameters by the Canvas3D variable layer height editor.
|
||||
"layer_height", "first_layer_height", "min_layer_height", "max_layer_height",
|
||||
|
||||
@@ -19,9 +19,13 @@
|
||||
#ifdef WIN32
|
||||
#include <wx/msw/registry.h>
|
||||
#endif // WIN32
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
|
||||
#include "DesktopIntegrationDialog.hpp"
|
||||
#endif //__linux__
|
||||
#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
|
||||
|
||||
#if defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION)
|
||||
#include "NotificationManager.hpp"
|
||||
#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -121,9 +125,11 @@ void PreferencesDialog::show(const std::string& highlight_opt_key /*= std::strin
|
||||
if (wxGetApp().is_editor()) {
|
||||
auto app_config = get_app_config();
|
||||
|
||||
#if !defined(__linux__) || (defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION))
|
||||
downloader->set_path_name(app_config->get("url_downloader_dest"));
|
||||
downloader->allow(!app_config->has("downloader_url_registered") || app_config->get_bool("downloader_url_registered"));
|
||||
|
||||
#endif
|
||||
for (const std::string& opt_key : {"suppress_hyperlinks", "downloader_url_registered"})
|
||||
m_optgroup_other->set_value(opt_key, app_config->get_bool(opt_key));
|
||||
|
||||
@@ -627,14 +633,18 @@ void PreferencesDialog::build()
|
||||
// "If disabled, the descriptions of configuration parameters in settings tabs will work as hyperlinks."),
|
||||
app_config->get_bool("suppress_hyperlinks"));
|
||||
|
||||
#if !defined(__linux__) || (defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION))
|
||||
append_bool_option(m_optgroup_other, "downloader_url_registered",
|
||||
L("Allow downloads from Printables.com"),
|
||||
L("If enabled, QIDISlicer will be allowed to download from Printables.com"),
|
||||
app_config->get_bool("downloader_url_registered"));
|
||||
#endif
|
||||
|
||||
activate_options_tab(m_optgroup_other);
|
||||
|
||||
#if !defined(__linux__) || (defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION))
|
||||
create_downloader_path_sizer();
|
||||
#endif
|
||||
create_settings_font_widget();
|
||||
|
||||
#if ENABLE_ENVIRONMENT_MAP
|
||||
@@ -739,16 +749,18 @@ void PreferencesDialog::update_ctrls_alignment()
|
||||
|
||||
void PreferencesDialog::accept(wxEvent&)
|
||||
{
|
||||
#if !defined(__linux__) || (defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION))
|
||||
if(wxGetApp().is_editor()) {
|
||||
if (const auto it = m_values.find("downloader_url_registered"); it != m_values.end())
|
||||
downloader->allow(it->second == "1");
|
||||
if (!downloader->on_finish())
|
||||
return;
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
if( downloader->get_perform_registration_linux())
|
||||
DesktopIntegrationDialog::perform_downloader_desktop_integration();
|
||||
#endif // __linux__
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<std::string> options_to_recreate_GUI = { "no_defaults", "tabs_as_menu", "sys_menu_enabled", "font_pt_size", "suppress_round_corners" };
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ void Chart::mouse_right_button_clicked(wxMouseEvent& event) {
|
||||
|
||||
|
||||
void Chart::mouse_clicked(wxMouseEvent& event) {
|
||||
m_uniform = (event.GetModifiers() == wxMOD_CONTROL);
|
||||
wxPoint point = event.GetPosition();
|
||||
int button_index = which_button_is_clicked(point);
|
||||
if ( button_index != -1) {
|
||||
@@ -132,7 +133,13 @@ void Chart::mouse_moved(wxMouseEvent& event) {
|
||||
}
|
||||
int delta_x = pos.x - m_previous_mouse.x;
|
||||
int delta_y = pos.y - m_previous_mouse.y;
|
||||
m_dragged->move(fixed_x?0:double(delta_x)/m_rect.GetWidth() * visible_area.m_width,-double(delta_y)/m_rect.GetHeight() * visible_area.m_height);
|
||||
double new_y = m_dragged->get_pos().m_y - double(delta_y) / m_rect.GetHeight() * visible_area.m_height;
|
||||
|
||||
if (m_uniform)
|
||||
for (ButtonToDrag& b : m_buttons)
|
||||
b.move(fixed_x?0:double(delta_x)/m_rect.GetWidth() * visible_area.m_width, new_y - b.get_pos().m_y);
|
||||
else
|
||||
m_dragged->move(fixed_x?0:double(delta_x)/m_rect.GetWidth() * visible_area.m_width, new_y - m_dragged->get_pos().m_y);
|
||||
m_previous_mouse = pos;
|
||||
recalculate_line();
|
||||
}
|
||||
@@ -259,7 +266,7 @@ std::vector<float> Chart::get_ramming_speed(float sampling) const {
|
||||
std::vector<float> speeds_out;
|
||||
|
||||
const int number_of_samples = std::round( visible_area.m_width / sampling);
|
||||
if (number_of_samples>0) {
|
||||
if (number_of_samples>0 && !m_line_to_draw.empty()) {
|
||||
const int dx = (m_line_to_draw.size()-1) / number_of_samples;
|
||||
for (int j=0;j<number_of_samples;++j) {
|
||||
float left = screen_to_math(wxPoint(0,m_line_to_draw[j*dx])).m_y;
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
{
|
||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
m_rect = wxRect(wxPoint(legend_side,0),rect.GetSize()-wxSize(legend_side,legend_side));
|
||||
visible_area = wxRect2DDouble(0.0, 0.0, sampling*ramming_speed_size, 20.);
|
||||
visible_area = wxRect2DDouble(0.0, 0.0, sampling*ramming_speed_size, 60.);
|
||||
m_buttons.clear();
|
||||
if (initial_buttons.size()>0)
|
||||
for (const auto& pair : initial_buttons)
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
recalculate_line();
|
||||
}
|
||||
void set_xy_range(float x,float y) {
|
||||
x = int(x/0.5) * 0.5;
|
||||
x = int(x/0.25) * 0.25;
|
||||
if (x>=0) visible_area.SetRight(x);
|
||||
if (y>=0) visible_area.SetBottom(y);
|
||||
recalculate_line();
|
||||
@@ -103,7 +103,6 @@ private:
|
||||
|
||||
|
||||
void recalculate_line();
|
||||
void recalculate_volume();
|
||||
|
||||
|
||||
wxRect m_rect; // rectangle on screen the chart is mapped into (screen coordinates)
|
||||
@@ -114,6 +113,7 @@ private:
|
||||
ButtonToDrag* m_dragged = nullptr;
|
||||
float m_total_volume = 0.f;
|
||||
|
||||
bool m_uniform = false; // testing only
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1615,6 +1615,7 @@ void TabPrint::build()
|
||||
optgroup->append_single_option_line("bridge_acceleration");
|
||||
optgroup->append_single_option_line("first_layer_acceleration");
|
||||
optgroup->append_single_option_line("first_layer_acceleration_over_raft");
|
||||
optgroup->append_single_option_line("wipe_tower_acceleration");
|
||||
optgroup->append_single_option_line("travel_acceleration");
|
||||
optgroup->append_single_option_line("default_acceleration");
|
||||
|
||||
@@ -1649,6 +1650,7 @@ void TabPrint::build()
|
||||
optgroup->append_single_option_line("wipe_tower_bridging");
|
||||
optgroup->append_single_option_line("wipe_tower_cone_angle");
|
||||
optgroup->append_single_option_line("wipe_tower_extra_spacing");
|
||||
optgroup->append_single_option_line("wipe_tower_extra_flow");
|
||||
optgroup->append_single_option_line("wipe_tower_no_sparse_layers");
|
||||
optgroup->append_single_option_line("single_extruder_multi_material_priming");
|
||||
|
||||
@@ -2284,6 +2286,9 @@ void TabFilament::build()
|
||||
optgroup->append_single_option_line("filament_cooling_moves");
|
||||
optgroup->append_single_option_line("filament_cooling_initial_speed");
|
||||
optgroup->append_single_option_line("filament_cooling_final_speed");
|
||||
optgroup->append_single_option_line("filament_stamping_loading_speed");
|
||||
optgroup->append_single_option_line("filament_stamping_distance");
|
||||
optgroup->append_single_option_line("filament_purge_multiplier");
|
||||
|
||||
create_line_with_widget(optgroup.get(), "filament_ramming_parameters", "", [this](wxWindow* parent) {
|
||||
auto ramming_dialog_btn = new wxButton(parent, wxID_ANY, _(L("Ramming settings"))+dots, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
|
||||
@@ -3419,6 +3424,7 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/)
|
||||
optgroup->append_single_option_line("cooling_tube_length");
|
||||
optgroup->append_single_option_line("parking_pos_retraction");
|
||||
optgroup->append_single_option_line("extra_loading_move");
|
||||
optgroup->append_single_option_line("multimaterial_purging");
|
||||
optgroup->append_single_option_line("high_current_on_filament_swap");
|
||||
if (from_initial_build)
|
||||
page->clear();
|
||||
|
||||
@@ -516,7 +516,7 @@ void DropDown::mouseReleased(wxMouseEvent& event)
|
||||
if (HasCapture())
|
||||
ReleaseMouse();
|
||||
if (hover_item >= 0) { // not moved
|
||||
#ifdef __WXOSX__
|
||||
#ifndef _WIN32
|
||||
// To avoid cases, when some dialog appears after item selection, but DropDown is still shown
|
||||
Hide();
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "BitmapCache.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "I18N.hpp"
|
||||
#include "slic3r/GUI/format.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "MsgDialog.hpp"
|
||||
|
||||
@@ -67,11 +68,6 @@ RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters)
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#define style wxSP_ARROW_KEYS | wxBORDER_SIMPLE
|
||||
#else
|
||||
#define style wxSP_ARROW_KEYS
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -105,11 +101,17 @@ RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters)
|
||||
#endif
|
||||
sizer_chart->Add(m_chart, 0, wxALL, 5);
|
||||
|
||||
m_widget_time = new ::SpinInputDouble(this,"", wxEmptyString, wxDefaultPosition, wxSize(ITEM_WIDTH(), -1), style, 0., 5., 3., 0.5);
|
||||
#ifdef _WIN32
|
||||
const long style = wxSP_ARROW_KEYS | wxBORDER_SIMPLE;
|
||||
#else
|
||||
const long style = wxSP_ARROW_KEYS;
|
||||
#endif
|
||||
|
||||
m_widget_time = new ::SpinInputDouble(this,"", wxEmptyString, wxDefaultPosition, wxSize(ITEM_WIDTH(), -1), style, 0., 5., 3., 0.25);
|
||||
m_widget_time->SetDigits(2);
|
||||
m_widget_volume = new ::SpinInput(this,"",wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,0,10000,0);
|
||||
m_widget_ramming_line_width_multiplicator = new ::SpinInput(this,"",wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,10,200,100);
|
||||
m_widget_ramming_step_multiplicator = new ::SpinInput(this,"",wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,10,200,100);
|
||||
m_widget_ramming_line_width_multiplicator = new ::SpinInput(this,"",wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,10,300,100);
|
||||
m_widget_ramming_step_multiplicator = new ::SpinInput(this,"",wxEmptyString,wxDefaultPosition,wxSize(ITEM_WIDTH(), -1),style,10,300,100);
|
||||
|
||||
#ifdef _WIN32
|
||||
update_ui(m_widget_time->GetText());
|
||||
@@ -129,6 +131,14 @@ RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters)
|
||||
gsizer_param->Add(m_widget_ramming_line_width_multiplicator);
|
||||
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Ramming line spacing")) + " (%):")), 0, wxALIGN_CENTER_VERTICAL);
|
||||
gsizer_param->Add(m_widget_ramming_step_multiplicator);
|
||||
gsizer_param->AddSpacer(40);
|
||||
gsizer_param->AddSpacer(40);
|
||||
|
||||
std::string ctrl_str = shortkey_ctrl_prefix();
|
||||
if (! ctrl_str.empty() && ctrl_str.back() == '+')
|
||||
ctrl_str.pop_back();
|
||||
// TRN: The placeholder expands to Ctrl or Cmd (on macOS).
|
||||
gsizer_param->Add(new wxStaticText(this, wxID_ANY, format_wxstr(_L("For constant flow rate, hold %1% while dragging."), ctrl_str)), 0, wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
sizer_param->Add(gsizer_param, 0, wxTOP, scale(10));
|
||||
|
||||
@@ -176,25 +186,52 @@ std::string RammingPanel::get_parameters()
|
||||
}
|
||||
|
||||
|
||||
// Parent dialog for purging volume adjustments - it fathers WipingPanel widget (that contains all controls) and a button to toggle simple/advanced mode:
|
||||
WipingDialog::WipingDialog(wxWindow* parent, const std::vector<float>& matrix, const std::vector<float>& extruders, const std::vector<std::string>& extruder_colours)
|
||||
// Parent dialog for purging volume adjustments - it fathers WipingPanel widget (that contains all controls) and a button.
|
||||
WipingDialog::WipingDialog(wxWindow* parent, const std::vector<float>& matrix, const std::vector<std::string>& extruder_colours,
|
||||
double printer_purging_volume, const std::vector<double>& filament_purging_multipliers, bool use_custom_matrix)
|
||||
: wxDialog(parent, wxID_ANY, _(L("Wipe tower - Purging volume adjustment")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE/* | wxRESIZE_BORDER*/)
|
||||
{
|
||||
SetFont(wxGetApp().normal_font());
|
||||
update_ui(this);
|
||||
auto widget_button = new wxButton(this,wxID_ANY,"-",wxPoint(0,0),wxDefaultSize);
|
||||
update_ui(widget_button);
|
||||
wxGetApp().SetWindowVariantForButton(widget_button);
|
||||
m_panel_wiping = new WipingPanel(this,matrix,extruders, extruder_colours, widget_button);
|
||||
m_widget_button = new wxButton(this,wxID_ANY,_L("Set values from configuration"), wxPoint(0, 0), wxDefaultSize);
|
||||
update_ui(m_widget_button);
|
||||
wxGetApp().SetWindowVariantForButton(m_widget_button);
|
||||
|
||||
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_radio_button1 = new wxRadioButton(this, wxID_ANY, _L("Use values from configuration"));
|
||||
m_radio_button2 = new wxRadioButton(this, wxID_ANY, _L("Use custom project-specific settings"));
|
||||
auto stb1 = new wxStaticBox(this, wxID_ANY, wxEmptyString);
|
||||
auto stb2 = new wxStaticBox(this, wxID_ANY, wxEmptyString);
|
||||
|
||||
m_panel_wiping = new WipingPanel(this, matrix, extruder_colours, filament_purging_multipliers, printer_purging_volume, m_widget_button);
|
||||
|
||||
update_ui(m_radio_button1);
|
||||
update_ui(m_radio_button2);
|
||||
update_ui(stb1);
|
||||
update_ui(stb2);
|
||||
|
||||
auto heading_text = new wxStaticText(this, wxID_ANY, _L("The project uses single-extruder multimaterial printer with the wipe tower.\nThe volume of material used for purging can be configured here.") ,wxDefaultPosition, wxDefaultSize);
|
||||
m_info_text1 = new wxStaticText(this, wxID_ANY, _L("Options 'multimaterial_purging' and 'filament_purge_multiplier' will be used.") ,wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
// set min sizer width according to extruders count
|
||||
const auto sizer_width = (int)((sqrt(matrix.size()) + 2.8)*ITEM_WIDTH());
|
||||
const auto sizer_width = (int)((std::sqrt(matrix.size()) + 2.8)*ITEM_WIDTH());
|
||||
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
main_sizer->SetMinSize(wxSize(sizer_width, -1));
|
||||
|
||||
main_sizer->Add(m_panel_wiping, 0, wxEXPAND | wxALL, 5);
|
||||
main_sizer->Add(widget_button, 0, wxALIGN_CENTER_HORIZONTAL | wxCENTER | wxBOTTOM, 5);
|
||||
main_sizer->Add(heading_text, 0, wxALL, 10);
|
||||
|
||||
main_sizer->Add(m_radio_button1, 0, wxALL, 10);
|
||||
auto stb_sizer1 = new wxStaticBoxSizer(stb1, wxHORIZONTAL);
|
||||
stb_sizer1->Add(m_info_text1, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
|
||||
main_sizer->Add(stb_sizer1, 0, wxALIGN_CENTER_HORIZONTAL | wxEXPAND | wxLEFT | wxRIGHT, 20);
|
||||
|
||||
auto t = new wxStaticText(this, wxID_ANY, _L("(all values in mm³)"), wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
main_sizer->Add(m_radio_button2, 0, wxALL, 10);
|
||||
auto stb_sizer2 = new wxStaticBoxSizer(stb2, wxVERTICAL);
|
||||
stb_sizer2->Add(m_panel_wiping, 0, wxEXPAND | wxALL, 5);
|
||||
stb_sizer2->Add(t, 0, wxALIGN_CENTER_HORIZONTAL | wxCENTER | wxBOTTOM, 5);
|
||||
stb_sizer2->Add(m_widget_button, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10);
|
||||
main_sizer->Add(stb_sizer2, 0, wxALIGN_CENTER_HORIZONTAL | wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 20);
|
||||
auto buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL);
|
||||
wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton());
|
||||
wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton());
|
||||
@@ -209,32 +246,46 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector<float>& matrix, c
|
||||
|
||||
this->Bind(wxEVT_BUTTON,[this](wxCommandEvent&) { // if OK button is clicked..
|
||||
m_output_matrix = m_panel_wiping->read_matrix_values(); // ..query wiping panel and save returned values
|
||||
m_output_extruders = m_panel_wiping->read_extruders_values(); // so they can be recovered later by calling get_...()
|
||||
EndModal(wxID_OK);
|
||||
},wxID_OK);
|
||||
|
||||
this->Bind(wxEVT_RADIOBUTTON, [this](wxCommandEvent&) {
|
||||
enable_or_disable_panel();
|
||||
});
|
||||
|
||||
m_radio_button1->SetValue(! use_custom_matrix);
|
||||
m_radio_button2->SetValue(use_custom_matrix);
|
||||
enable_or_disable_panel();
|
||||
this->Show();
|
||||
}
|
||||
|
||||
// This function allows to "play" with sizers parameters (like align or border)
|
||||
void WipingPanel::format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_sizer, const wxString& info, const wxString& table_title, int table_lshift/*=0*/)
|
||||
// This function allows to "play" with sizrs parameters (like align or border)
|
||||
void WipingPanel::format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_sizer, const wxString& table_title, int table_lshift/*=0*/)
|
||||
{
|
||||
wxSize text_size = GetTextExtent(info);
|
||||
auto info_str = new wxStaticText(page, wxID_ANY, info ,wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER);
|
||||
info_str->Wrap(int(0.6*text_size.x));
|
||||
sizer->Add( info_str, 0, wxEXPAND);
|
||||
auto table_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
sizer->Add(table_sizer, 0, wxALIGN_CENTER | wxCENTER, table_lshift);
|
||||
table_sizer->Add(new wxStaticText(page, wxID_ANY, table_title), 0, wxALIGN_CENTER | wxTOP, 50);
|
||||
table_sizer->Add(grid_sizer, 0, wxALIGN_CENTER | wxTOP, 10);
|
||||
table_sizer->Add(new wxStaticText(page, wxID_ANY, table_title), 0, wxALIGN_CENTER | wxTOP, 10);
|
||||
table_sizer->Add(grid_sizer, 0, wxALIGN_CENTER | wxTOP | wxLEFT, 15);
|
||||
}
|
||||
|
||||
// This panel contains all control widgets for both simple and advanced mode (these reside in separate sizers)
|
||||
WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, const std::vector<float>& extruders, const std::vector<std::string>& extruder_colours, wxButton* widget_button)
|
||||
WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, const std::vector<std::string>& extruder_colours,
|
||||
const std::vector<double>& filament_purging_multipliers, double printer_purging_volume, wxButton* widget_button)
|
||||
: wxPanel(parent,wxID_ANY, wxDefaultPosition, wxDefaultSize/*,wxBORDER_RAISED*/)
|
||||
{
|
||||
m_filament_purging_multipliers = filament_purging_multipliers;
|
||||
m_printer_purging_volume = printer_purging_volume;
|
||||
m_widget_button = widget_button; // pointer to the button in parent dialog
|
||||
m_widget_button->Bind(wxEVT_BUTTON,[this](wxCommandEvent&){ toggle_advanced(true); });
|
||||
m_widget_button->Bind(wxEVT_BUTTON,[this](wxCommandEvent&){
|
||||
// Set the matrix to defaults.
|
||||
for (size_t i = 0; i < m_number_of_extruders; ++i) {
|
||||
for (size_t j = 0; j < m_number_of_extruders; ++j) {
|
||||
if (i != j) {
|
||||
double def_val = m_printer_purging_volume * m_filament_purging_multipliers[j] / 100.;
|
||||
edit_boxes[j][i]->SetValue(wxString("") << int(def_val));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
m_number_of_extruders = (int)(sqrt(matrix.size())+0.001);
|
||||
|
||||
@@ -244,18 +295,12 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
|
||||
m_colours.push_back(wxColor(rgb.r_uchar(), rgb.g_uchar(), rgb.b_uchar()));
|
||||
}
|
||||
|
||||
// Create two switched panels with their own sizers
|
||||
m_sizer_simple = new wxBoxSizer(wxVERTICAL);
|
||||
m_sizer_advanced = new wxBoxSizer(wxVERTICAL);
|
||||
m_page_simple = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
m_page_advanced = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
m_page_simple->SetSizer(m_sizer_simple);
|
||||
m_page_advanced->SetSizer(m_sizer_advanced);
|
||||
|
||||
update_ui(m_page_simple);
|
||||
update_ui(m_page_advanced);
|
||||
|
||||
auto gridsizer_simple = new wxGridSizer(3, 5, 10);
|
||||
m_gridsizer_advanced = new wxGridSizer(m_number_of_extruders+1, 5, 1);
|
||||
|
||||
// First create controls for advanced mode and assign them to m_page_advanced:
|
||||
@@ -308,57 +353,15 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
|
||||
}
|
||||
|
||||
// collect and format sizer
|
||||
format_sizer(m_sizer_advanced, m_page_advanced, m_gridsizer_advanced,
|
||||
_(L("Here you can adjust required purging volume (mm³) for any given pair of tools.")),
|
||||
_(L("Extruder changed to")));
|
||||
format_sizer(m_sizer_advanced, m_page_advanced, m_gridsizer_advanced, _(L("Extruder changed to")));
|
||||
|
||||
// Hide preview page before new page creating
|
||||
// It allows to do that from a beginning of the main panel
|
||||
m_page_advanced->Hide();
|
||||
|
||||
// Now the same for simple mode:
|
||||
gridsizer_simple->Add(new wxStaticText(m_page_simple, wxID_ANY, wxString("")), 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL);
|
||||
gridsizer_simple->Add(new wxStaticText(m_page_simple, wxID_ANY, wxString(_(L("unloaded")))), 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL);
|
||||
gridsizer_simple->Add(new wxStaticText(m_page_simple,wxID_ANY,wxString(_(L("loaded")))), 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
auto add_spin_ctrl = [this](std::vector<::SpinInput*>& vec, float initial)
|
||||
{
|
||||
::SpinInput* spin_ctrl = new ::SpinInput(m_page_simple, "", wxEmptyString, wxDefaultPosition, wxSize(ITEM_WIDTH(), -1), style | wxALIGN_RIGHT, 0, 300, (int)initial);
|
||||
update_ui(spin_ctrl);
|
||||
vec.push_back(spin_ctrl);
|
||||
|
||||
};
|
||||
|
||||
for (unsigned int i=0;i<m_number_of_extruders;++i) {
|
||||
add_spin_ctrl(m_old, extruders[2 * i]);
|
||||
add_spin_ctrl(m_new, extruders[2 * i+1]);
|
||||
|
||||
auto hsizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxWindow* w = new wxWindow(m_page_simple, wxID_ANY, wxDefaultPosition, icon_size, wxBORDER_SIMPLE);
|
||||
w->SetCanFocus(false);
|
||||
w->SetBackgroundColour(m_colours[i]);
|
||||
hsizer->Add(w, wxALIGN_CENTER_VERTICAL);
|
||||
hsizer->AddSpacer(10);
|
||||
hsizer->Add(new wxStaticText(m_page_simple, wxID_ANY, wxString(_(L("Tool #"))) << i + 1 << ": "), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
gridsizer_simple->Add(hsizer, 1, wxEXPAND);
|
||||
gridsizer_simple->Add(m_old.back(),0);
|
||||
gridsizer_simple->Add(m_new.back(),0);
|
||||
}
|
||||
|
||||
// collect and format sizer
|
||||
format_sizer(m_sizer_simple, m_page_simple, gridsizer_simple,
|
||||
_(L("Total purging volume is calculated by summing two values below, depending on which tools are loaded/unloaded.")),
|
||||
_(L("Volume to purge (mm³) when the filament is being")), 50);
|
||||
|
||||
m_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_sizer->Add(m_page_simple, 0, wxEXPAND | wxALL, 25);
|
||||
m_sizer->Add(m_page_advanced, 0, wxEXPAND | wxALL, 25);
|
||||
m_sizer->Add(m_page_advanced, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
m_sizer->SetSizeHints(this);
|
||||
SetSizer(m_sizer);
|
||||
|
||||
toggle_advanced(); // to show/hide what is appropriate
|
||||
|
||||
m_page_advanced->Bind(wxEVT_PAINT,[this](wxPaintEvent&) {
|
||||
wxPaintDC dc(m_page_advanced);
|
||||
@@ -368,6 +371,21 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
|
||||
int text_height = 0;
|
||||
dc.GetTextExtent(label,&text_width,&text_height);
|
||||
int xpos = m_gridsizer_advanced->GetPosition().x;
|
||||
if (!m_page_advanced->IsEnabled()) {
|
||||
dc.SetTextForeground(wxSystemSettings::GetColour(
|
||||
#if defined (__linux__) && defined (__WXGTK2__)
|
||||
wxSYS_COLOUR_BTNTEXT
|
||||
#else
|
||||
wxSYS_COLOUR_GRAYTEXT
|
||||
#endif
|
||||
));
|
||||
dc.DrawRotatedText(label, xpos - text_height, y_pos + text_width / 2.f, 90);
|
||||
#ifdef _WIN32
|
||||
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT));
|
||||
dc.DrawRotatedText(label, xpos - text_height-1, y_pos + text_width / 2.f+1, 90);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
dc.DrawRotatedText(label,xpos-text_height,y_pos + text_width/2.f,90);
|
||||
});
|
||||
}
|
||||
@@ -377,8 +395,6 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
|
||||
|
||||
// Reads values from the (advanced) wiping matrix:
|
||||
std::vector<float> WipingPanel::read_matrix_values() {
|
||||
if (!m_advanced)
|
||||
fill_in_matrix();
|
||||
std::vector<float> output;
|
||||
for (unsigned int i=0;i<m_number_of_extruders;++i) {
|
||||
for (unsigned int j=0;j<m_number_of_extruders;++j) {
|
||||
@@ -390,60 +406,12 @@ std::vector<float> WipingPanel::read_matrix_values() {
|
||||
return output;
|
||||
}
|
||||
|
||||
// Reads values from simple mode to save them for next time:
|
||||
std::vector<float> WipingPanel::read_extruders_values() {
|
||||
std::vector<float> output;
|
||||
for (unsigned int i=0;i<m_number_of_extruders;++i) {
|
||||
output.push_back(m_old[i]->GetValue());
|
||||
output.push_back(m_new[i]->GetValue());
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
// This updates the "advanced" matrix based on values from "simple" mode
|
||||
void WipingPanel::fill_in_matrix() {
|
||||
for (unsigned i=0;i<m_number_of_extruders;++i) {
|
||||
for (unsigned j=0;j<m_number_of_extruders;++j) {
|
||||
if (i==j) continue;
|
||||
edit_boxes[j][i]->SetValue(wxString("")<< (m_old[i]->GetValue() + m_new[j]->GetValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Function to check if simple and advanced settings are matching
|
||||
bool WipingPanel::advanced_matches_simple() {
|
||||
for (unsigned i=0;i<m_number_of_extruders;++i) {
|
||||
for (unsigned j=0;j<m_number_of_extruders;++j) {
|
||||
if (i==j) continue;
|
||||
if (edit_boxes[j][i]->GetValue() != (wxString("")<< (m_old[i]->GetValue() + m_new[j]->GetValue())))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Switches the dialog from simple to advanced mode and vice versa
|
||||
void WipingPanel::toggle_advanced(bool user_action) {
|
||||
if (m_advanced && !advanced_matches_simple() && user_action) {
|
||||
if (MessageDialog(this, _L("Switching to simple settings will discard changes done in the advanced mode!\n\nDo you want to proceed?"),
|
||||
_L("Warning"),wxYES_NO|wxICON_EXCLAMATION).ShowModal() != wxID_YES)
|
||||
return;
|
||||
}
|
||||
if (user_action)
|
||||
m_advanced = !m_advanced; // user demands a change -> toggle
|
||||
else
|
||||
m_advanced = !advanced_matches_simple(); // if called from constructor, show what is appropriate
|
||||
|
||||
(m_advanced ? m_page_advanced : m_page_simple)->Show();
|
||||
(!m_advanced ? m_page_advanced : m_page_simple)->Hide();
|
||||
|
||||
m_widget_button->SetLabel(m_advanced ? _(L("Show simplified settings")) : _(L("Show advanced settings")));
|
||||
if (m_advanced)
|
||||
if (user_action) fill_in_matrix(); // otherwise keep values loaded from config
|
||||
|
||||
m_sizer->Layout();
|
||||
Refresh();
|
||||
|
||||
void WipingDialog::enable_or_disable_panel()
|
||||
{
|
||||
bool enable = m_radio_button2->GetValue();
|
||||
m_info_text1->Enable(! enable);
|
||||
m_widget_button->Enable(enable);
|
||||
m_panel_wiping->Enable(enable);
|
||||
m_panel_wiping->Refresh();
|
||||
}
|
||||
|
||||
@@ -47,29 +47,22 @@ private:
|
||||
|
||||
class WipingPanel : public wxPanel {
|
||||
public:
|
||||
WipingPanel(wxWindow* parent, const std::vector<float>& matrix, const std::vector<float>& extruders, const std::vector<std::string>& extruder_colours, wxButton* widget_button);
|
||||
WipingPanel(wxWindow* parent, const std::vector<float>& matrix, const std::vector<std::string>& extruder_colours,
|
||||
const std::vector<double>& filament_purging_multipliers, double printer_purging_volume, wxButton* widget_button);
|
||||
std::vector<float> read_matrix_values();
|
||||
std::vector<float> read_extruders_values();
|
||||
void toggle_advanced(bool user_action = false);
|
||||
void format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_sizer, const wxString& info, const wxString& table_title, int table_lshift=0);
|
||||
void format_sizer(wxSizer* sizer, wxPanel* page, wxGridSizer* grid_sizer, const wxString& table_title, int table_lshift=0);
|
||||
|
||||
private:
|
||||
void fill_in_matrix();
|
||||
bool advanced_matches_simple();
|
||||
|
||||
std::vector<::SpinInput*> m_old;
|
||||
std::vector<::SpinInput*> m_new;
|
||||
std::vector<std::vector<wxTextCtrl*>> edit_boxes;
|
||||
std::vector<wxColour> m_colours;
|
||||
unsigned int m_number_of_extruders = 0;
|
||||
bool m_advanced = false;
|
||||
wxPanel* m_page_simple = nullptr;
|
||||
wxPanel* m_page_advanced = nullptr;
|
||||
wxBoxSizer* m_sizer = nullptr;
|
||||
wxBoxSizer* m_sizer_simple = nullptr;
|
||||
wxBoxSizer* m_sizer_advanced = nullptr;
|
||||
wxGridSizer* m_gridsizer_advanced = nullptr;
|
||||
wxButton* m_widget_button = nullptr;
|
||||
double m_printer_purging_volume;
|
||||
std::vector<double> m_filament_purging_multipliers; // In percents !
|
||||
};
|
||||
|
||||
|
||||
@@ -78,15 +71,20 @@ private:
|
||||
|
||||
class WipingDialog : public wxDialog {
|
||||
public:
|
||||
WipingDialog(wxWindow* parent, const std::vector<float>& matrix, const std::vector<float>& extruders, const std::vector<std::string>& extruder_colours);
|
||||
WipingDialog(wxWindow* parent, const std::vector<float>& matrix, const std::vector<std::string>& extruder_colours,
|
||||
double printer_purging_volume, const std::vector<double>& filament_purging_multipliers, bool use_custom_matrix);
|
||||
std::vector<float> get_matrix() const { return m_output_matrix; }
|
||||
std::vector<float> get_extruders() const { return m_output_extruders; }
|
||||
bool get_use_custom_matrix() const { return m_radio_button2->GetValue(); }
|
||||
|
||||
|
||||
private:
|
||||
void enable_or_disable_panel();
|
||||
WipingPanel* m_panel_wiping = nullptr;
|
||||
std::vector<float> m_output_matrix;
|
||||
std::vector<float> m_output_extruders;
|
||||
wxRadioButton* m_radio_button1 = nullptr;
|
||||
wxRadioButton* m_radio_button2 = nullptr;
|
||||
wxButton* m_widget_button = nullptr;
|
||||
wxStaticText* m_info_text1 = nullptr;
|
||||
};
|
||||
|
||||
#endif // _WIPE_TOWER_DIALOG_H_
|
||||
Reference in New Issue
Block a user