mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 03:55:54 +08:00
enum for "Add settings" contextual menu
add missing category for options that need it for contextual menu. todo: refactor even more to have an automatic tab.cpp, via a structured categories->subcat->line object tree created in-place, and also use that to order the contextual menu. Also use only colored icon, as the greyscale version isn't in the resource repo anymore.
This commit is contained in:
parent
6064dfe2c7
commit
7854bed9c4
@ -23,6 +23,37 @@
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
||||
std::string toString(OptionCategory opt) {
|
||||
switch (opt) {
|
||||
case none: return "";
|
||||
case perimeter: return "Perimeters & Shell";
|
||||
case slicing: return "Slicing";
|
||||
case infill: return "Infill";
|
||||
case skirtBrim: return "Skirt & Brim";
|
||||
case support: return "Support material";
|
||||
case width: return "Width & Flow";
|
||||
case speed: return "Speed";
|
||||
case extruders: return "Multiple extruders";
|
||||
case output: return "Output options";
|
||||
case notes: return "Notes";
|
||||
case dependencies: return "Dependencies";
|
||||
case filament: return "Filament";
|
||||
case cooling: return "Cooling";
|
||||
case advanced: return "Advanced";
|
||||
case filoverride: return "Filament overrides";
|
||||
case customgcode: return "Custom G-code";
|
||||
case general: return "General";
|
||||
case limits: return "Machine limits";
|
||||
case mmsetup: return "Single Extruder MM Setup";
|
||||
case firmware: return "Firmware";
|
||||
case pad: return "Pad";
|
||||
case padSupp: return "Pad and Support";
|
||||
case wipe: return "Wipe Options";
|
||||
}
|
||||
return "error";
|
||||
}
|
||||
|
||||
// Escape \n, \r and backslash
|
||||
std::string escape_string_cstyle(const std::string &str)
|
||||
{
|
||||
@ -298,16 +329,16 @@ std::ostream& ConfigDef::print_cli_help(std::ostream& out, bool show_defaults, s
|
||||
};
|
||||
|
||||
// get the unique categories
|
||||
std::set<std::string> categories;
|
||||
std::set<OptionCategory> categories;
|
||||
for (const auto& opt : this->options) {
|
||||
const ConfigOptionDef& def = opt.second;
|
||||
if (filter(def))
|
||||
categories.insert(def.category);
|
||||
}
|
||||
|
||||
for (auto category : categories) {
|
||||
if (category != "") {
|
||||
out << category << ":" << std::endl;
|
||||
for (OptionCategory category : categories) {
|
||||
if (category != OptionCategory::none) {
|
||||
out << toString(category) << ":" << std::endl;
|
||||
} else if (categories.size() > 1) {
|
||||
out << "Misc options:" << std::endl;
|
||||
}
|
||||
|
@ -33,6 +33,40 @@ extern std::string escape_strings_cstyle(const std::vector<std::string> &strs);
|
||||
extern bool unescape_string_cstyle(const std::string &str, std::string &out);
|
||||
extern bool unescape_strings_cstyle(const std::string &str, std::vector<std::string> &out);
|
||||
|
||||
|
||||
enum OptionCategory : int
|
||||
{
|
||||
none,
|
||||
|
||||
perimeter,
|
||||
slicing,
|
||||
infill,
|
||||
skirtBrim,
|
||||
support,
|
||||
speed,
|
||||
width,
|
||||
extruders,
|
||||
output,
|
||||
notes,
|
||||
dependencies,
|
||||
|
||||
filament,
|
||||
cooling,
|
||||
advanced,
|
||||
filoverride,
|
||||
customgcode,
|
||||
|
||||
general,
|
||||
limits,
|
||||
mmsetup,
|
||||
firmware,
|
||||
|
||||
pad,
|
||||
padSupp,
|
||||
wipe,
|
||||
};
|
||||
std::string toString(OptionCategory opt);
|
||||
|
||||
/// Specialization of std::exception to indicate that an unknown config option has been encountered.
|
||||
class UnknownOptionException : public std::runtime_error {
|
||||
public:
|
||||
@ -1407,8 +1441,7 @@ public:
|
||||
// With which printer technology is this configuration valid?
|
||||
PrinterTechnology printer_technology = ptUnknown;
|
||||
// Category of a configuration field, from the GUI perspective.
|
||||
// One of: "Layers and Perimeters", "Infill", "Support material", "Speed", "Extruders", "Advanced", "Extrusion Width"
|
||||
std::string category;
|
||||
OptionCategory category = OptionCategory::none;
|
||||
// A tooltip text shown in the GUI.
|
||||
std::string tooltip;
|
||||
// Text right from the input field, usually a unit of measurement.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -31,18 +31,18 @@ wxDEFINE_EVENT(EVT_OBJ_LIST_OBJECT_SELECT, SimpleEvent);
|
||||
// pt_FFF
|
||||
static SettingsBundle FREQ_SETTINGS_BUNDLE_FFF =
|
||||
{
|
||||
{ L("Layers and Perimeters"), { "layer_height" , "perimeters", "top_solid_layers", "bottom_solid_layers" } },
|
||||
{ L("Infill") , { "fill_density", "fill_pattern" } },
|
||||
{ L("Support material") , { "support_material", "support_material_auto", "support_material_threshold",
|
||||
{ OptionCategory::perimeter , { "layer_height" , "perimeters", "top_solid_layers", "bottom_solid_layers" } },
|
||||
{ OptionCategory::infill , { "fill_density", "fill_pattern" } },
|
||||
{ OptionCategory::support , { "support_material", "support_material_auto", "support_material_threshold",
|
||||
"support_material_pattern", "support_material_interface_pattern", "support_material_buildplate_only",
|
||||
"support_material_spacing" } },
|
||||
{ L("Wipe options") , { "wipe_into_infill", "wipe_into_objects" } }
|
||||
{ OptionCategory::wipe , { "wipe_into_infill", "wipe_into_objects" } }
|
||||
};
|
||||
|
||||
// pt_SLA
|
||||
static SettingsBundle FREQ_SETTINGS_BUNDLE_SLA =
|
||||
{
|
||||
{ L("Pad and Support") , { "supports_enable", "pad_enable" } }
|
||||
{ OptionCategory::padSupp , { "supports_enable", "pad_enable" } }
|
||||
};
|
||||
|
||||
// Note: id accords to type of the sub-object (adding volume), so sequence of the menu items is important
|
||||
@ -75,30 +75,36 @@ static void take_snapshot(const wxString& snapshot_name)
|
||||
wxGetApp().plater()->take_snapshot(snapshot_name);
|
||||
}
|
||||
|
||||
void fill_CATEGORY_ICON(std::map<OptionCategory, wxBitmap> &CATEGORY_ICON)
|
||||
{
|
||||
// Note: `this` isn't passed to create_scaled_bitmap() here because of bugs in the widget,
|
||||
// see note in PresetBundle::load_compatible_bitmaps()
|
||||
|
||||
// ptFFF
|
||||
CATEGORY_ICON[OptionCategory::perimeter] = create_scaled_bitmap(nullptr, "shell");
|
||||
CATEGORY_ICON[OptionCategory::slicing] = create_scaled_bitmap(nullptr, "layers");
|
||||
CATEGORY_ICON[OptionCategory::infill] = create_scaled_bitmap(nullptr, "infill");
|
||||
CATEGORY_ICON[OptionCategory::support] = create_scaled_bitmap(nullptr, "support");
|
||||
CATEGORY_ICON[OptionCategory::speed] = create_scaled_bitmap(nullptr, "time");
|
||||
CATEGORY_ICON[OptionCategory::extruders] = create_scaled_bitmap(nullptr, "funnel");
|
||||
CATEGORY_ICON[OptionCategory::width] = create_scaled_bitmap(nullptr, "funnel");
|
||||
CATEGORY_ICON[OptionCategory::wipe] = create_scaled_bitmap(nullptr, "funnel");
|
||||
CATEGORY_ICON[OptionCategory::skirtBrim] = create_scaled_bitmap(nullptr, "skirt+brim");
|
||||
CATEGORY_ICON[OptionCategory::width] = create_scaled_bitmap(nullptr, "width");
|
||||
CATEGORY_ICON[OptionCategory::advanced] = create_scaled_bitmap(nullptr, "wrench");
|
||||
CATEGORY_ICON[OptionCategory::output] = create_scaled_bitmap(nullptr, "output+page_white");
|
||||
CATEGORY_ICON[OptionCategory::notes] = create_scaled_bitmap(nullptr, "note");
|
||||
CATEGORY_ICON[OptionCategory::dependencies] = create_scaled_bitmap(nullptr, "wrench");
|
||||
// ptSLA
|
||||
CATEGORY_ICON[OptionCategory::support] = create_scaled_bitmap(nullptr, "support"/*"sla_supports"*/);
|
||||
CATEGORY_ICON[OptionCategory::pad] = create_scaled_bitmap(nullptr, "pad");
|
||||
}
|
||||
|
||||
ObjectList::ObjectList(wxWindow* parent) :
|
||||
wxDataViewCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE),
|
||||
m_parent(parent)
|
||||
{
|
||||
// Fill CATEGORY_ICON
|
||||
{
|
||||
// Note: `this` isn't passed to create_scaled_bitmap() here because of bugs in the widget,
|
||||
// see note in PresetBundle::load_compatible_bitmaps()
|
||||
|
||||
// ptFFF
|
||||
CATEGORY_ICON[L("Layers and Perimeters")] = create_scaled_bitmap(nullptr, "layers");
|
||||
CATEGORY_ICON[L("Infill")] = create_scaled_bitmap(nullptr, "infill");
|
||||
CATEGORY_ICON[L("Support material")] = create_scaled_bitmap(nullptr, "support");
|
||||
CATEGORY_ICON[L("Speed")] = create_scaled_bitmap(nullptr, "time");
|
||||
CATEGORY_ICON[L("Extruders")] = create_scaled_bitmap(nullptr, "funnel");
|
||||
CATEGORY_ICON[L("Extrusion Width")] = create_scaled_bitmap(nullptr, "funnel");
|
||||
CATEGORY_ICON[L("Wipe options")] = create_scaled_bitmap(nullptr, "funnel");
|
||||
// CATEGORY_ICON[L("Skirt and brim")] = create_scaled_bitmap(nullptr, "skirt+brim");
|
||||
// CATEGORY_ICON[L("Speed > Acceleration")] = create_scaled_bitmap(nullptr, "time");
|
||||
CATEGORY_ICON[L("Advanced")] = create_scaled_bitmap(nullptr, "wrench");
|
||||
// ptSLA
|
||||
CATEGORY_ICON[L("Supports")] = create_scaled_bitmap(nullptr, "support"/*"sla_supports"*/);
|
||||
CATEGORY_ICON[L("Pad")] = create_scaled_bitmap(nullptr, "pad");
|
||||
}
|
||||
fill_CATEGORY_ICON(CATEGORY_ICON);
|
||||
|
||||
// create control
|
||||
create_objects_ctrl();
|
||||
@ -613,25 +619,7 @@ void ObjectList::msw_rescale_icons()
|
||||
|
||||
|
||||
// Update CATEGORY_ICON according to new scale
|
||||
{
|
||||
// Note: `this` isn't passed to create_scaled_bitmap() here because of bugs in the widget,
|
||||
// see note in PresetBundle::load_compatible_bitmaps()
|
||||
|
||||
// ptFFF
|
||||
CATEGORY_ICON[L("Layers and Perimeters")] = create_scaled_bitmap(nullptr, "layers");
|
||||
CATEGORY_ICON[L("Infill")] = create_scaled_bitmap(nullptr, "infill");
|
||||
CATEGORY_ICON[L("Support material")] = create_scaled_bitmap(nullptr, "support");
|
||||
CATEGORY_ICON[L("Speed")] = create_scaled_bitmap(nullptr, "time");
|
||||
CATEGORY_ICON[L("Extruders")] = create_scaled_bitmap(nullptr, "funnel");
|
||||
CATEGORY_ICON[L("Extrusion Width")] = create_scaled_bitmap(nullptr, "funnel");
|
||||
CATEGORY_ICON[L("Wipe options")] = create_scaled_bitmap(nullptr, "funnel");
|
||||
// CATEGORY_ICON[L("Skirt and brim")] = create_scaled_bitmap(nullptr, "skirt+brim");
|
||||
// CATEGORY_ICON[L("Speed > Acceleration")] = create_scaled_bitmap(nullptr, "time");
|
||||
CATEGORY_ICON[L("Advanced")] = create_scaled_bitmap(nullptr, "wrench");
|
||||
// ptSLA
|
||||
CATEGORY_ICON[L("Supports")] = create_scaled_bitmap(nullptr, "support"/*"sla_supports"*/);
|
||||
CATEGORY_ICON[L("Pad")] = create_scaled_bitmap(nullptr, "pad");
|
||||
}
|
||||
fill_CATEGORY_ICON(CATEGORY_ICON);
|
||||
}
|
||||
|
||||
|
||||
@ -1064,19 +1052,20 @@ void ObjectList::OnDrop(wxDataViewEvent &event)
|
||||
|
||||
std::vector<std::string> ObjectList::get_options(const bool is_part)
|
||||
{
|
||||
std::vector<std::string> options;
|
||||
if (printer_technology() == ptSLA) {
|
||||
SLAPrintObjectConfig full_sla_config;
|
||||
auto options = full_sla_config.keys();
|
||||
options = full_sla_config.keys();
|
||||
options.erase(find(options.begin(), options.end(), "layer_height"));
|
||||
return options;
|
||||
}
|
||||
|
||||
PrintRegionConfig reg_config;
|
||||
auto options = reg_config.keys();
|
||||
if (!is_part) {
|
||||
PrintObjectConfig obj_config;
|
||||
std::vector<std::string> obj_options = obj_config.keys();
|
||||
options.insert(options.end(), obj_options.begin(), obj_options.end());
|
||||
std::sort(options.begin(), options.end());
|
||||
} else {
|
||||
PrintRegionConfig reg_config;
|
||||
options = reg_config.keys();
|
||||
if (!is_part) {
|
||||
PrintObjectConfig obj_config;
|
||||
std::vector<std::string> obj_options = obj_config.keys();
|
||||
options.insert(options.end(), obj_options.begin(), obj_options.end());
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
@ -1088,7 +1077,7 @@ const std::vector<std::string>& ObjectList::get_options_for_bundle(const wxStrin
|
||||
|
||||
for (auto& it : bundle)
|
||||
{
|
||||
if (bundle_name == _(it.first))
|
||||
if (bundle_name == _(toString(it.first)))
|
||||
return it.second;
|
||||
}
|
||||
#if 0
|
||||
@ -1107,31 +1096,32 @@ const std::vector<std::string>& ObjectList::get_options_for_bundle(const wxStrin
|
||||
return empty;
|
||||
}
|
||||
|
||||
static bool improper_category(const std::string& category, const int extruders_cnt, const bool is_object_settings = true)
|
||||
static bool improper_category(const OptionCategory& category, const int extruders_cnt, const bool is_object_settings = true)
|
||||
{
|
||||
return category.empty() ||
|
||||
(extruders_cnt == 1 && (category == "Extruders" || category == "Wipe options" )) ||
|
||||
(!is_object_settings && category == "Support material");
|
||||
return category == OptionCategory::none ||
|
||||
(extruders_cnt == 1 && (category == OptionCategory::extruders || category == OptionCategory::wipe )) ||
|
||||
(!is_object_settings && category == OptionCategory::support);
|
||||
}
|
||||
|
||||
void ObjectList::get_options_menu(settings_menu_hierarchy& settings_menu, const bool is_part)
|
||||
{
|
||||
auto options = get_options(is_part);
|
||||
std::vector<std::string> options = get_options(is_part);
|
||||
|
||||
const int extruders_cnt = extruders_count();
|
||||
|
||||
DynamicPrintConfig config;
|
||||
for (auto& option : options)
|
||||
for (std::string& option : options)
|
||||
{
|
||||
auto const opt = config.def()->get(option);
|
||||
auto category = opt->category;
|
||||
const ConfigOptionDef* opt = config.def()->get(option);
|
||||
OptionCategory category = opt->category;
|
||||
if (improper_category(category, extruders_cnt, !is_part))
|
||||
continue;
|
||||
|
||||
const std::string& label = !opt->full_label.empty() ? opt->full_label : opt->label;
|
||||
std::pair<std::string, std::string> option_label(option, label);
|
||||
std::vector< std::pair<std::string, std::string> > new_category;
|
||||
auto& cat_opt_label = settings_menu.find(category) == settings_menu.end() ? new_category : settings_menu.at(category);
|
||||
std::vector< std::pair<std::string, std::string> >& cat_opt_label =
|
||||
settings_menu.find(category) == settings_menu.end() ? new_category : settings_menu.at(category);
|
||||
cat_opt_label.push_back(option_label);
|
||||
if (cat_opt_label.size() == 1)
|
||||
settings_menu[category] = cat_opt_label;
|
||||
@ -1157,17 +1147,20 @@ void ObjectList::get_settings_choice(const wxString& category_name)
|
||||
assert(m_config);
|
||||
auto opt_keys = m_config->keys();
|
||||
|
||||
for (auto& cat : settings_menu)
|
||||
for (auto& cat2idname : settings_menu)
|
||||
{
|
||||
if (_(cat.first) == category_name) {
|
||||
if (_(toString(cat2idname.first)) == category_name) {
|
||||
int sel = 0;
|
||||
for (auto& pair : cat.second) {
|
||||
names.Add(_(pair.second));
|
||||
if (find(opt_keys.begin(), opt_keys.end(), pair.first) != opt_keys.end())
|
||||
//sort per label, because there isn't a better one.
|
||||
std::sort(cat2idname.second.begin(), cat2idname.second.end(),
|
||||
[](const std::pair< std::string, std::string> &e1, const std::pair< std::string, std::string> &e2)->bool {return e1.second<e2.second; });
|
||||
for (auto& pair_strid_strname : cat2idname.second) {
|
||||
names.Add(_(pair_strid_strname.second));
|
||||
if (find(opt_keys.begin(), opt_keys.end(), pair_strid_strname.first) != opt_keys.end())
|
||||
selections.Add(sel);
|
||||
sel++;
|
||||
}
|
||||
settings_list = &cat.second;
|
||||
settings_list = &cat2idname.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1404,13 +1397,13 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
|
||||
|
||||
for (auto& it : FREQ_SETTINGS_BUNDLE_FFF)
|
||||
{
|
||||
settings_id = menu->FindItem(_(it.first));
|
||||
settings_id = menu->FindItem(_(toString(it.first)));
|
||||
if (settings_id != wxNOT_FOUND)
|
||||
menu->Destroy(settings_id);
|
||||
}
|
||||
for (auto& it : FREQ_SETTINGS_BUNDLE_SLA)
|
||||
{
|
||||
settings_id = menu->FindItem(_(it.first));
|
||||
settings_id = menu->FindItem(_(toString(it.first)));
|
||||
if (settings_id != wxNOT_FOUND)
|
||||
menu->Destroy(settings_id);
|
||||
}
|
||||
@ -1637,8 +1630,9 @@ wxMenu* ObjectList::create_settings_popupmenu(wxMenu *parent_menu)
|
||||
const bool is_part = m_objects_model->GetParent(GetSelection()) != wxDataViewItem(nullptr);
|
||||
get_options_menu(settings_menu, is_part);
|
||||
|
||||
//note: as settings_menu_hierarchy is a map<OptionCategory,...>, it's automatically sorted by enum order
|
||||
for (auto cat : settings_menu) {
|
||||
append_menu_item(menu, wxID_ANY, _(cat.first), "",
|
||||
append_menu_item(menu, wxID_ANY, _(toString(cat.first)), "",
|
||||
[menu, this](wxCommandEvent& event) { get_settings_choice(menu->GetLabel(event.GetId())); },
|
||||
CATEGORY_ICON.find(cat.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(cat.first), parent_menu);
|
||||
}
|
||||
@ -1658,7 +1652,7 @@ void ObjectList::create_freq_settings_popupmenu(wxMenu *menu, const bool is_obje
|
||||
if (improper_category(it.first, extruders_cnt, is_object_settings))
|
||||
continue;
|
||||
|
||||
append_menu_item(menu, wxID_ANY, _(it.first), "",
|
||||
append_menu_item(menu, wxID_ANY, _(toString(it.first)), "",
|
||||
[menu, this](wxCommandEvent& event) { get_freq_settings_choice(menu->GetLabel(event.GetId())); },
|
||||
CATEGORY_ICON.find(it.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(it.first), menu);
|
||||
}
|
||||
@ -2404,7 +2398,7 @@ wxDataViewItem ObjectList::add_settings_item(wxDataViewItem parent_item, const D
|
||||
if (cat_options.empty())
|
||||
return ret;
|
||||
|
||||
std::vector<std::string> categories;
|
||||
std::vector<Slic3r::OptionCategory> categories;
|
||||
categories.reserve(cat_options.size());
|
||||
for (auto& cat : cat_options)
|
||||
categories.push_back(cat.first);
|
||||
|
@ -26,10 +26,10 @@ enum class ModelVolumeType : int;
|
||||
// FIXME: broken build on mac os because of this is missing:
|
||||
typedef std::vector<std::string> t_config_option_keys;
|
||||
|
||||
typedef std::map<std::string, std::vector<std::string>> SettingsBundle;
|
||||
typedef std::map<OptionCategory, std::vector<std::string>> SettingsBundle;
|
||||
|
||||
// category -> vector ( option ; label )
|
||||
typedef std::map< std::string, std::vector< std::pair<std::string, std::string> > > settings_menu_hierarchy;
|
||||
typedef std::map< OptionCategory, std::vector< std::pair<std::string, std::string> > > settings_menu_hierarchy;
|
||||
|
||||
typedef std::vector<ModelVolume*> ModelVolumePtrs;
|
||||
|
||||
@ -173,7 +173,7 @@ public:
|
||||
~ObjectList();
|
||||
|
||||
|
||||
std::map<std::string, wxBitmap> CATEGORY_ICON;
|
||||
std::map<OptionCategory, wxBitmap> CATEGORY_ICON;
|
||||
|
||||
ObjectDataViewModel* GetModel() const { return m_objects_model; }
|
||||
DynamicPrintConfig* config() const { return m_config; }
|
||||
|
@ -84,7 +84,7 @@ bool ObjectSettings::update_settings_list()
|
||||
|
||||
if (!cat_options.empty())
|
||||
{
|
||||
std::vector<std::string> categories;
|
||||
std::vector<Slic3r::OptionCategory> categories;
|
||||
categories.reserve(cat_options.size());
|
||||
|
||||
auto extra_column = [config, this](wxWindow* parent, const Line& line)
|
||||
@ -120,7 +120,7 @@ bool ObjectSettings::update_settings_list()
|
||||
{
|
||||
categories.push_back(cat.first);
|
||||
|
||||
auto optgroup = std::make_shared<ConfigOptionsGroup>(m_og->ctrl_parent(), _(cat.first), config, false, extra_column);
|
||||
auto optgroup = std::make_shared<ConfigOptionsGroup>(m_og->ctrl_parent(), _(toString(cat.first)), config, false, extra_column);
|
||||
optgroup->label_width = 15;
|
||||
optgroup->sidetext_width = 5;
|
||||
|
||||
@ -138,7 +138,7 @@ bool ObjectSettings::update_settings_list()
|
||||
ctrl->SetBitmapHover(m_bmp_delete_focus.bmp());
|
||||
};
|
||||
|
||||
const bool is_extruders_cat = cat.first == "Extruders";
|
||||
const bool is_extruders_cat = cat.first == OptionCategory::extruders;
|
||||
for (auto& opt : cat.second)
|
||||
{
|
||||
Option option = optgroup->get_option(opt);
|
||||
|
@ -99,7 +99,7 @@ ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg)
|
||||
btn_ok->SetFocus();
|
||||
btn_sizer->Add(btn_ok, 0, wxRIGHT, HORIZ_SPACING);
|
||||
|
||||
logo->SetBitmap(create_scaled_bitmap(this, "Slic3r_192px_grayscale.png", 192));
|
||||
logo->SetBitmap(create_scaled_bitmap(this, "Slic3r_192px.png", 192));
|
||||
|
||||
SetMaxSize(wxSize(-1, CONTENT_MAX_HEIGHT*wxGetApp().em_unit()));
|
||||
Fit();
|
||||
|
@ -1030,7 +1030,7 @@ void TabPrint::build()
|
||||
m_presets = &m_preset_bundle->prints;
|
||||
Line line{ "", "" };
|
||||
load_initial_data();
|
||||
auto page = add_options_page(_(L("Perimeters & shell")), "shell");
|
||||
auto page = add_options_page(_(L(toString(OptionCategory::perimeter))), "shell");
|
||||
|
||||
auto optgroup = page->new_optgroup(_(L("Vertical shells")));
|
||||
optgroup->append_single_option_line("perimeters");
|
||||
@ -1084,7 +1084,7 @@ void TabPrint::build()
|
||||
line.append_option(optgroup->get_option("perimeter_loop_seam"));
|
||||
optgroup->append_line(line);
|
||||
|
||||
page = add_options_page(_(L("Slicing")), "layers");
|
||||
page = add_options_page(_(L(toString(OptionCategory::slicing))), "layers");
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Layer height")));
|
||||
optgroup->append_single_option_line("layer_height");
|
||||
@ -1114,7 +1114,7 @@ void TabPrint::build()
|
||||
optgroup = page->new_optgroup(_(L("Other")));
|
||||
optgroup->append_single_option_line("clip_multipart_objects");
|
||||
|
||||
page = add_options_page(_(L("Infill")), "infill");
|
||||
page = add_options_page(_(L(toString(OptionCategory::infill))), "infill");
|
||||
optgroup = page->new_optgroup(_(L("Infill")));
|
||||
optgroup->append_single_option_line("fill_density");
|
||||
optgroup->append_single_option_line("fill_pattern");
|
||||
@ -1153,7 +1153,7 @@ void TabPrint::build()
|
||||
line.append_option(optgroup->get_option("fill_smooth_distribution"));
|
||||
optgroup->append_line(line);
|
||||
|
||||
page = add_options_page(_(L("Skirt and brim")), "skirt+brim");
|
||||
page = add_options_page(_(L(toString(OptionCategory::skirtBrim))), "skirt+brim");
|
||||
optgroup = page->new_optgroup(_(L("Skirt")));
|
||||
optgroup->append_single_option_line("skirts");
|
||||
optgroup->append_single_option_line("skirt_distance");
|
||||
@ -1169,7 +1169,7 @@ void TabPrint::build()
|
||||
line.append_option(optgroup->get_option("brim_ears_max_angle"));
|
||||
optgroup->append_line(line);
|
||||
|
||||
page = add_options_page(_(L("Support material")), "support");
|
||||
page = add_options_page(_(L(toString(OptionCategory::support))), "support");
|
||||
optgroup = page->new_optgroup(_(L("Support material")));
|
||||
optgroup->append_single_option_line("support_material");
|
||||
optgroup->append_single_option_line("support_material_auto");
|
||||
@ -1202,7 +1202,7 @@ void TabPrint::build()
|
||||
optgroup->append_single_option_line("support_material_interface_spacing");
|
||||
optgroup->append_single_option_line("support_material_interface_contact_loops");
|
||||
|
||||
page = add_options_page(_(L("Speed")), "time");
|
||||
page = add_options_page(_(L(toString(OptionCategory::speed))), "time");
|
||||
optgroup = page->new_optgroup(_(L("Speed for print moves")));
|
||||
line = { _(L("Perimeter speed")), "" };
|
||||
line.append_option(optgroup->get_option("perimeter_speed"));
|
||||
@ -1245,7 +1245,7 @@ void TabPrint::build()
|
||||
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_negative");
|
||||
#endif /* HAS_PRESSURE_EQUALIZER */
|
||||
|
||||
page = add_options_page(_(L("Width & flow")), "width");
|
||||
page = add_options_page(_(L(toString(OptionCategory::width))), "width");
|
||||
optgroup = page->new_optgroup(_(L("Extrusion width")));
|
||||
optgroup->append_single_option_line("extrusion_width");
|
||||
optgroup->append_single_option_line("first_layer_extrusion_width");
|
||||
@ -1266,7 +1266,7 @@ void TabPrint::build()
|
||||
line.append_option(optgroup->get_option("fill_top_flow_ratio"));
|
||||
optgroup->append_line(line);
|
||||
|
||||
page = add_options_page(_(L("Multiple extruders")), "funnel");
|
||||
page = add_options_page(_(L(toString(OptionCategory::extruders))), "funnel");
|
||||
optgroup = page->new_optgroup(_(L("Extruders")));
|
||||
optgroup->append_single_option_line("perimeter_extruder");
|
||||
optgroup->append_single_option_line("infill_extruder");
|
||||
@ -1292,7 +1292,7 @@ void TabPrint::build()
|
||||
optgroup = page->new_optgroup(_(L("Advanced")));
|
||||
optgroup->append_single_option_line("interface_shells");
|
||||
|
||||
page = add_options_page(_(L("Output options")), "output+page_white");
|
||||
page = add_options_page(_(L(toString(OptionCategory::output))), "output+page_white");
|
||||
optgroup = page->new_optgroup(_(L("Sequential printing")));
|
||||
optgroup->append_single_option_line("complete_objects");
|
||||
line = { _(L("Extruder clearance (mm)")), "" };
|
||||
@ -1317,14 +1317,14 @@ void TabPrint::build()
|
||||
option.opt.height = 5;//50;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
page = add_options_page(_(L("Notes")), "note");
|
||||
page = add_options_page(_(L(toString(OptionCategory::notes))), "note");
|
||||
optgroup = page->new_optgroup(_(L("Notes")), 0);
|
||||
option = optgroup->get_option("notes");
|
||||
option.opt.full_width = true;
|
||||
option.opt.height = 25;//250;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
page = add_options_page(_(L("Dependencies")), "wrench");
|
||||
page = add_options_page(_(L(toString(OptionCategory::dependencies))), "wrench");
|
||||
optgroup = page->new_optgroup(_(L("Profile dependencies")));
|
||||
line = optgroup->create_single_option_line("compatible_printers");
|
||||
line.widget = [this](wxWindow* parent) {
|
||||
@ -2997,8 +2997,8 @@ bool Tab::may_discard_current_dirty_preset(PresetCollection* presets /*= nullptr
|
||||
for (const std::string &opt_key : presets->current_dirty_options()) {
|
||||
const ConfigOptionDef &opt = m_config->def()->options.at(opt_key);
|
||||
/*std::string*/wxString name = "";
|
||||
if (! opt.category.empty())
|
||||
name += _(opt.category) + " > ";
|
||||
if (opt.category != OptionCategory::none)
|
||||
name += _(toString(opt.category)) + " > ";
|
||||
name += !opt.full_label.empty() ?
|
||||
_(opt.full_label) :
|
||||
_(opt.label);
|
||||
|
@ -149,7 +149,7 @@ MsgDataIncompatible::MsgDataIncompatible(const std::unordered_map<std::string, w
|
||||
MsgDialog(nullptr, wxString::Format(_(L("%s incompatibility")), SLIC3R_APP_NAME),
|
||||
wxString::Format(_(L("%s configuration is incompatible")), SLIC3R_APP_NAME), wxID_NONE)
|
||||
{
|
||||
logo->SetBitmap(create_scaled_bitmap(this, "Slic3r_192px_grayscale.png", 192));
|
||||
logo->SetBitmap(create_scaled_bitmap(this, "Slic3r_192px.png", 192));
|
||||
|
||||
auto *text = new wxStaticText(this, wxID_ANY, wxString::Format(_(L(
|
||||
"This version of %s is not compatible with currently installed configuration bundles.\n"
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "GUI_App.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
#include "libslic3r/GCode/PreviewData.hpp"
|
||||
#include "libslic3r/Config.hpp"
|
||||
#include "I18N.hpp"
|
||||
#include "GUI_Utils.hpp"
|
||||
#include "../Utils/MacDarkMode.hpp"
|
||||
@ -544,7 +545,7 @@ void ObjectDataViewModelNode::update_settings_digest_bitmaps()
|
||||
{
|
||||
m_bmp = m_empty_bmp;
|
||||
|
||||
std::map<std::string, wxBitmap>& categories_icon = Slic3r::GUI::wxGetApp().obj_list()->CATEGORY_ICON;
|
||||
std::map<Slic3r::OptionCategory, wxBitmap>& categories_icon = Slic3r::GUI::wxGetApp().obj_list()->CATEGORY_ICON;
|
||||
|
||||
std::string scaled_bitmap_name = m_name.ToUTF8().data();
|
||||
scaled_bitmap_name += "-em" + std::to_string(Slic3r::GUI::wxGetApp().em_unit());
|
||||
@ -552,7 +553,7 @@ void ObjectDataViewModelNode::update_settings_digest_bitmaps()
|
||||
wxBitmap *bmp = m_bitmap_cache->find(scaled_bitmap_name);
|
||||
if (bmp == nullptr) {
|
||||
std::vector<wxBitmap> bmps;
|
||||
for (auto& cat : m_opt_categories)
|
||||
for (Slic3r::OptionCategory& cat : m_opt_categories)
|
||||
bmps.emplace_back( categories_icon.find(cat) == categories_icon.end() ?
|
||||
wxNullBitmap : categories_icon.at(cat));
|
||||
bmp = m_bitmap_cache->insert(scaled_bitmap_name, bmps);
|
||||
@ -561,7 +562,7 @@ void ObjectDataViewModelNode::update_settings_digest_bitmaps()
|
||||
m_bmp = *bmp;
|
||||
}
|
||||
|
||||
bool ObjectDataViewModelNode::update_settings_digest(const std::vector<std::string>& categories)
|
||||
bool ObjectDataViewModelNode::update_settings_digest(const std::vector<Slic3r::OptionCategory>& categories)
|
||||
{
|
||||
if (m_type != itSettings || m_opt_categories == categories)
|
||||
return false;
|
||||
@ -569,10 +570,10 @@ bool ObjectDataViewModelNode::update_settings_digest(const std::vector<std::stri
|
||||
m_opt_categories = categories;
|
||||
m_name = wxEmptyString;
|
||||
|
||||
for (auto& cat : m_opt_categories)
|
||||
m_name += _(cat) + "; ";
|
||||
for (Slic3r::OptionCategory& cat : m_opt_categories)
|
||||
m_name += _(toString(cat)) + "; ";
|
||||
if (!m_name.IsEmpty())
|
||||
m_name.erase(m_name.Length()-2, 2); // Delete last "; "
|
||||
m_name.erase(m_name.Length()-2, 2); // Delete last "; " <- ??? you just added it!!
|
||||
|
||||
update_settings_digest_bitmaps();
|
||||
|
||||
@ -1700,7 +1701,7 @@ bool ObjectDataViewModel::IsSettingsItem(const wxDataViewItem &item) const
|
||||
}
|
||||
|
||||
void ObjectDataViewModel::UpdateSettingsDigest(const wxDataViewItem &item,
|
||||
const std::vector<std::string>& categories)
|
||||
const std::vector<Slic3r::OptionCategory>& categories)
|
||||
{
|
||||
if (!item.IsOk()) return;
|
||||
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
namespace Slic3r {
|
||||
enum class ModelVolumeType : int;
|
||||
//enum class OptionCategory : int;
|
||||
};
|
||||
|
||||
typedef double coordf_t;
|
||||
@ -200,7 +201,7 @@ class ObjectDataViewModelNode
|
||||
MyObjectTreeModelNodePtrArray m_children;
|
||||
wxBitmap m_empty_bmp;
|
||||
size_t m_volumes_cnt = 0;
|
||||
std::vector< std::string > m_opt_categories;
|
||||
std::vector< Slic3r::OptionCategory > m_opt_categories;
|
||||
t_layer_height_range m_layer_range = { 0.0f, 0.0f };
|
||||
|
||||
wxString m_name;
|
||||
@ -361,7 +362,7 @@ public:
|
||||
void set_printable_icon(PrintIndicator printable);
|
||||
|
||||
void update_settings_digest_bitmaps();
|
||||
bool update_settings_digest(const std::vector<std::string>& categories);
|
||||
bool update_settings_digest(const std::vector<Slic3r::OptionCategory>& categories);
|
||||
int volume_type() const { return int(m_volume_type); }
|
||||
void msw_rescale();
|
||||
|
||||
@ -481,7 +482,7 @@ public:
|
||||
wxDataViewItem GetLayerRootItem(const wxDataViewItem &item) const;
|
||||
bool IsSettingsItem(const wxDataViewItem &item) const;
|
||||
void UpdateSettingsDigest( const wxDataViewItem &item,
|
||||
const std::vector<std::string>& categories);
|
||||
const std::vector<Slic3r::OptionCategory>& categories);
|
||||
|
||||
bool IsPrintable(const wxDataViewItem &item) const;
|
||||
void UpdateObjectPrintable(wxDataViewItem parent_item);
|
||||
|
@ -186,8 +186,8 @@ SCENARIO("Flow: Flow math for bridges", "[!mayfail]") {
|
||||
THEN("Bridge width is same as nozzle diameter") {
|
||||
REQUIRE(flow.width == Approx(nozzle_diameter));
|
||||
}
|
||||
THEN("Bridge spacing is same as nozzle diameter + BRIDGE_EXTRA_SPACING") {
|
||||
REQUIRE(flow.spacing() == Approx(nozzle_diameter + BRIDGE_EXTRA_SPACING));
|
||||
THEN("Bridge spacing is same as nozzle diameter + BRIDGE_EXTRA_SPACING_MULT * nozzle_diameter") {
|
||||
REQUIRE(flow.spacing() == Approx(nozzle_diameter + BRIDGE_EXTRA_SPACING_MULT * nozzle_diameter));
|
||||
}
|
||||
}
|
||||
WHEN("Flow role is frInfill") {
|
||||
@ -195,8 +195,8 @@ SCENARIO("Flow: Flow math for bridges", "[!mayfail]") {
|
||||
THEN("Bridge width is same as nozzle diameter") {
|
||||
REQUIRE(flow.width == Approx(nozzle_diameter));
|
||||
}
|
||||
THEN("Bridge spacing is same as nozzle diameter + BRIDGE_EXTRA_SPACING") {
|
||||
REQUIRE(flow.spacing() == Approx(nozzle_diameter + BRIDGE_EXTRA_SPACING));
|
||||
THEN("Bridge spacing is same as nozzle diameter + BRIDGE_EXTRA_SPACING_MULT * nozzle_diameter") {
|
||||
REQUIRE(flow.spacing() == Approx(nozzle_diameter + BRIDGE_EXTRA_SPACING_MULT * nozzle_diameter));
|
||||
}
|
||||
}
|
||||
WHEN("Flow role is frPerimeter") {
|
||||
@ -204,8 +204,8 @@ SCENARIO("Flow: Flow math for bridges", "[!mayfail]") {
|
||||
THEN("Bridge width is same as nozzle diameter") {
|
||||
REQUIRE(flow.width == Approx(nozzle_diameter));
|
||||
}
|
||||
THEN("Bridge spacing is same as nozzle diameter + BRIDGE_EXTRA_SPACING") {
|
||||
REQUIRE(flow.spacing() == Approx(nozzle_diameter + BRIDGE_EXTRA_SPACING));
|
||||
THEN("Bridge spacing is same as nozzle diameter + BRIDGE_EXTRA_SPACING_MULT * nozzle_diameter") {
|
||||
REQUIRE(flow.spacing() == Approx(nozzle_diameter + BRIDGE_EXTRA_SPACING_MULT * nozzle_diameter));
|
||||
}
|
||||
}
|
||||
WHEN("Flow role is frSupportMaterial") {
|
||||
@ -213,8 +213,8 @@ SCENARIO("Flow: Flow math for bridges", "[!mayfail]") {
|
||||
THEN("Bridge width is same as nozzle diameter") {
|
||||
REQUIRE(flow.width == Approx(nozzle_diameter));
|
||||
}
|
||||
THEN("Bridge spacing is same as nozzle diameter + BRIDGE_EXTRA_SPACING") {
|
||||
REQUIRE(flow.spacing() == Approx(nozzle_diameter + BRIDGE_EXTRA_SPACING));
|
||||
THEN("Bridge spacing is same as nozzle diameter + BRIDGE_EXTRA_SPACING_MULT * nozzle_diameter") {
|
||||
REQUIRE(flow.spacing() == Approx(nozzle_diameter + BRIDGE_EXTRA_SPACING_MULT * nozzle_diameter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user