mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 15:13:58 -06:00
GalleryDialog: Added process of the "Close" button
SavePresetDialog: To correct "darkmodding" the wxRadioBox was changed to the wxStaticBoxSizer with radio buttons + Some code cleaning
This commit is contained in:
parent
bda128c166
commit
44f1dac8c7
6 changed files with 28 additions and 22 deletions
|
@ -97,6 +97,7 @@ GalleryDialog::GalleryDialog(wxWindow* parent, bool modify_gallery/* = false*/)
|
||||||
ok_btn->SetLabel(_L("Add to bed"));
|
ok_btn->SetLabel(_L("Add to bed"));
|
||||||
ok_btn->SetToolTip(_L("Add selected shape(s) to the bed"));
|
ok_btn->SetToolTip(_L("Add selected shape(s) to the bed"));
|
||||||
}
|
}
|
||||||
|
static_cast<wxButton*>(FindWindowById(wxID_CLOSE, this))->Bind(wxEVT_BUTTON, [this](wxCommandEvent&){ this->EndModal(wxID_CLOSE); });
|
||||||
|
|
||||||
auto add_btn = [this, buttons]( size_t pos, int& ID, wxString title, wxString tooltip,
|
auto add_btn = [this, buttons]( size_t pos, int& ID, wxString title, wxString tooltip,
|
||||||
void (GalleryDialog::* method)(wxEvent&),
|
void (GalleryDialog::* method)(wxEvent&),
|
||||||
|
|
|
@ -1397,7 +1397,7 @@ void MainFrame::init_menubar_as_editor()
|
||||||
}
|
}
|
||||||
|
|
||||||
windowMenu->AppendSeparator();
|
windowMenu->AppendSeparator();
|
||||||
append_menu_item(windowMenu, wxID_ANY, _L("Modify Shapes Gallery") + "\tCtrl+G", _L("Open the dialog to modify shapes gallery"),
|
append_menu_item(windowMenu, wxID_ANY, _L("Modify Shapes Gallery"), _L("Open the dialog to modify shapes gallery"),
|
||||||
[this](wxCommandEvent&) {
|
[this](wxCommandEvent&) {
|
||||||
GalleryDialog dlg(this, true);
|
GalleryDialog dlg(this, true);
|
||||||
if (dlg.ShowModal() == wxID_OK) {
|
if (dlg.ShowModal() == wxID_OK) {
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class wxRadioBox;
|
|
||||||
class wxColourPickerCtrl;
|
class wxColourPickerCtrl;
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
|
@ -16,7 +16,6 @@ class ScalableButton;
|
||||||
class wxBoxSizer;
|
class wxBoxSizer;
|
||||||
class wxComboBox;
|
class wxComboBox;
|
||||||
class wxStaticBitmap;
|
class wxStaticBitmap;
|
||||||
class wxRadioBox;
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
|
|
@ -286,17 +286,21 @@ void SavePresetDialog::add_info_for_edit_ph_printer(wxBoxSizer* sizer)
|
||||||
m_label = new wxStaticText(this, wxID_ANY, msg_text);
|
m_label = new wxStaticText(this, wxID_ANY, msg_text);
|
||||||
m_label->SetFont(wxGetApp().bold_font());
|
m_label->SetFont(wxGetApp().bold_font());
|
||||||
|
|
||||||
wxString choices[] = {"","",""};
|
|
||||||
|
|
||||||
m_action_radio_box = new wxRadioBox(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize,
|
|
||||||
WXSIZEOF(choices), choices, 3, wxRA_SPECIFY_ROWS);
|
|
||||||
m_action_radio_box->SetSelection(0);
|
|
||||||
m_action_radio_box->Bind(wxEVT_RADIOBOX, [this](wxCommandEvent& e) {
|
|
||||||
m_action = (ActionType)e.GetSelection(); });
|
|
||||||
m_action = ChangePreset;
|
m_action = ChangePreset;
|
||||||
|
|
||||||
m_radio_sizer = new wxBoxSizer(wxHORIZONTAL);
|
m_radio_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
m_radio_sizer->Add(m_action_radio_box, 1, wxEXPAND | wxTOP, 2*BORDER_W);
|
|
||||||
|
wxStaticBox* action_stb = new wxStaticBox(this, wxID_ANY, "");
|
||||||
|
if (!wxOSX) action_stb->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
|
action_stb->SetFont(wxGetApp().bold_font());
|
||||||
|
|
||||||
|
wxStaticBoxSizer* stb_sizer = new wxStaticBoxSizer(action_stb, wxVERTICAL);
|
||||||
|
for (int id = 0; id < 3; id++) {
|
||||||
|
wxRadioButton* btn = new wxRadioButton(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, id == 0 ? wxRB_GROUP : 0);
|
||||||
|
btn->SetValue(id == int(ChangePreset));
|
||||||
|
btn->Bind(wxEVT_RADIOBUTTON, [this, id](wxCommandEvent&) { m_action = (ActionType)id; });
|
||||||
|
stb_sizer->Add(btn, 0, wxEXPAND | wxTOP, 5);
|
||||||
|
}
|
||||||
|
m_radio_sizer->Add(stb_sizer, 1, wxEXPAND | wxTOP, 2*BORDER_W);
|
||||||
|
|
||||||
sizer->Add(m_label, 0, wxEXPAND | wxLEFT | wxTOP, 3*BORDER_W);
|
sizer->Add(m_label, 0, wxEXPAND | wxLEFT | wxTOP, 3*BORDER_W);
|
||||||
sizer->Add(m_radio_sizer, 1, wxEXPAND | wxLEFT, 3*BORDER_W);
|
sizer->Add(m_radio_sizer, 1, wxEXPAND | wxLEFT, 3*BORDER_W);
|
||||||
|
@ -313,16 +317,21 @@ void SavePresetDialog::update_info_for_edit_ph_printer(const std::string& preset
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString msg_text = from_u8((boost::format(_u8L("What would you like to do with \"%1%\" preset after saving?")) % preset_name).str());
|
if (wxSizerItem* sizer_item = m_radio_sizer->GetItem(size_t(0))) {
|
||||||
m_action_radio_box->SetLabel(msg_text);
|
if (wxStaticBoxSizer* stb_sizer = static_cast<wxStaticBoxSizer*>(sizer_item->GetSizer())) {
|
||||||
|
wxString msg_text = format_wxstr(_L("What would you like to do with \"%1%\" preset after saving?"), preset_name);
|
||||||
|
stb_sizer->GetStaticBox()->SetLabel(msg_text);
|
||||||
|
|
||||||
wxString choices[] = { from_u8((boost::format(_u8L("Change \"%1%\" to \"%2%\" for this physical printer \"%3%\"")) % m_old_preset_name % preset_name % m_ph_printer_name).str()),
|
wxString choices[] = { format_wxstr(_L("Change \"%1%\" to \"%2%\" for this physical printer \"%3%\""), m_old_preset_name, preset_name, m_ph_printer_name),
|
||||||
from_u8((boost::format(_u8L("Add \"%1%\" as a next preset for the the physical printer \"%2%\"")) % preset_name % m_ph_printer_name).str()),
|
format_wxstr(_L("Add \"%1%\" as a next preset for the the physical printer \"%2%\""), preset_name, m_ph_printer_name),
|
||||||
from_u8((boost::format(_u8L("Just switch to \"%1%\" preset")) % preset_name).str()) };
|
format_wxstr(_L("Just switch to \"%1%\" preset"), preset_name) };
|
||||||
|
|
||||||
int n = 0;
|
size_t n = 0;
|
||||||
for (const wxString& label : choices)
|
for (const wxString& label : choices)
|
||||||
m_action_radio_box->SetString(n++, label);
|
stb_sizer->GetItem(n++)->GetWindow()->SetLabel(label);
|
||||||
|
}
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavePresetDialog::layout()
|
void SavePresetDialog::layout()
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
class wxString;
|
class wxString;
|
||||||
class wxStaticText;
|
class wxStaticText;
|
||||||
class wxComboBox;
|
class wxComboBox;
|
||||||
class wxRadioBox;
|
|
||||||
class wxStaticBitmap;
|
class wxStaticBitmap;
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
@ -64,7 +63,6 @@ class SavePresetDialog : public DPIDialog
|
||||||
|
|
||||||
wxBoxSizer* m_presets_sizer {nullptr};
|
wxBoxSizer* m_presets_sizer {nullptr};
|
||||||
wxStaticText* m_label {nullptr};
|
wxStaticText* m_label {nullptr};
|
||||||
wxRadioBox* m_action_radio_box {nullptr};
|
|
||||||
wxBoxSizer* m_radio_sizer {nullptr};
|
wxBoxSizer* m_radio_sizer {nullptr};
|
||||||
ActionType m_action {UndefAction};
|
ActionType m_action {UndefAction};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue