mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 15:37:30 -06:00
ENH:disable switching printers when sending printing
Change-Id: I9004f3de4f0968cc659a769970ff20c1e7f6f0be
This commit is contained in:
parent
47c04e75a7
commit
03819e6f86
3 changed files with 38 additions and 5 deletions
|
@ -966,6 +966,11 @@ ColorPickerPopup::ColorPickerPopup(wxWindow* parent)
|
|||
fg_sizer->Add(cp, 0, wxALL, FromDIP(3));
|
||||
cp->Bind(wxEVT_LEFT_DOWN, [this, cp](auto& e) {
|
||||
set_def_colour(cp->m_colour);
|
||||
|
||||
wxCommandEvent evt(EVT_SELECTED_COLOR);
|
||||
unsigned long g_col = ((cp->m_colour.Red() & 0xff) << 16) + ((cp->m_colour.Green() & 0xff) << 8) + (cp->m_colour.Blue() & 0xff);
|
||||
evt.SetInt(g_col);
|
||||
wxPostEvent(GetParent(), evt);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1004,13 +1009,27 @@ ColorPickerPopup::ColorPickerPopup(wxWindow* parent)
|
|||
|
||||
void ColorPickerPopup::set_ams_colours(std::vector<wxColour> ams)
|
||||
{
|
||||
m_ams_colors = ams;
|
||||
if (m_ams_color_pickers.size() > 0) {
|
||||
for (ColorPicker* col_pick:m_ams_color_pickers) {
|
||||
|
||||
std::vector<ColorPicker*>::iterator iter = find(m_color_pickers.begin(), m_color_pickers.end(), col_pick);
|
||||
if (iter != m_color_pickers.end()) {
|
||||
col_pick->Destroy();
|
||||
m_color_pickers.erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
m_ams_color_pickers.clear();
|
||||
}
|
||||
|
||||
|
||||
m_ams_colors = ams;
|
||||
for (wxColour col : m_ams_colors) {
|
||||
auto cp = new ColorPicker(m_def_color_box, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
cp->set_color(col);
|
||||
cp->set_selected(false);
|
||||
m_color_pickers.push_back(cp);
|
||||
m_ams_color_pickers.push_back(cp);
|
||||
m_ams_fg_sizer->Add(cp, 0, wxALL, FromDIP(3));
|
||||
cp->Bind(wxEVT_LEFT_DOWN, [this, cp](auto& e) {
|
||||
set_def_colour(cp->m_colour);
|
||||
|
@ -1029,19 +1048,20 @@ void ColorPickerPopup::set_ams_colours(std::vector<wxColour> ams)
|
|||
void ColorPickerPopup::set_def_colour(wxColour col)
|
||||
{
|
||||
m_def_col = col;
|
||||
bool set_already = false;
|
||||
|
||||
for (ColorPicker* cp : m_color_pickers) {
|
||||
|
||||
if (cp->m_selected) {
|
||||
cp->set_selected(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (cp->m_colour == m_def_col && !set_already) {
|
||||
for (ColorPicker* cp : m_color_pickers) {
|
||||
if (cp->m_colour == m_def_col) {
|
||||
cp->set_selected(true);
|
||||
set_already = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Dismiss();
|
||||
}
|
||||
|
||||
|
@ -1055,6 +1075,11 @@ void ColorPickerPopup::paintEvent(wxPaintEvent& evt)
|
|||
|
||||
void ColorPickerPopup::OnDismiss() {}
|
||||
|
||||
void ColorPickerPopup::Popup()
|
||||
{
|
||||
PopupWindow::Popup();
|
||||
}
|
||||
|
||||
bool ColorPickerPopup::ProcessLeftDown(wxMouseEvent& event) {
|
||||
return PopupWindow::ProcessLeftDown(event);
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
std::vector<wxColour> m_def_colors;
|
||||
std::vector<wxColour> m_ams_colors;
|
||||
std::vector<ColorPicker*> m_color_pickers;
|
||||
std::vector<ColorPicker*> m_ams_color_pickers;
|
||||
|
||||
public:
|
||||
ColorPickerPopup(wxWindow* parent);
|
||||
|
@ -63,6 +64,7 @@ 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;
|
||||
|
||||
|
|
|
@ -1490,6 +1490,9 @@ void SelectMachineDialog::update_select_layout(MachineObject *obj)
|
|||
|
||||
void SelectMachineDialog::prepare_mode()
|
||||
{
|
||||
// disable combobox
|
||||
m_comboBox_printer->Enable();
|
||||
|
||||
m_is_in_sending_mode = false;
|
||||
if (m_print_job) {
|
||||
m_print_job->join();
|
||||
|
@ -1510,6 +1513,9 @@ void SelectMachineDialog::prepare_mode()
|
|||
|
||||
void SelectMachineDialog::sending_mode()
|
||||
{
|
||||
// disable combobox
|
||||
m_comboBox_printer->Disable();
|
||||
|
||||
m_is_in_sending_mode = true;
|
||||
if (m_simplebook->GetSelection() != 1){
|
||||
m_simplebook->SetSelection(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue