Files
OrcaSlicer/src/slic3r/GUI/FilamentMapDialog.hpp
xun.zhang 897a78ce9a ENH: refine the logic of filament map dialog
1. Always change the map and mode in plate if plate mode is not default
2. Always add pop up before slice
3. Fix the mapping issue in gcode viewer

jira: studio-9523,studio-9519,studio-9513,studio-9479

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I0d7d5daf081951ea2d49e06565762ac24064e77c
(cherry picked from commit afaa48520e16b6808f05e511ac1cfe91acadc84b)
2025-09-09 11:03:56 +08:00

91 lines
2.4 KiB
C++

#ifndef slic3r_FilamentMapDialog_hpp_
#define slic3r_FilamentMapDialog_hpp_
#include "FilamentMapPanel.hpp"
#include <vector>
#include "CapsuleButton.hpp"
#include "Widgets/CheckBox.hpp"
class Button;
namespace Slic3r {
class DynamicPrintConfig;
namespace GUI {
class DragDropPanel;
class Plater;
class PartPlate;
/**
* @brief Try to pop up the filament map dialog before slicing.
*
* Only pop up in multi extruder machines. If user don't want the pop up, we
* pop up if the applied filament map mode in manual
*
* @param skip_plate_sync whether sync the map mode change to plate. In slice all, we should skip the sync and change on global param
* @param plater_ref Plater to get/set global filament map
* @param partplate_ref Partplate to get/set plate filament map mode
* @return whether continue slicing
*/
bool try_pop_up_before_slice(bool skip_plate_sync, Plater* plater_ref, PartPlate* partplate_ref);
class FilamentMapDialog : public wxDialog
{
enum PageType {
ptAuto,
ptManual,
ptDefault
};
public:
FilamentMapDialog(wxWindow *parent,
const std::vector<std::string>& filament_color,
const std::vector<int> &filament_map,
const std::vector<int> &filaments,
const FilamentMapMode mode,
bool machine_synced,
bool show_default=true,
bool with_checkbox = false
);
FilamentMapMode get_mode();
std::vector<int> get_filament_maps() const {
if (m_page_type == PageType::ptManual)
return m_filament_map;
return {};
}
int ShowModal();
void set_modal_btn_labels(const wxString& left_label, const wxString& right_label);
private:
void on_ok(wxCommandEvent &event);
void on_cancle(wxCommandEvent &event);
void on_switch_mode(wxCommandEvent &event);
void on_checkbox(wxCommandEvent &event);
void update_panel_status(PageType page);
private:
FilamentMapManualPanel* m_manual_map_panel;
FilamentMapAutoPanel* m_auto_map_panel;
FilamentMapDefaultPanel* m_default_map_panel;
CapsuleButton* m_auto_btn;
CapsuleButton* m_manual_btn;
CapsuleButton* m_default_btn;
Button* m_ok_btn;
Button* m_cancel_btn;
CheckBox* m_checkbox;
PageType m_page_type;
private:
std::vector<int> m_filament_map;
std::vector<std::string> m_filament_color;
};
}} // namespace Slic3r::GUI
#endif /* slic3r_FilamentMapDialog_hpp_ */