mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-24 14:16:50 -07:00
add option on preferences
This commit is contained in:
parent
2a2ea051cc
commit
ec77d1f970
4 changed files with 56 additions and 1 deletions
|
|
@ -313,6 +313,10 @@ void AppConfig::set_defaults()
|
|||
set_bool("remember_printer_config", true);
|
||||
}
|
||||
|
||||
if (get("group_filament_presets").empty()) {
|
||||
set("group_filament_presets", "1"); // All "0" / None "1" / ByBrand "2" . ByBrand will be added it to later
|
||||
}
|
||||
|
||||
if (get("enable_high_low_temp_mixed_printing").empty()){
|
||||
set_bool("enable_high_low_temp_mixed_printing", false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -415,6 +415,52 @@ wxBoxSizer *PreferencesDialog::create_item_region_combobox(wxString title, wxStr
|
|||
return m_sizer_combox;
|
||||
}
|
||||
|
||||
wxBoxSizer *PreferencesDialog::create_item_group_filament_presets(wxString title, wxString tooltip)
|
||||
{
|
||||
std::vector<wxString> vlist = {_L("All"), _L("None")}; // ByBrand will be added it to later
|
||||
std::vector<wxString> clist = { "0" , "1"};
|
||||
|
||||
wxBoxSizer *m_sizer_combox = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_sizer_combox->AddSpacer(FromDIP(DESIGN_LEFT_MARGIN));
|
||||
|
||||
auto tip = tooltip.IsEmpty() ? title : tooltip; // auto fill tooltips with title if its empty
|
||||
|
||||
auto combo_title = new wxStaticText(m_parent, wxID_ANY, title, wxDefaultPosition, DESIGN_TITLE_SIZE, wxST_NO_AUTORESIZE);
|
||||
combo_title->SetForegroundColour(DESIGN_GRAY900_COLOR);
|
||||
combo_title->SetFont(::Label::Body_14);
|
||||
combo_title->SetToolTip(tip);
|
||||
combo_title->Wrap(DESIGN_TITLE_SIZE.x);
|
||||
m_sizer_combox->Add(combo_title, 0, wxALIGN_CENTER);
|
||||
|
||||
auto combobox = new ::ComboBox(m_parent, wxID_ANY, wxEmptyString, wxDefaultPosition, DESIGN_LARGE_COMBOBOX_SIZE, 0, nullptr, wxCB_READONLY);
|
||||
combobox->SetFont(::Label::Body_14);
|
||||
combobox->GetDropDown().SetFont(::Label::Body_14);
|
||||
m_sizer_combox->Add(combobox, 0, wxALIGN_CENTER | wxLEFT, FromDIP(5));
|
||||
|
||||
std::vector<wxString>::iterator iter;
|
||||
for (iter = vlist.begin(); iter != vlist.end(); iter++) { combobox->Append(*iter); }
|
||||
|
||||
AppConfig * config = GUI::wxGetApp().app_config;
|
||||
|
||||
if (!config->get("group_filament_presets").empty()) {
|
||||
std::string value = config->get("group_filament_presets");
|
||||
for (auto i = 0; i < vlist.size(); i++) {
|
||||
if (clist[i].ToStdString() == value)
|
||||
combobox->SetSelection(i);
|
||||
}
|
||||
}
|
||||
|
||||
combobox->GetDropDown().Bind(wxEVT_COMBOBOX, [this, combobox, clist](wxCommandEvent &e) {
|
||||
const int v = e.GetSelection();
|
||||
combobox->SetSelection(v);
|
||||
wxGetApp().app_config->set("group_filament_presets", clist[v].ToStdString());
|
||||
wxGetApp().plater()->sidebar().update_presets(Preset::TYPE_FILAMENT);
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
return m_sizer_combox;
|
||||
}
|
||||
|
||||
wxBoxSizer *PreferencesDialog::create_item_loglevel_combobox(wxString title, wxString tooltip, std::vector<wxString> vlist)
|
||||
{
|
||||
wxBoxSizer *m_sizer_combox = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
|
@ -1221,6 +1267,9 @@ void PreferencesDialog::create_items()
|
|||
auto item_remember_printer = create_item_checkbox(_L("Remember printer configuration"), _L("If enabled, Orca will remember and switch filament/process configuration for each printer automatically."), "remember_printer_config");
|
||||
g_sizer->Add(item_remember_printer);
|
||||
|
||||
auto item_filament_preset_grouping = create_item_group_filament_presets(_L("Group user filament presets"), _L("Groups user filament presets depends on selection"));
|
||||
g_sizer->Add(item_filament_preset_grouping);
|
||||
|
||||
//// GENERAL > Features
|
||||
g_sizer->Add(create_item_title(_L("Features")), 1, wxEXPAND);
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ public:
|
|||
wxBoxSizer *create_item_combobox(wxString title, wxString tooltip, std::string param, std::vector<wxString> vlist, std::vector<std::string> config_name_index);
|
||||
wxBoxSizer *create_item_region_combobox(wxString title, wxString tooltip);
|
||||
wxBoxSizer *create_item_language_combobox(wxString title, wxString tooltip);
|
||||
wxBoxSizer *create_item_group_filament_presets(wxString title, wxString tooltip);
|
||||
wxBoxSizer *create_item_loglevel_combobox(wxString title, wxString tooltip, std::vector<wxString> vlist);
|
||||
wxBoxSizer *create_item_checkbox(wxString title, wxString tooltip, std::string param, const wxString secondary_title = "");
|
||||
wxBoxSizer *create_item_darkmode(wxString title,wxString tooltip, std::string param);
|
||||
|
|
|
|||
|
|
@ -1311,7 +1311,8 @@ void PlaterPresetComboBox::update()
|
|||
|
||||
//BBS: add project embedded preset logic
|
||||
add_presets(project_embedded_presets, selected_user_preset, L("Project-inside presets"), _L("Project") + " ");
|
||||
add_presets(nonsys_presets, selected_user_preset, L("User presets"), ""); // _L("Custom") + " " ORCA show filament presets without sub menu
|
||||
auto group_filament_presets = wxGetApp().app_config->get("group_filament_presets");
|
||||
add_presets(nonsys_presets, selected_user_preset, L("User presets"), group_filament_presets == "0" ? (_L("Custom") + " ") : ""); // ORCA show filament presets without sub menu
|
||||
// BBS: move system to the end
|
||||
add_presets(system_presets, selected_system_preset, L("System presets"), _L("System"));
|
||||
add_presets(uncompatible_presets, {}, L("Unsupported presets"), _L("Unsupported") + " ");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue