mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-02-15 08:59:39 -07:00
Merge branch 'main' into dev/bbl-network-upd
This commit is contained in:
commit
13e4b54754
16 changed files with 104 additions and 285 deletions
|
|
@ -1016,7 +1016,7 @@ wxWindow *CreateFilamentPresetDialog::create_dialog_buttons()
|
|||
|
||||
auto btn_ok = dlg_btns->GetOK();
|
||||
btn_ok->SetLabel(_L("Create"));
|
||||
btn_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
btn_ok->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
//get vendor name
|
||||
wxString vendor_str = m_filament_vendor_combobox->GetLabel();
|
||||
std::string vendor_name;
|
||||
|
|
@ -1174,7 +1174,7 @@ wxWindow *CreateFilamentPresetDialog::create_dialog_buttons()
|
|||
EndModal(wxID_OK);
|
||||
});
|
||||
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
EndModal(wxID_CANCEL);
|
||||
});
|
||||
|
||||
|
|
@ -2024,13 +2024,13 @@ wxWindow *CreatePrinterPresetDialog::create_page1_dialog_buttons(wxWindow *paren
|
|||
{
|
||||
auto dlg_btns = new DialogButtons(parent, {"OK", "Cancel"});
|
||||
|
||||
dlg_btns->GetOK()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
if (!validate_input_valid()) return;
|
||||
data_init();
|
||||
show_page2();
|
||||
});
|
||||
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_CANCEL); });
|
||||
|
||||
return dlg_btns;
|
||||
}
|
||||
|
|
@ -2577,13 +2577,13 @@ wxBoxSizer *CreatePrinterPresetDialog::create_presets_template_item(wxWindow *pa
|
|||
|
||||
wxWindow *CreatePrinterPresetDialog::create_page2_dialog_buttons(wxWindow *parent)
|
||||
{
|
||||
auto dlg_btns = new DialogButtons(parent, {"Back", "OK", "Cancel"});
|
||||
auto dlg_btns = new DialogButtons(parent, {"Return", "OK", "Cancel"});
|
||||
|
||||
dlg_btns->GetBACK()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { show_page1(); });
|
||||
dlg_btns->GetRETURN()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { show_page1(); });
|
||||
|
||||
auto btn_ok = dlg_btns->GetOK();
|
||||
btn_ok->SetLabel(_L("Create"));
|
||||
btn_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
btn_ok->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
const wxString curr_selected_printer_type = curr_create_printer_type();
|
||||
|
|
@ -2828,7 +2828,7 @@ wxWindow *CreatePrinterPresetDialog::create_page2_dialog_buttons(wxWindow *paren
|
|||
|
||||
});
|
||||
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_CANCEL); });
|
||||
|
||||
return dlg_btns;
|
||||
}
|
||||
|
|
@ -3277,7 +3277,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con
|
|||
else if (create_success_type == FILAMENT && sync_user_preset_need_enabled)
|
||||
dlg_btns->GetOK()->SetLabel(_L("Sync user presets"));
|
||||
|
||||
dlg_btns->GetOK()->Bind(wxEVT_LEFT_DOWN, [this, sync_user_preset_need_enabled](wxMouseEvent &e) {
|
||||
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this, sync_user_preset_need_enabled](wxCommandEvent &e) {
|
||||
if (sync_user_preset_need_enabled) {
|
||||
wxGetApp().app_config->set("sync_user_preset", "true");
|
||||
wxGetApp().start_sync_user_preset();
|
||||
|
|
@ -3286,7 +3286,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con
|
|||
});
|
||||
|
||||
if (is_cancel_needed)
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_CANCEL); });
|
||||
|
||||
m_main_sizer->Add(dlg_btns, 0, wxEXPAND);
|
||||
|
||||
|
|
@ -4028,7 +4028,7 @@ ExportConfigsDialog::ExportCase ExportConfigsDialog::archive_process_preset_to_f
|
|||
wxWindow *ExportConfigsDialog::create_dialog_buttons(wxWindow* parent)
|
||||
{
|
||||
auto dlg_btns = new DialogButtons(parent, {"OK", "Cancel"});
|
||||
dlg_btns->GetOK()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
if (!has_check_box_selected()) {
|
||||
MessageDialog dlg(this, _L("Please select at least one printer or filament."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
||||
wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||
|
|
@ -4065,7 +4065,7 @@ wxWindow *ExportConfigsDialog::create_dialog_buttons(wxWindow* parent)
|
|||
EndModal(wxID_OK);
|
||||
});
|
||||
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_CANCEL); });
|
||||
|
||||
return dlg_btns;
|
||||
}
|
||||
|
|
@ -4598,7 +4598,7 @@ wxWindow *EditFilamentPresetDialog::create_dialog_buttons()
|
|||
e.Skip();
|
||||
}));
|
||||
|
||||
dlg_btns->GetOK()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_OK); });
|
||||
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_OK); });
|
||||
|
||||
return dlg_btns;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,10 +258,10 @@ void OptionsGroup::activate_line(Line& line)
|
|||
) {
|
||||
// BBS: new layout
|
||||
const auto h_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(h_sizer, 1, wxEXPAND | wxALL, wxOSX ? 0 : 15);
|
||||
sizer->Add(h_sizer, 1, wxEXPAND | wxALL, (wxOSX && !staticbox) ? 0 : 15);
|
||||
if (line.widget != nullptr) {
|
||||
// description lines
|
||||
sizer->Add(line.widget(this->ctrl_parent()), 0, wxEXPAND | wxALL, wxOSX ? 0 : 15);
|
||||
sizer->Add(line.widget(this->ctrl_parent()), 0, wxEXPAND | wxALL, (wxOSX && !staticbox) ? 0 : 15);
|
||||
return;
|
||||
}
|
||||
if (!line.get_extra_widgets().empty()) {
|
||||
|
|
@ -282,9 +282,9 @@ void OptionsGroup::activate_line(Line& line)
|
|||
// BBS: new layout
|
||||
custom_ctrl->SetLabel("");
|
||||
if (is_legend_line)
|
||||
sizer->Add(custom_ctrl, 0, wxEXPAND | wxLEFT, wxOSX ? 0 : 10);
|
||||
sizer->Add(custom_ctrl, 0, wxEXPAND | wxLEFT, (wxOSX && !staticbox) ? 0 : 10);
|
||||
else
|
||||
sizer->Add(custom_ctrl, 0, wxEXPAND | wxALL, wxOSX || !staticbox ? 0 : 5);
|
||||
sizer->Add(custom_ctrl, 0, wxEXPAND | wxALL, !staticbox ? 0 : 5);
|
||||
}
|
||||
|
||||
// Set sidetext width for a better alignment of options in line
|
||||
|
|
@ -304,7 +304,7 @@ void OptionsGroup::activate_line(Line& line)
|
|||
|
||||
// BBS: new layout
|
||||
const auto h_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(h_sizer, 1, wxEXPAND | wxALL, wxOSX ? 0 : 5);
|
||||
sizer->Add(h_sizer, 1, wxEXPAND | wxALL, (wxOSX && !staticbox) ? 0 : 5);
|
||||
if (is_window_field(field))
|
||||
h_sizer->Add(field->getWindow(), 1, wxEXPAND | wxLEFT, option.opt.multiline ? 0 : titleWidth * wxGetApp().em_unit());
|
||||
if (is_sizer_field(field))
|
||||
|
|
@ -509,7 +509,7 @@ bool OptionsGroup::activate(std::function<void()> throw_if_canceled/* = [](){}*/
|
|||
static_cast<wxFlexGridSizer*>(m_grid_sizer)->SetFlexibleDirection(wxBOTH);
|
||||
static_cast<wxFlexGridSizer*>(m_grid_sizer)->AddGrowableCol(grow_col);
|
||||
|
||||
sizer->Add(m_grid_sizer, 0, wxEXPAND | wxALL, wxOSX || !staticbox ? 0 : 5);
|
||||
sizer->Add(m_grid_sizer, 0, wxEXPAND | wxALL, !staticbox ? 0 : 5);
|
||||
|
||||
// activate lines
|
||||
for (Line& line: m_lines) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "PlateSettingsDialog.hpp"
|
||||
#include "MsgDialog.hpp"
|
||||
#include "Widgets/DialogButtons.hpp"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
static constexpr int MIN_LAYER_VALUE = 2;
|
||||
|
|
@ -458,23 +459,9 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title
|
|||
m_sizer_main->AddSpacer(FromDIP(5));
|
||||
m_sizer_main->Add(m_other_layers_seq_panel, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
|
||||
|
||||
auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
|
||||
|
||||
auto sizer_button = new wxBoxSizer(wxHORIZONTAL);
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed), std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal));
|
||||
|
||||
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
|
||||
|
||||
m_button_ok = new Button(this, _L("OK"));
|
||||
m_button_ok->SetBackgroundColor(btn_bg_green);
|
||||
m_button_ok->SetBorderColor(*wxWHITE);
|
||||
m_button_ok->SetTextColor(wxColour("#FFFFFE"));
|
||||
m_button_ok->SetFont(Label::Body_12);
|
||||
m_button_ok->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_ok->SetCornerRadius(FromDIP(12));
|
||||
m_button_ok->Bind(wxEVT_BUTTON, [this](auto& e) {
|
||||
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this](auto& e) {
|
||||
wxCommandEvent evt(EVT_SET_BED_TYPE_CONFIRM, GetId());
|
||||
static_cast<wxEvtHandler*>(m_other_layers_seq_panel)->ProcessEvent(evt);
|
||||
GetEventHandler()->ProcessEvent(evt);
|
||||
|
|
@ -486,26 +473,15 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title
|
|||
this->Close();
|
||||
});
|
||||
|
||||
m_button_cancel = new Button(this, _L("Cancel"));
|
||||
m_button_cancel->SetBackgroundColor(btn_bg_white);
|
||||
m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
|
||||
m_button_cancel->SetFont(Label::Body_12);
|
||||
m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_cancel->SetCornerRadius(FromDIP(12));
|
||||
m_button_cancel->Bind(wxEVT_BUTTON, [this](auto& e) {
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](auto& e) {
|
||||
if (this->IsModal())
|
||||
EndModal(wxID_NO);
|
||||
else
|
||||
this->Close();
|
||||
});
|
||||
|
||||
sizer_button->AddStretchSpacer();
|
||||
sizer_button->Add(m_button_ok, 0, wxALL, FromDIP(5));
|
||||
sizer_button->Add(m_button_cancel, 0, wxALL, FromDIP(5));
|
||||
sizer_button->Add(FromDIP(30),0, 0, 0);
|
||||
|
||||
m_sizer_main->Add(sizer_button, 0, wxEXPAND | wxTOP | wxBOTTOM, FromDIP(20));
|
||||
m_sizer_main->AddSpacer(FromDIP(20));
|
||||
m_sizer_main->Add(dlg_btns, 0, wxEXPAND);
|
||||
|
||||
SetSizer(m_sizer_main);
|
||||
Layout();
|
||||
|
|
@ -620,8 +596,6 @@ wxString PlateSettingsDialog::to_print_sequence_name(PrintSequence print_seq) {
|
|||
|
||||
void PlateSettingsDialog::on_dpi_changed(const wxRect& suggested_rect)
|
||||
{
|
||||
m_button_ok->Rescale();
|
||||
m_button_cancel->Rescale();
|
||||
}
|
||||
|
||||
wxString PlateSettingsDialog::get_plate_name() const {
|
||||
|
|
@ -670,48 +644,23 @@ PlateNameEditDialog::PlateNameEditDialog(wxWindow *parent, wxWindowID id, const
|
|||
|
||||
m_sizer_main->Add(top_sizer, 0, wxEXPAND | wxALL, FromDIP(30));
|
||||
|
||||
auto sizer_button = new wxBoxSizer(wxHORIZONTAL);
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed), std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal));
|
||||
auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
|
||||
|
||||
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
|
||||
|
||||
m_button_ok = new Button(this, _L("OK"));
|
||||
m_button_ok->SetBackgroundColor(btn_bg_green);
|
||||
m_button_ok->SetBorderColor(*wxWHITE);
|
||||
m_button_ok->SetTextColor(wxColour("#FFFFFE"));
|
||||
m_button_ok->SetFont(Label::Body_12);
|
||||
m_button_ok->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_ok->SetCornerRadius(FromDIP(12));
|
||||
m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
if (this->IsModal())
|
||||
EndModal(wxID_YES);
|
||||
else
|
||||
this->Close();
|
||||
});
|
||||
|
||||
m_button_cancel = new Button(this, _L("Cancel"));
|
||||
m_button_cancel->SetBackgroundColor(btn_bg_white);
|
||||
m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
|
||||
m_button_cancel->SetFont(Label::Body_12);
|
||||
m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_cancel->SetCornerRadius(FromDIP(12));
|
||||
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
if (this->IsModal())
|
||||
EndModal(wxID_NO);
|
||||
else
|
||||
this->Close();
|
||||
});
|
||||
|
||||
sizer_button->AddStretchSpacer();
|
||||
sizer_button->Add(m_button_ok, 0, wxALL, FromDIP(5));
|
||||
sizer_button->Add(m_button_cancel, 0, wxALL, FromDIP(5));
|
||||
sizer_button->Add(FromDIP(30), 0, 0, 0);
|
||||
|
||||
m_sizer_main->Add(sizer_button, 0, wxEXPAND, FromDIP(20));
|
||||
m_sizer_main->Add(dlg_btns, 0, wxEXPAND, FromDIP(20));
|
||||
|
||||
SetSizer(m_sizer_main);
|
||||
Layout();
|
||||
|
|
@ -726,8 +675,6 @@ PlateNameEditDialog::~PlateNameEditDialog() {}
|
|||
|
||||
void PlateNameEditDialog::on_dpi_changed(const wxRect &suggested_rect)
|
||||
{
|
||||
m_button_ok->Rescale();
|
||||
m_button_cancel->Rescale();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -172,8 +172,6 @@ protected:
|
|||
ComboBox* m_spiral_mode_choice { nullptr };
|
||||
DragCanvas* m_drag_canvas;
|
||||
OtherLayersSeqPanel* m_other_layers_seq_panel;
|
||||
Button* m_button_ok;
|
||||
Button* m_button_cancel;
|
||||
TextInput *m_ti_plate_name;
|
||||
};
|
||||
|
||||
|
|
@ -195,8 +193,6 @@ public:
|
|||
void set_plate_name(const wxString &name);
|
||||
|
||||
protected:
|
||||
Button * m_button_ok;
|
||||
Button * m_button_cancel;
|
||||
TextInput *m_ti_plate_name;
|
||||
};
|
||||
}} // namespace Slic3r::GUI
|
||||
|
|
|
|||
|
|
@ -10753,7 +10753,6 @@ public:
|
|||
WX_DECLARE_LIST(RadioSelector, RadioSelectorList);
|
||||
|
||||
#define PROJECT_DROP_DIALOG_SELECT_PLANE_SIZE wxSize(FromDIP(350), FromDIP(120))
|
||||
#define PROJECT_DROP_DIALOG_BUTTON_SIZE wxSize(FromDIP(60), FromDIP(24))
|
||||
|
||||
class ProjectDropDialog : public DPIDialog
|
||||
{
|
||||
|
|
@ -10771,14 +10770,11 @@ public:
|
|||
wxStaticText *m_fname_f;
|
||||
wxStaticText *m_fname_s;
|
||||
StaticBox * m_panel_select;
|
||||
Button * m_confirm;
|
||||
Button * m_cancel;
|
||||
|
||||
|
||||
void select_radio(int index);
|
||||
void on_select_radio(wxMouseEvent &event);
|
||||
void on_select_ok(wxMouseEvent &event);
|
||||
void on_select_cancel(wxMouseEvent &event);
|
||||
void on_select_ok(wxCommandEvent &event);
|
||||
void on_select_cancel(wxCommandEvent &event);
|
||||
|
||||
int get_select_radio(int groupid);
|
||||
int get_action() const { return m_action; }
|
||||
|
|
@ -10877,7 +10873,7 @@ ProjectDropDialog::ProjectDropDialog(const std::string &filename)
|
|||
|
||||
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, 10);
|
||||
|
||||
wxBoxSizer *m_sizer_bottom = new wxBoxSizer(wxHORIZONTAL);
|
||||
// wxBoxSizer *m_sizer_bottom = new wxBoxSizer(wxHORIZONTAL);
|
||||
// Orca: hide the "Don't show again" checkbox, people keeps accidentally checked this then forgot
|
||||
// wxBoxSizer *m_sizer_left = new wxBoxSizer(wxHORIZONTAL);
|
||||
//
|
||||
|
|
@ -10885,34 +10881,14 @@ ProjectDropDialog::ProjectDropDialog(const std::string &filename)
|
|||
// m_sizer_left->Add(dont_show_again, 0, wxALL, 5);
|
||||
//
|
||||
// m_sizer_bottom->Add(m_sizer_left, 0, wxEXPAND, 5);
|
||||
m_sizer_bottom->Add(0, 0, 1, wxEXPAND, 5);
|
||||
|
||||
wxBoxSizer *m_sizer_right = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
|
||||
|
||||
m_confirm = new Button(this, _L("OK"));
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed), std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal));
|
||||
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &ProjectDropDialog::on_select_ok, this);
|
||||
|
||||
m_confirm->SetBackgroundColor(btn_bg_green);
|
||||
m_confirm->SetBorderColor(wxColour(0, 150, 136));
|
||||
m_confirm->SetTextColor(wxColour("#FFFFFE"));
|
||||
m_confirm->SetSize(PROJECT_DROP_DIALOG_BUTTON_SIZE);
|
||||
m_confirm->SetMinSize(PROJECT_DROP_DIALOG_BUTTON_SIZE);
|
||||
m_confirm->SetCornerRadius(FromDIP(12));
|
||||
m_confirm->Bind(wxEVT_LEFT_DOWN, &ProjectDropDialog::on_select_ok, this);
|
||||
m_sizer_right->Add(m_confirm, 0, wxALL, 5);
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, &ProjectDropDialog::on_select_cancel, this);
|
||||
|
||||
m_cancel = new Button(this, _L("Cancel"));
|
||||
m_cancel->SetTextColor(wxColour(107, 107, 107));
|
||||
m_cancel->SetSize(PROJECT_DROP_DIALOG_BUTTON_SIZE);
|
||||
m_cancel->SetMinSize(PROJECT_DROP_DIALOG_BUTTON_SIZE);
|
||||
m_cancel->SetCornerRadius(FromDIP(12));
|
||||
m_cancel->Bind(wxEVT_LEFT_DOWN, &ProjectDropDialog::on_select_cancel, this);
|
||||
m_sizer_right->Add(m_cancel, 0, wxALL, 5);
|
||||
|
||||
m_sizer_bottom->Add( m_sizer_right, 0, wxEXPAND, 5 );
|
||||
m_sizer_main->Add(m_sizer_bottom, 0, wxEXPAND | wxLEFT | wxRIGHT, 40);
|
||||
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, 20);
|
||||
m_sizer_main->Add(dlg_btns, 0, wxEXPAND);
|
||||
|
||||
SetSizer(m_sizer_main);
|
||||
Layout();
|
||||
|
|
@ -11056,7 +11032,7 @@ void ProjectDropDialog::on_select_radio(wxMouseEvent &event)
|
|||
}
|
||||
}
|
||||
|
||||
void ProjectDropDialog::on_select_ok(wxMouseEvent &event)
|
||||
void ProjectDropDialog::on_select_ok(wxCommandEvent &event)
|
||||
{
|
||||
if (m_remember_choice) {
|
||||
LoadType load_type = static_cast<LoadType>(get_action());
|
||||
|
|
@ -11074,15 +11050,13 @@ void ProjectDropDialog::on_select_ok(wxMouseEvent &event)
|
|||
EndModal(wxID_OK);
|
||||
}
|
||||
|
||||
void ProjectDropDialog::on_select_cancel(wxMouseEvent &event)
|
||||
void ProjectDropDialog::on_select_cancel(wxCommandEvent &event)
|
||||
{
|
||||
EndModal(wxID_CANCEL);
|
||||
}
|
||||
|
||||
void ProjectDropDialog::on_dpi_changed(const wxRect& suggested_rect)
|
||||
{
|
||||
m_confirm->SetMinSize(PROJECT_DROP_DIALOG_BUTTON_SIZE);
|
||||
m_cancel->SetMinSize(PROJECT_DROP_DIALOG_BUTTON_SIZE);
|
||||
Fit();
|
||||
Refresh();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
#include "format.hpp"
|
||||
#include "Tab.hpp"
|
||||
|
||||
#include "Widgets/DialogButtons.hpp"
|
||||
|
||||
using Slic3r::GUI::format_wxstr;
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
|
@ -334,42 +336,14 @@ void SavePresetDialog::build(std::vector<Preset::Type> types, std::string suffix
|
|||
// Add first item
|
||||
for (Preset::Type type : types) AddItem(type, suffix);
|
||||
|
||||
wxBoxSizer *btns;
|
||||
btns = new wxBoxSizer(wxHORIZONTAL);
|
||||
btns->Add(0, 0, 1, wxEXPAND, 5);
|
||||
auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
|
||||
|
||||
m_confirm = new Button(this, _L("OK"));
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal));
|
||||
m_confirm->SetBackgroundColor(btn_bg_green);
|
||||
m_confirm->SetBorderColor(wxColour(0, 150, 136));
|
||||
m_confirm->SetTextColor(wxColour("#FFFFFE"));
|
||||
m_confirm->SetMinSize(SAVE_PRESET_DIALOG_BUTTON_SIZE);
|
||||
m_confirm->SetCornerRadius(FromDIP(12));
|
||||
m_confirm->Bind(wxEVT_BUTTON, &SavePresetDialog::accept, this);
|
||||
btns->Add(m_confirm, 0, wxEXPAND, 0);
|
||||
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &SavePresetDialog::accept, this);
|
||||
|
||||
auto block_middle = new wxWindow(this, -1);
|
||||
block_middle->SetBackgroundColour(SAVE_PRESET_DIALOG_DEF_COLOUR);
|
||||
btns->Add(block_middle, 0, wxRIGHT, 10);
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, &SavePresetDialog::on_select_cancel, this);
|
||||
|
||||
m_cancel = new Button(this, _L("Cancel"));
|
||||
m_cancel->SetMinSize(SAVE_PRESET_DIALOG_BUTTON_SIZE);
|
||||
m_cancel->SetCornerRadius(FromDIP(12));
|
||||
m_cancel->Bind(wxEVT_BUTTON, &SavePresetDialog::on_select_cancel, this);
|
||||
btns->Add(m_cancel, 0, wxEXPAND, 0);
|
||||
|
||||
auto block_right = new wxWindow(this, -1);
|
||||
block_right->SetBackgroundColour(SAVE_PRESET_DIALOG_DEF_COLOUR);
|
||||
btns->Add(block_right, 0, wxRIGHT, 40);
|
||||
|
||||
auto m_line = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
|
||||
m_line->SetBackgroundColour(wxColour(166, 169, 170));
|
||||
|
||||
m_Sizer_main->Add( m_line, 0, wxEXPAND, 0 );
|
||||
m_Sizer_main->Add(m_presets_sizer, 0, wxEXPAND | wxALL, BORDER_W);
|
||||
m_Sizer_main->Add(btns, 0, wxEXPAND | wxBOTTOM, BORDER_W + 7);
|
||||
m_Sizer_main->Add(dlg_btns, 0, wxEXPAND);
|
||||
|
||||
SetSizer(m_Sizer_main);
|
||||
m_Sizer_main->SetSizeHints(this);
|
||||
|
|
@ -491,17 +465,11 @@ void SavePresetDialog::on_dpi_changed(const wxRect &suggested_rect)
|
|||
{
|
||||
const int &em = em_unit();
|
||||
|
||||
msw_buttons_rescale(this, em, {wxID_OK, wxID_CANCEL});
|
||||
|
||||
//for (Item *item : m_items) item->update_valid_bmp();
|
||||
|
||||
// const wxSize& size = wxSize(45 * em, 35 * em);
|
||||
//SetMinSize(/*size*/ wxSize(100, 50));
|
||||
|
||||
m_confirm->SetMinSize(SAVE_PRESET_DIALOG_BUTTON_SIZE);
|
||||
m_cancel->SetMinSize(SAVE_PRESET_DIALOG_BUTTON_SIZE);
|
||||
|
||||
|
||||
Fit();
|
||||
Refresh();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,8 +78,6 @@ class SavePresetDialog : public DPIDialog
|
|||
|
||||
std::vector<Item*> m_items;
|
||||
|
||||
Button* m_confirm {nullptr};
|
||||
Button* m_cancel {nullptr};
|
||||
wxBoxSizer* m_presets_sizer {nullptr};
|
||||
wxStaticText* m_label {nullptr};
|
||||
wxBoxSizer* m_radio_sizer {nullptr};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
#include "GUI_App.hpp"
|
||||
#include "MainFrame.hpp"
|
||||
|
||||
#include "Widgets/DialogButtons.hpp"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
SingleChoiceDialog::SingleChoiceDialog(const wxString &message, const wxString &caption, const wxArrayString &choices, int initialSelection, wxWindow *parent)
|
||||
|
|
@ -21,41 +23,16 @@ SingleChoiceDialog::SingleChoiceDialog(const wxString &message, const wxString &
|
|||
type_comboBox = new ComboBox(this, wxID_ANY, choices[0], wxDefaultPosition, wxSize(FromDIP(dlg_width - 10), -1), 0, NULL, wxCB_READONLY);
|
||||
for (const wxString &type_name : choices) { type_comboBox->Append(type_name); }
|
||||
bSizer->Add(type_comboBox, 0, wxALL | wxALIGN_CENTER, 5);
|
||||
bSizer->Add(0, 0, 1, wxEXPAND, FromDIP(type_comboBox->GetClientSize().GetHeight()));
|
||||
bSizer->AddSpacer(FromDIP(10));
|
||||
type_comboBox->SetSelection(initialSelection);
|
||||
|
||||
wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
|
||||
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed), std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
|
||||
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_OK); });
|
||||
|
||||
m_button_ok = new Button(this, _L("OK"));
|
||||
m_button_ok->SetBackgroundColor(btn_bg_green);
|
||||
m_button_ok->SetBorderColor(*wxWHITE);
|
||||
m_button_ok->SetTextColor(wxColour(0xFFFFFE));
|
||||
m_button_ok->SetFont(Label::Body_12);
|
||||
m_button_ok->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_ok->SetCornerRadius(FromDIP(12));
|
||||
bSizer_button->Add(m_button_ok, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(int(dlg_width - 58 * 2) / 6));
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_CANCEL); });
|
||||
|
||||
m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_OK); });
|
||||
|
||||
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
|
||||
|
||||
m_button_cancel = new Button(this, _L("Cancel"));
|
||||
m_button_cancel->SetBackgroundColor(btn_bg_white);
|
||||
m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
|
||||
m_button_cancel->SetFont(Label::Body_12);
|
||||
m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_cancel->SetCornerRadius(FromDIP(12));
|
||||
bSizer_button->Add(m_button_cancel, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(int(dlg_width - 58 * 2) / 6));
|
||||
|
||||
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
|
||||
|
||||
bSizer->Add(bSizer_button, 1, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, FromDIP(5));
|
||||
bSizer->Add(dlg_btns, 0, wxEXPAND);
|
||||
|
||||
this->SetSizer(bSizer);
|
||||
this->Layout();
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ public:
|
|||
|
||||
protected:
|
||||
ComboBox *type_comboBox = nullptr;
|
||||
Button * m_button_ok = nullptr;
|
||||
Button * m_button_cancel = nullptr;
|
||||
};
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "MainFrame.hpp"
|
||||
#include "Widgets/Button.hpp"
|
||||
#include "Widgets/TextInput.hpp"
|
||||
#include "Widgets/DialogButtons.hpp"
|
||||
#include <chrono>
|
||||
|
||||
using namespace Slic3r;
|
||||
|
|
@ -262,21 +263,14 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file, double line
|
|||
bSizer_button->SetMinSize(wxSize(FromDIP(100), -1));
|
||||
m_checkbox = new wxCheckBox(this, wxID_ANY, _L("Don't show again"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_checkbox->SetForegroundColour(StateColor::darkModeColorFor(FONT_COLOR));
|
||||
bSizer_button->Add(m_checkbox, 0, wxALIGN_LEFT);
|
||||
bSizer_button->Add(m_checkbox, 0, wxALIGN_LEFT | wxLEFT | wxALIGN_CENTER_VERTICAL, LEFT_RIGHT_PADING);
|
||||
bSizer_button->AddStretchSpacer(1);
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
|
||||
m_button_ok = new Button(this, _L("OK"));
|
||||
m_button_ok->SetBackgroundColor(btn_bg_green);
|
||||
m_button_ok->SetBorderColor(*wxWHITE);
|
||||
m_button_ok->SetTextColor(wxColour(0xFFFFFE));
|
||||
m_button_ok->SetFont(Label::Body_12);
|
||||
m_button_ok->SetSize(BUTTON_SIZE);
|
||||
m_button_ok->SetMinSize(BUTTON_SIZE);
|
||||
m_button_ok->SetCornerRadius(FromDIP(12));
|
||||
bSizer_button->Add(m_button_ok, 0, wxALIGN_RIGHT, BUTTON_BORDER);
|
||||
|
||||
m_button_ok->Bind(wxEVT_LEFT_DOWN, [this, angle_input, linear_input](wxMouseEvent& e) {
|
||||
auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
|
||||
|
||||
bSizer_button->Add(dlg_btns, 0, wxEXPAND);
|
||||
|
||||
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this, angle_input, linear_input](wxCommandEvent& e) {
|
||||
stop_task();
|
||||
if (validate_number_range(angle_input->GetTextCtrl()->GetValue(), 0.01, 1) &&
|
||||
validate_number_range(linear_input->GetTextCtrl()->GetValue(), 0.001, 0.1)) {
|
||||
|
|
@ -292,24 +286,12 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file, double line
|
|||
SetFocusIgnoringChildren();
|
||||
});
|
||||
|
||||
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
|
||||
|
||||
m_button_cancel = new Button(this, _L("Cancel"));
|
||||
m_button_cancel->SetBackgroundColor(btn_bg_white);
|
||||
m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
|
||||
m_button_cancel->SetFont(Label::Body_12);
|
||||
m_button_cancel->SetSize(BUTTON_SIZE);
|
||||
m_button_cancel->SetMinSize(BUTTON_SIZE);
|
||||
m_button_cancel->SetCornerRadius(FromDIP(12));
|
||||
bSizer_button->Add(m_button_cancel, 0, wxALIGN_RIGHT | wxLEFT, BUTTON_BORDER);
|
||||
|
||||
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {
|
||||
stop_task();
|
||||
EndModal(wxID_CANCEL);
|
||||
});
|
||||
|
||||
bSizer->Add(bSizer_button, 1, wxEXPAND | wxALL, LEFT_RIGHT_PADING);
|
||||
bSizer->Add(bSizer_button, 1, wxEXPAND);
|
||||
|
||||
this->SetSizer(bSizer);
|
||||
update_mesh_number_text();
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ public:
|
|||
}
|
||||
private:
|
||||
Slic3r::Step& m_file;
|
||||
Button* m_button_ok = nullptr;
|
||||
Button* m_button_cancel = nullptr;
|
||||
wxCheckBox* m_checkbox = nullptr;
|
||||
wxCheckBox* m_split_compound_checkbox = nullptr;
|
||||
wxString m_linear_last;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "PresetComboBoxes.hpp"
|
||||
#include "Widgets/RoundedRectangle.hpp"
|
||||
#include "Widgets/CheckBox.hpp"
|
||||
#include "Widgets/DialogButtons.hpp"
|
||||
|
||||
using boost::optional;
|
||||
|
||||
|
|
@ -1931,11 +1932,6 @@ std::array<Preset::Type, 3> DiffPresetDialog::types_list() const
|
|||
|
||||
void DiffPresetDialog::create_buttons()
|
||||
{
|
||||
wxFont font = this->GetFont().Scaled(1.4f);
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Disabled),
|
||||
std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal));
|
||||
m_buttons = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
auto show_in_bottom_info = [this](const wxString& ext_line, wxEvent* e = nullptr) {
|
||||
|
|
@ -1945,15 +1941,12 @@ void DiffPresetDialog::create_buttons()
|
|||
if (e) e->Skip();
|
||||
};
|
||||
|
||||
// Transfer
|
||||
m_transfer_btn = new Button(this, L("Transfer"));
|
||||
m_transfer_btn->SetBackgroundColor(btn_bg_green);
|
||||
m_transfer_btn->SetBorderColor(wxColour(0, 150, 136));
|
||||
m_transfer_btn->SetTextColor(wxColour("#FFFFFE"));
|
||||
m_transfer_btn->SetMinSize(wxSize(-1, -1));
|
||||
m_transfer_btn->SetCornerRadius(FromDIP(12));
|
||||
auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
|
||||
|
||||
m_transfer_btn->Bind(wxEVT_BUTTON, [this](wxEvent&) { button_event(Action::Transfer);});
|
||||
// Transfer
|
||||
auto transfer_btn = dlg_btns->GetOK();
|
||||
transfer_btn->SetLabel(L("Transfer"));
|
||||
transfer_btn->Bind(wxEVT_BUTTON, [this](wxEvent&) { button_event(Action::Transfer);});
|
||||
|
||||
|
||||
auto enable_transfer = [this](const Preset::Type& type) {
|
||||
|
|
@ -1962,7 +1955,7 @@ void DiffPresetDialog::create_buttons()
|
|||
return main_edited_preset.name == get_right_preset_name(type);
|
||||
return true;
|
||||
};
|
||||
m_transfer_btn->Bind(wxEVT_UPDATE_UI, [this, enable_transfer, show_in_bottom_info](wxUpdateUIEvent& evt) {
|
||||
transfer_btn->Bind(wxEVT_UPDATE_UI, [this, enable_transfer, show_in_bottom_info, transfer_btn](wxUpdateUIEvent& evt) {
|
||||
bool enable = m_tree->has_selection();
|
||||
if (enable) {
|
||||
if (m_view_type == Preset::TYPE_INVALID) {
|
||||
|
|
@ -1975,30 +1968,26 @@ void DiffPresetDialog::create_buttons()
|
|||
else
|
||||
enable = enable_transfer(m_view_type);
|
||||
|
||||
if (!enable && m_transfer_btn->IsShown()) {
|
||||
if (!enable && transfer_btn->IsShown()) {
|
||||
show_in_bottom_info(_L("You can only transfer to current active profile because it has been modified."));
|
||||
}
|
||||
}
|
||||
evt.Enable(enable);
|
||||
});
|
||||
m_transfer_btn->Bind(wxEVT_ENTER_WINDOW, [show_in_bottom_info](wxMouseEvent& e) {
|
||||
transfer_btn->Bind(wxEVT_ENTER_WINDOW, [show_in_bottom_info](wxMouseEvent& e) {
|
||||
show_in_bottom_info(_L("Transfer the selected options from left preset to the right.\n"
|
||||
"Note: New modified presets will be selected in settings tabs after close this dialog."), &e); });
|
||||
|
||||
// Cancel
|
||||
m_cancel_btn = new Button(this, L("Cancel"));
|
||||
m_cancel_btn->SetTextColor(wxColour(107, 107, 107));
|
||||
m_cancel_btn->SetMinSize(wxSize(-1, -1));
|
||||
m_cancel_btn->SetCornerRadius(FromDIP(12));
|
||||
auto cancel_btn = dlg_btns->GetCANCEL();
|
||||
cancel_btn->Bind(wxEVT_BUTTON, [this](wxEvent&) { button_event(Action::Discard);});
|
||||
|
||||
m_cancel_btn->Bind(wxEVT_BUTTON, [this](wxEvent&) { button_event(Action::Discard);});
|
||||
|
||||
for (Button* btn : { m_transfer_btn, m_cancel_btn }) {
|
||||
for (Button* btn : { transfer_btn, cancel_btn }) {
|
||||
btn->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) { update_bottom_info(); Layout(); e.Skip(); });
|
||||
m_buttons->Add(btn, 1, wxLEFT, 5);
|
||||
btn->SetFont(font);
|
||||
}
|
||||
|
||||
m_buttons->Add(dlg_btns, 1, wxEXPAND);
|
||||
|
||||
m_buttons->Show(false);
|
||||
}
|
||||
|
||||
|
|
@ -2024,7 +2013,7 @@ void DiffPresetDialog::create_edit_sizer()
|
|||
|
||||
// Create and fill edit sizer
|
||||
m_edit_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_edit_sizer->Add(m_use_for_transfer, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
|
||||
m_edit_sizer->Add(m_use_for_transfer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 10);
|
||||
m_edit_sizer->AddSpacer(em_unit() * 10);
|
||||
m_edit_sizer->Add(m_buttons, 1, wxLEFT, 5);
|
||||
m_edit_sizer->Show(false);
|
||||
|
|
@ -2040,7 +2029,7 @@ void DiffPresetDialog::complete_dialog_creation()
|
|||
topSizer->Add(m_show_all_presets, 0, wxEXPAND | wxALL, border);
|
||||
topSizer->Add(m_tree, 1, wxEXPAND | wxALL, border);
|
||||
topSizer->Add(m_bottom_info_line, 0, wxEXPAND | wxALL, 2 * border);
|
||||
topSizer->Add(m_edit_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 2 * border);
|
||||
topSizer->Add(m_edit_sizer, 0, wxEXPAND);
|
||||
|
||||
this->SetMinSize(wxSize(80 * em_unit(), 30 * em_unit()));
|
||||
this->SetSizer(topSizer);
|
||||
|
|
@ -2278,10 +2267,6 @@ void DiffPresetDialog::on_dpi_changed(const wxRect&)
|
|||
{
|
||||
int em = em_unit();
|
||||
|
||||
msw_buttons_rescale(this, em, {wxID_CANCEL});
|
||||
for (auto btn : {m_transfer_btn, m_cancel_btn})
|
||||
if (btn) btn->SetMinSize(UNSAVE_CHANGE_DIALOG_BUTTON_SIZE);
|
||||
|
||||
const wxSize& size = wxSize(80 * em, 30 * em);
|
||||
SetMinSize(size);
|
||||
|
||||
|
|
|
|||
|
|
@ -413,8 +413,6 @@ class DiffPresetDialog : public DPIDialog
|
|||
wxStaticText* m_bottom_info_line { nullptr };
|
||||
wxCheckBox* m_show_all_presets { nullptr };
|
||||
wxCheckBox* m_use_for_transfer { nullptr };
|
||||
Button* m_transfer_btn { nullptr };
|
||||
Button* m_cancel_btn { nullptr };
|
||||
wxBoxSizer* m_buttons { nullptr };
|
||||
wxBoxSizer* m_edit_sizer { nullptr };
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Slic3r { namespace GUI {
|
|||
|
||||
// ORCA standardize dialog buttons
|
||||
DialogButtons::DialogButtons(wxWindow* parent, std::vector<wxString> non_translated_labels, const wxString& primary_btn_translated_label)
|
||||
: wxWindow(parent, wxID_ANY)
|
||||
: wxPanel(parent, wxID_ANY)
|
||||
{
|
||||
m_parent = parent;
|
||||
m_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
|
@ -73,8 +73,8 @@ Button* DialogButtons::GetAPPLY() {return GetButtonFromID(wxID_APPLY) ;}
|
|||
Button* DialogButtons::GetCONFIRM(){return GetButtonFromID(wxID_APPLY) ;}
|
||||
Button* DialogButtons::GetNO() {return GetButtonFromID(wxID_NO) ;}
|
||||
Button* DialogButtons::GetCANCEL() {return GetButtonFromID(wxID_CANCEL) ;}
|
||||
Button* DialogButtons::GetBACK() {return GetButtonFromID(wxID_BACKWARD);}
|
||||
Button* DialogButtons::GetFORWARD(){return GetButtonFromID(wxID_FORWARD) ;}
|
||||
Button* DialogButtons::GetRETURN() {return GetButtonFromID(wxID_BACKWARD);} // gets Return button
|
||||
Button* DialogButtons::GetNEXT() {return GetButtonFromID(wxID_FORWARD) ;}
|
||||
|
||||
void DialogButtons::SetPrimaryButton(wxString translated_label) {
|
||||
// use _L("Create") translated text for custom buttons
|
||||
|
|
@ -92,8 +92,12 @@ void DialogButtons::SetPrimaryButton(wxString translated_label) {
|
|||
|
||||
m_primary = translated_label;
|
||||
|
||||
btn->SetFocus();
|
||||
// apply focus only if there is no focused element exist. this prevents stealing focus from input boxes
|
||||
if(m_parent->FindFocus() == nullptr)
|
||||
btn->SetFocus();
|
||||
|
||||
// we won't need color definations after button style management
|
||||
bool is_dark = wxGetApp().dark_mode();
|
||||
StateColor clr_bg = StateColor(
|
||||
std::pair(wxColour("#009688"), (int)StateColor::NotHovered),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
|
||||
|
|
@ -105,7 +109,8 @@ void DialogButtons::SetPrimaryButton(wxString translated_label) {
|
|||
btn->SetBackgroundColor(clr_bg);
|
||||
StateColor clr_br = StateColor(
|
||||
std::pair(wxColour("#009688"), (int)StateColor::NotFocused),
|
||||
std::pair(wxColour("#26A69A"), (int)StateColor::Focused)
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour(is_dark ? "#26A69A" : "#00FFD4"), (int)StateColor::Focused)
|
||||
);
|
||||
btn->SetBorderColor(clr_br);
|
||||
StateColor clr_tx = StateColor(
|
||||
|
|
@ -143,6 +148,7 @@ void DialogButtons::SetAlertButton(wxString translated_label) {
|
|||
btn->SetBackgroundColor(clr_bg);
|
||||
StateColor clr_br = StateColor(
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::NotFocused),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#26A69A"), (int)StateColor::Focused)
|
||||
);
|
||||
btn->SetBorderColor(clr_br);
|
||||
|
|
@ -171,6 +177,7 @@ void DialogButtons::UpdateButtons() {
|
|||
);
|
||||
StateColor clr_br = StateColor(
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::NotFocused),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#26A69A"), (int)StateColor::Focused)
|
||||
);
|
||||
StateColor clr_tx = StateColor(
|
||||
|
|
@ -205,6 +212,9 @@ void DialogButtons::UpdateButtons() {
|
|||
|
||||
m_sizer->AddStretchSpacer();
|
||||
|
||||
if(m_sizer->IsEmpty()) // add left margin if no button on left. fixes no gap on small windows
|
||||
m_sizer->AddSpacer(btn_gap);
|
||||
|
||||
for (Button* btn : m_buttons) // Right aligned
|
||||
if(!on_left(btn->GetId()))
|
||||
m_sizer->Add(btn, 0, wxRIGHT | wxTOP | wxBOTTOM | wxALIGN_CENTER_VERTICAL, btn_gap);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
class DialogButtons : public wxWindow{
|
||||
class DialogButtons : public wxPanel{
|
||||
public:
|
||||
|
||||
DialogButtons(wxWindow* parent, std::vector<wxString> non_translated_labels, const wxString& primary_btn_label = "");
|
||||
|
|
@ -30,8 +30,8 @@ public:
|
|||
Button* GetCONFIRM();
|
||||
Button* GetNO();
|
||||
Button* GetCANCEL();
|
||||
Button* GetBACK();
|
||||
Button* GetFORWARD();
|
||||
Button* GetRETURN();
|
||||
Button* GetNEXT();
|
||||
|
||||
void SetPrimaryButton(wxString label);
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ private:
|
|||
{"replace" , wxID_REPLACE},
|
||||
{"replace all", wxID_REPLACE_ALL},
|
||||
// Navigation
|
||||
{"back" , wxID_BACKWARD},
|
||||
{"return" , wxID_BACKWARD}, // use return instead back. back mostly used as side of object in translations
|
||||
{"next" , wxID_FORWARD},
|
||||
// Alert / Negative
|
||||
{"remove" , wxID_REMOVE},
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "MsgDialog.hpp"
|
||||
#include "libslic3r/Color.hpp"
|
||||
#include "Widgets/Button.hpp"
|
||||
#include "Widgets/DialogButtons.hpp"
|
||||
#include "slic3r/Utils/ColorSpaceConvert.hpp"
|
||||
#include "MainFrame.hpp"
|
||||
#include "libslic3r/Config.hpp"
|
||||
|
|
@ -331,14 +332,6 @@ void WipingDialog::on_dpi_changed(const wxRect &suggested_rect)
|
|||
button_item.second->SetMinSize(wxSize(FromDIP(75), FromDIP(24)));
|
||||
button_item.second->SetCornerRadius(FromDIP(12));
|
||||
}
|
||||
if (button_item.first == wxOK) {
|
||||
button_item.second->SetMinSize(BTN_SIZE);
|
||||
button_item.second->SetCornerRadius(FromDIP(12));
|
||||
}
|
||||
if (button_item.first == wxCANCEL) {
|
||||
button_item.second->SetMinSize(BTN_SIZE);
|
||||
button_item.second->SetCornerRadius(FromDIP(12));
|
||||
}
|
||||
}
|
||||
m_panel_wiping->msw_rescale();
|
||||
this->Refresh();
|
||||
|
|
@ -375,23 +368,18 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector<float>& matrix, c
|
|||
main_sizer->SetMinSize(wxSize(sizer_width, -1));
|
||||
main_sizer->Add(m_panel_wiping, 1, wxEXPAND | wxALL, 0);
|
||||
|
||||
auto btn_sizer = create_btn_sizer(wxOK | wxCANCEL);
|
||||
main_sizer->Add(btn_sizer, 0, wxBOTTOM | wxRIGHT | wxEXPAND, BTN_GAP);
|
||||
auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
|
||||
main_sizer->Add(dlg_btns, 0, wxEXPAND);
|
||||
SetSizer(main_sizer);
|
||||
main_sizer->SetSizeHints(this);
|
||||
|
||||
if (this->FindWindowById(wxID_OK, this)) {
|
||||
this->FindWindowById(wxID_OK, 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);
|
||||
}
|
||||
if (this->FindWindowById(wxID_CANCEL, this)) {
|
||||
update_ui(static_cast<wxButton*>(this->FindWindowById(wxID_CANCEL, this)));
|
||||
this->FindWindowById(wxID_CANCEL, this)->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { EndModal(wxCANCEL); });
|
||||
dlg_btns->GetOK()->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);
|
||||
|
||||
}
|
||||
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { EndModal(wxCANCEL); });
|
||||
|
||||
/*
|
||||
if (this->FindWindowById(wxID_RESET, this)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue