Added map for save Group and Category values for each option

+ Some code refactoring in Tab (the translation of the titles moved to the OptionGroups) and Search
+ Fixed assert in fts_fuzzy_match
This commit is contained in:
YuSanka 2020-04-13 17:55:38 +02:00
parent 218abacb75
commit 167f7cf5de
11 changed files with 373 additions and 298 deletions

View file

@ -144,6 +144,7 @@ void PrintConfigDef::init_fff_params()
def->label = L("Other layers"); def->label = L("Other layers");
def->tooltip = L("Bed temperature for layers after the first one. " def->tooltip = L("Bed temperature for layers after the first one. "
"Set this to zero to disable bed temperature control commands in the output."); "Set this to zero to disable bed temperature control commands in the output.");
def->sidetext = L("°C");
def->full_label = L("Bed temperature"); def->full_label = L("Bed temperature");
def->min = 0; def->min = 0;
def->max = 300; def->max = 300;
@ -866,8 +867,10 @@ void PrintConfigDef::init_fff_params()
def = this->add("first_layer_bed_temperature", coInts); def = this->add("first_layer_bed_temperature", coInts);
def->label = L("First layer"); def->label = L("First layer");
def->full_label = L("First layer bed temperature");
def->tooltip = L("Heated build plate temperature for the first layer. Set this to zero to disable " def->tooltip = L("Heated build plate temperature for the first layer. Set this to zero to disable "
"bed temperature control commands in the output."); "bed temperature control commands in the output.");
def->sidetext = L("°C");
def->max = 0; def->max = 0;
def->max = 300; def->max = 300;
def->set_default_value(new ConfigOptionInts { 0 }); def->set_default_value(new ConfigOptionInts { 0 });
@ -908,8 +911,10 @@ void PrintConfigDef::init_fff_params()
def = this->add("first_layer_temperature", coInts); def = this->add("first_layer_temperature", coInts);
def->label = L("First layer"); def->label = L("First layer");
def->full_label = L("First layer extruder temperature");
def->tooltip = L("Extruder temperature for first layer. If you want to control temperature manually " def->tooltip = L("Extruder temperature for first layer. If you want to control temperature manually "
"during print, set this to zero to disable temperature control commands in the output file."); "during print, set this to zero to disable temperature control commands in the output file.");
def->sidetext = L("°C");
def->min = 0; def->min = 0;
def->max = max_temp; def->max = max_temp;
def->set_default_value(new ConfigOptionInts { 200 }); def->set_default_value(new ConfigOptionInts { 200 });
@ -2071,7 +2076,8 @@ void PrintConfigDef::init_fff_params()
def->label = L("Other layers"); def->label = L("Other layers");
def->tooltip = L("Extruder temperature for layers after the first one. Set this to zero to disable " def->tooltip = L("Extruder temperature for layers after the first one. Set this to zero to disable "
"temperature control commands in the output."); "temperature control commands in the output.");
def->full_label = L("Temperature"); def->sidetext = L("°C");
def->full_label = L("Extruder temperature");
def->min = 0; def->min = 0;
def->max = max_temp; def->max = max_temp;
def->set_default_value(new ConfigOptionInts { 200 }); def->set_default_value(new ConfigOptionInts { 200 });

View file

@ -4489,13 +4489,13 @@ bool GLCanvas3D::_render_search_list(float pos_x) const
char *s = new char[255]; char *s = new char[255];
strcpy(s, search_line.empty() ? _u8L("Type here to search").c_str() : search_line.c_str()); strcpy(s, search_line.empty() ? _u8L("Type here to search").c_str() : search_line.c_str());
imgui->search_list(ImVec2(36 * em, 30 * em), &search_string_getter, s, selected, edited); imgui->search_list(ImVec2(45 * em, 30 * em), &search_string_getter, s, selected, edited);
search_line = s; search_line = s;
delete [] s; delete [] s;
if (edited) if (edited)
wxGetApp().sidebar().apply_search_filter(); wxGetApp().sidebar().search_and_apply_tab_search_lines();
if (selected != size_t(-1)) if (selected != size_t(-1))
{ {

View file

@ -379,6 +379,9 @@ Option ConfigOptionsGroup::get_option(const std::string& opt_key, int opt_index
std::pair<std::string, int> pair(opt_key, opt_index); std::pair<std::string, int> pair(opt_key, opt_index);
m_opt_map.emplace(opt_id, pair); m_opt_map.emplace(opt_id, pair);
if (m_show_modified_btns) // fill group and category values just fro options from Settings Tab
wxGetApp().sidebar().get_searcher().add_key(opt_id, title, config_category);
return Option(*m_config->def()->get(opt_key), opt_id); return Option(*m_config->def()->get(opt_key), opt_id);
} }

View file

@ -12,6 +12,7 @@
#include "Field.hpp" #include "Field.hpp"
#include "GUI_App.hpp" #include "GUI_App.hpp"
#include "I18N.hpp"
// Translate the ifdef // Translate the ifdef
#ifdef __WXOSX__ #ifdef __WXOSX__
@ -59,7 +60,7 @@ public:
m_extra_widgets.push_back(widget); m_extra_widgets.push_back(widget);
} }
Line(wxString label, wxString tooltip) : Line(wxString label, wxString tooltip) :
label(label), label_tooltip(tooltip) {} label(_(label)), label_tooltip(_(tooltip)) {}
const std::vector<widget_t>& get_extra_widgets() const {return m_extra_widgets;} const std::vector<widget_t>& get_extra_widgets() const {return m_extra_widgets;}
const std::vector<Option>& get_options() const { return m_options; } const std::vector<Option>& get_options() const { return m_options; }
@ -78,7 +79,7 @@ class OptionsGroup {
wxStaticBox* stb; wxStaticBox* stb;
public: public:
const bool staticbox {true}; const bool staticbox {true};
const wxString title {wxString("")}; const wxString title;
size_t label_width = 20 ;// {200}; size_t label_width = 20 ;// {200};
wxSizer* sizer {nullptr}; wxSizer* sizer {nullptr};
column_t extra_column {nullptr}; column_t extra_column {nullptr};
@ -175,7 +176,7 @@ public:
m_show_modified_btns(is_tab_opt), m_show_modified_btns(is_tab_opt),
staticbox(title!=""), extra_column(extra_clmn) { staticbox(title!=""), extra_column(extra_clmn) {
if (staticbox) { if (staticbox) {
stb = new wxStaticBox(_parent, wxID_ANY, title); stb = new wxStaticBox(_parent, wxID_ANY, _(title));
if (!wxOSX) stb->SetBackgroundStyle(wxBG_STYLE_PAINT); if (!wxOSX) stb->SetBackgroundStyle(wxBG_STYLE_PAINT);
stb->SetFont(wxGetApp().bold_font()); stb->SetFont(wxGetApp().bold_font());
} else } else
@ -248,6 +249,8 @@ public:
bool m_full_labels {0}; bool m_full_labels {0};
t_opt_map m_opt_map; t_opt_map m_opt_map;
std::string config_category;
void set_config(DynamicPrintConfig* config) { m_config = config; } void set_config(DynamicPrintConfig* config) { m_config = config; }
Option get_option(const std::string& opt_key, int opt_index = -1); Option get_option(const std::string& opt_key, int opt_index = -1);
Line create_single_option_line(const std::string& title, int idx = -1) /*const*/{ Line create_single_option_line(const std::string& title, int idx = -1) /*const*/{

View file

@ -722,8 +722,8 @@ struct Sidebar::priv
ScalableButton* btn_export_gcode_removable; //exports to removable drives (appears only if removable drive is connected) ScalableButton* btn_export_gcode_removable; //exports to removable drives (appears only if removable drive is connected)
bool is_collapsed {false}; bool is_collapsed {false};
SearchOptions search_list; Search::OptionsSearcher searcher;
std::string search_line; std::string search_line;
priv(Plater *plater) : plater(plater) {} priv(Plater *plater) : plater(plater) {}
~priv(); ~priv();
@ -1091,15 +1091,15 @@ void Sidebar::msw_rescale()
p->scrolled->Layout(); p->scrolled->Layout();
} }
void Sidebar::apply_search_filter() void Sidebar::search_and_apply_tab_search_lines()
{ {
if (p->search_list.apply_filters(p->search_line)) if (p->searcher.search(p->search_line))
apply_search_line_on_tabs(); apply_search_line_on_tabs();
} }
void Sidebar::jump_to_option(size_t selected) void Sidebar::jump_to_option(size_t selected)
{ {
const SearchOptions::Option& opt = p->search_list.get_option(selected); const Search::Option& opt = p->searcher.get_option(selected);
wxGetApp().get_tab(opt.type)->activate_option(opt.opt_key, opt.category); wxGetApp().get_tab(opt.type)->activate_option(opt.opt_key, opt.category);
} }
@ -1360,15 +1360,15 @@ bool Sidebar::is_multifilament()
return p->combos_filament.size() > 1; return p->combos_filament.size() > 1;
} }
static std::vector<SearchInput> get_search_inputs(ConfigOptionMode mode) static std::vector<Search::InputInfo> get_search_inputs(ConfigOptionMode mode)
{ {
std::vector<SearchInput> ret {}; std::vector<Search::InputInfo> ret {};
auto& tabs_list = wxGetApp().tabs_list; auto& tabs_list = wxGetApp().tabs_list;
auto print_tech = wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology(); auto print_tech = wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology();
for (auto tab : tabs_list) for (auto tab : tabs_list)
if (tab->supports_printer_technology(print_tech)) if (tab->supports_printer_technology(print_tech))
ret.emplace_back(SearchInput{tab->get_config(), tab->type(), mode}); ret.emplace_back(Search::InputInfo {tab->get_config(), tab->type(), mode});
return ret; return ret;
} }
@ -1380,14 +1380,12 @@ void Sidebar::apply_search_line_on_tabs()
for (auto tab : tabs_list) for (auto tab : tabs_list)
if (tab->supports_printer_technology(print_tech)) if (tab->supports_printer_technology(print_tech))
//tab->get_search_cb()->update_combobox();
tab->set_search_line(p->search_line); tab->set_search_line(p->search_line);
} }
void Sidebar::update_search_list() void Sidebar::update_searcher()
{ {
p->search_list.init(get_search_inputs(m_mode)); p->searcher.init(get_search_inputs(m_mode));
// apply_search_line_on_tabs();
} }
void Sidebar::update_mode() void Sidebar::update_mode()
@ -1396,7 +1394,7 @@ void Sidebar::update_mode()
update_reslice_btn_tooltip(); update_reslice_btn_tooltip();
update_mode_sizer(); update_mode_sizer();
update_search_list(); update_searcher();
wxWindowUpdateLocker noUpdates(this); wxWindowUpdateLocker noUpdates(this);
@ -1428,9 +1426,9 @@ std::vector<PresetComboBox*>& Sidebar::combos_filament()
return p->combos_filament; return p->combos_filament;
} }
SearchOptions& Sidebar::get_search_list() Search::OptionsSearcher& Sidebar::get_searcher()
{ {
return p->search_list; return p->searcher;
} }
std::string& Sidebar::get_search_line() std::string& Sidebar::get_search_line()
@ -3682,7 +3680,7 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
wxGetApp().obj_list()->update_object_list_by_printer_technology(); wxGetApp().obj_list()->update_object_list_by_printer_technology();
// print technology could be changed, so we should to update a search list // print technology could be changed, so we should to update a search list
sidebar->update_search_list(); sidebar->update_searcher();
} }
} }
@ -5347,7 +5345,7 @@ void Plater::undo_redo_topmost_string_getter(const bool is_undo, std::string& ou
bool Plater::search_string_getter(int idx, const char** out_text) bool Plater::search_string_getter(int idx, const char** out_text)
{ {
const SearchOptions& search_list = p->sidebar->get_search_list(); const Search::OptionsSearcher& search_list = p->sidebar->get_searcher();
if (0 <= idx && (size_t)idx < search_list.size()) { if (0 <= idx && (size_t)idx < search_list.size()) {
search_list[idx].get_marked_label(out_text); search_list[idx].get_marked_label(out_text);

View file

@ -105,7 +105,7 @@ public:
void update_mode_sizer() const; void update_mode_sizer() const;
void update_reslice_btn_tooltip() const; void update_reslice_btn_tooltip() const;
void msw_rescale(); void msw_rescale();
void apply_search_filter(); void search_and_apply_tab_search_lines();
void jump_to_option(size_t selected); void jump_to_option(size_t selected);
ObjectManipulation* obj_manipul(); ObjectManipulation* obj_manipul();
@ -133,10 +133,10 @@ public:
bool is_collapsed(); bool is_collapsed();
void collapse(bool collapse); void collapse(bool collapse);
void apply_search_line_on_tabs(); void apply_search_line_on_tabs();
void update_search_list(); void update_searcher();
std::vector<PresetComboBox*>& combos_filament(); std::vector<PresetComboBox*>& combos_filament();
SearchOptions& get_search_list(); Search::OptionsSearcher& get_searcher();
std::string& get_search_line(); std::string& get_search_line();
private: private:

View file

@ -1,19 +1,9 @@
#include "Search.hpp" #include "Search.hpp"
#include <cstddef> #include <cstddef>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string> #include <string>
#include <regex>
#include <future>
#include <boost/algorithm/string.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/log/trivial.hpp>
//#include <wx/bmpcbox.h>
#include "libslic3r/PrintConfig.hpp" #include "libslic3r/PrintConfig.hpp"
#include "GUI_App.hpp" #include "GUI_App.hpp"
#include "Tab.hpp" #include "Tab.hpp"
@ -27,56 +17,76 @@
using boost::optional; using boost::optional;
namespace Slic3r { namespace Slic3r {
namespace GUI {
bool SearchOptions::Option::fuzzy_match_simple(char const * search_pattern) const using GUI::from_u8;
using GUI::into_u8;
namespace Search {
FMFlag Option::fuzzy_match_simple(char const * search_pattern) const
{ {
char const* opt_key_str = opt_key.c_str(); return fts::fuzzy_match_simple(search_pattern, label_local.utf8_str()) ? fmLabelLocal :
char const* label_str = label.utf8_str(); fts::fuzzy_match_simple(search_pattern, group_local.utf8_str()) ? fmGroupLocal :
fts::fuzzy_match_simple(search_pattern, category_local.utf8_str()) ? fmCategoryLocal :
return fts::fuzzy_match_simple(search_pattern, label_str ) || fts::fuzzy_match_simple(search_pattern, opt_key.c_str()) ? fmOptKey :
fts::fuzzy_match_simple(search_pattern, opt_key_str ) ; fts::fuzzy_match_simple(search_pattern, label.utf8_str()) ? fmLabel :
fts::fuzzy_match_simple(search_pattern, group.utf8_str()) ? fmGroup :
fts::fuzzy_match_simple(search_pattern, category.utf8_str()) ? fmCategory : fmUndef ;
} }
bool SearchOptions::Option::fuzzy_match_simple(const wxString& search) const FMFlag Option::fuzzy_match_simple(const wxString& search) const
{ {
char const* search_pattern = search.utf8_str(); char const* search_pattern = search.utf8_str();
return fuzzy_match_simple(search_pattern); return fuzzy_match_simple(search_pattern);
} }
bool SearchOptions::Option::fuzzy_match_simple(const std::string& search) const FMFlag Option::fuzzy_match_simple(const std::string& search) const
{ {
char const* search_pattern = search.c_str(); char const* search_pattern = search.c_str();
return fuzzy_match_simple(search_pattern); return fuzzy_match_simple(search_pattern);
} }
bool SearchOptions::Option::fuzzy_match(char const* search_pattern, int& outScore) FMFlag Option::fuzzy_match(char const* search_pattern, int& outScore) const
{ {
char const* opt_key_str = opt_key.c_str(); FMFlag flag = fmUndef;
char const* label_str = label.utf8_str(); int score;
return (fts::fuzzy_match(search_pattern, label_str , outScore) || if (fts::fuzzy_match(search_pattern, label_local.utf8_str(), score) && outScore < score) {
fts::fuzzy_match(search_pattern, opt_key_str , outScore) ); outScore = score; flag = fmLabelLocal ; }
if (fts::fuzzy_match(search_pattern, group_local.utf8_str(), score) && outScore < score) {
outScore = score; flag = fmGroupLocal ; }
if (fts::fuzzy_match(search_pattern, category_local.utf8_str(), score) && outScore < score) {
outScore = score; flag = fmCategoryLocal; }
if (fts::fuzzy_match(search_pattern, opt_key.c_str(), score) && outScore < score) {
outScore = score; flag = fmOptKey ; }
if (fts::fuzzy_match(search_pattern, label.utf8_str(), score) && outScore < score) {
outScore = score; flag = fmLabel ; }
if (fts::fuzzy_match(search_pattern, group.utf8_str(), score) && outScore < score) {
outScore = score; flag = fmGroup ; }
if (fts::fuzzy_match(search_pattern, category.utf8_str(), score) && outScore < score) {
outScore = score; flag = fmCategory ; }
return flag;
} }
bool SearchOptions::Option::fuzzy_match(const wxString& search, int& outScore) FMFlag Option::fuzzy_match(const wxString& search, int& outScore) const
{ {
char const* search_pattern = search.utf8_str(); char const* search_pattern = search.utf8_str();
return fuzzy_match(search_pattern, outScore); return fuzzy_match(search_pattern, outScore);
} }
bool SearchOptions::Option::fuzzy_match(const std::string& search, int& outScore) FMFlag Option::fuzzy_match(const std::string& search, int& outScore) const
{ {
char const* search_pattern = search.c_str(); char const* search_pattern = search.c_str();
return fuzzy_match(search_pattern, outScore); return fuzzy_match(search_pattern, outScore);
} }
void SearchOptions::Filter::get_label(const char** out_text) const void FoundOption::get_label(const char** out_text) const
{ {
*out_text = label.utf8_str(); *out_text = label.utf8_str();
} }
void SearchOptions::Filter::get_marked_label(const char** out_text) const void FoundOption::get_marked_label(const char** out_text) const
{ {
*out_text = marked_label.utf8_str(); *out_text = marked_label.utf8_str();
} }
@ -89,8 +99,10 @@ void change_opt_key(std::string& opt_key, DynamicPrintConfig* config)
opt_key += "#" + std::to_string(0); opt_key += "#" + std::to_string(0);
} }
void SearchOptions::append_options(DynamicPrintConfig* config, Preset::Type type, ConfigOptionMode mode) void OptionsSearcher::append_options(DynamicPrintConfig* config, Preset::Type type, ConfigOptionMode mode)
{ {
std::vector<std::string> non_added_options {"printer_technology", "thumbnails" };
for (std::string opt_key : config->keys()) for (std::string opt_key : config->keys())
{ {
const ConfigOptionDef& opt = config->def()->options.at(opt_key); const ConfigOptionDef& opt = config->def()->options.at(opt_key);
@ -109,13 +121,15 @@ void SearchOptions::append_options(DynamicPrintConfig* config, Preset::Type type
default: break; default: break;
} }
wxString label; wxString label = opt.full_label.empty() ? opt.label : opt.full_label;
if (!opt.category.empty())
label += _(opt.category) + " : "; const GroupAndCategory& gc = groups_and_categories[opt_key];
label += _(opt.full_label.empty() ? opt.label : opt.full_label);
if (!label.IsEmpty()) if (!label.IsEmpty())
options.emplace_back(Option{ label, opt_key, opt.category, type }); options.emplace_back(Option{opt_key, type,
label, _(label),
gc.group, _(gc.group),
gc.category, _(gc.category) });
} }
} }
@ -163,54 +177,69 @@ static void clear_marked_string(wxString& str)
str.Replace(delete_string, wxEmptyString, true); str.Replace(delete_string, wxEmptyString, true);
} }
bool SearchOptions::apply_filters(const std::string& search, bool force/* = false*/) bool OptionsSearcher::search(const std::string& search, bool force/* = false*/)
{ {
if (search_line == search && !force) if (search_line == search && !force)
return false; return false;
clear_filters(); found.clear();
bool full_list = search.empty(); bool full_list = search.empty();
for (size_t i=0; i < options.size(); i++) for (size_t i=0; i < options.size(); i++)
{ {
const Option &opt = options[i];
if (full_list) { if (full_list) {
filters.emplace_back(Filter{ options[i].label, options[i].label, i, 0 }); wxString label = opt.category_local + " > " + opt.group_local + " > " + opt.label_local;
found.emplace_back(FoundOption{ label, label, i, 0 });
continue; continue;
} }
int score = 0; int score = 0;
if (options[i].fuzzy_match_simple(search)/*fuzzy_match(search, score)*/)
FMFlag fuzzy_match_flag = opt.fuzzy_match(search, score);
if (fuzzy_match_flag != fmUndef)
{ {
wxString marked_label = options[i].label; wxString label = opt.category_local + " > " + opt.group_local + " > " + opt.label_local;
if ( fuzzy_match_flag == fmLabel ) label += "(" + opt.label + ")";
else if (fuzzy_match_flag == fmGroup ) label += "(" + opt.group + ")";
else if (fuzzy_match_flag == fmCategory) label += "(" + opt.category + ")";
else if (fuzzy_match_flag == fmOptKey ) label += "(" + opt.opt_key + ")";
wxString marked_label = label;
mark_string(marked_label, from_u8(search)); mark_string(marked_label, from_u8(search));
clear_marked_string(marked_label); clear_marked_string(marked_label);
filters.emplace_back(Filter{ options[i].label, marked_label, i, score }); found.emplace_back(FoundOption{ label, marked_label, i, score });
} }
} }
if (!full_list) if (!full_list)
sort_filters(); sort_found();
search_line = search; search_line = search;
return true; return true;
} }
void SearchOptions::init(std::vector<SearchInput> input_values) void OptionsSearcher::init(std::vector<InputInfo> input_values)
{ {
clear_options(); options.clear();
for (auto i : input_values) for (auto i : input_values)
append_options(i.config, i.type, i.mode); append_options(i.config, i.type, i.mode);
sort_options(); sort_options();
apply_filters(search_line, true); search(search_line, true);
} }
const SearchOptions::Option& SearchOptions::get_option(size_t pos_in_filter) const const Option& OptionsSearcher::get_option(size_t pos_in_filter) const
{ {
assert(pos_in_filter != size_t(-1) && filters[pos_in_filter].option_idx != size_t(-1)); assert(pos_in_filter != size_t(-1) && found[pos_in_filter].option_idx != size_t(-1));
return options[filters[pos_in_filter].option_idx]; return options[found[pos_in_filter].option_idx];
}
void OptionsSearcher::add_key(const std::string& opt_key, const wxString& group, const wxString& category)
{
groups_and_categories[opt_key] = GroupAndCategory{group, category};
} }
@ -219,7 +248,7 @@ const SearchOptions::Option& SearchOptions::get_option(size_t pos_in_filter) con
//------------------------------------------ //------------------------------------------
SearchCtrl::SearchCtrl(wxWindow* parent) : SearchCtrl::SearchCtrl(wxWindow* parent) :
wxComboCtrl(parent, wxID_ANY, _L("Type here to search"), wxDefaultPosition, wxSize(25 * wxGetApp().em_unit(), -1), wxTE_PROCESS_ENTER) wxComboCtrl(parent, wxID_ANY, _L("Type here to search"), wxDefaultPosition, wxSize(25 * GUI::wxGetApp().em_unit(), -1), wxTE_PROCESS_ENTER)
{ {
default_string = _L("Type here to search"); default_string = _L("Type here to search");
@ -253,16 +282,16 @@ void SearchCtrl::OnInputText(wxCommandEvent& )
if (input_string == default_string) if (input_string == default_string)
input_string.Clear(); input_string.Clear();
wxGetApp().sidebar().get_search_line() = into_u8(input_string); GUI::wxGetApp().sidebar().get_search_line() = into_u8(input_string);
editing = true; editing = true;
wxGetApp().sidebar().apply_search_filter(); GUI::wxGetApp().sidebar().search_and_apply_tab_search_lines();
editing = false; editing = false;
} }
void SearchCtrl::PopupList(wxCommandEvent& e) void SearchCtrl::PopupList(wxCommandEvent& e)
{ {
update_list(wxGetApp().sidebar().get_search_list().filters); update_list(GUI::wxGetApp().sidebar().get_searcher().found_options());
if (e.GetEventType() == wxEVT_TEXT_ENTER) if (e.GetEventType() == wxEVT_TEXT_ENTER)
this->Popup(); this->Popup();
@ -278,7 +307,7 @@ void SearchCtrl::set_search_line(const std::string& line)
void SearchCtrl::msw_rescale() void SearchCtrl::msw_rescale()
{ {
wxSize size = wxSize(25 * wxGetApp().em_unit(), -1); wxSize size = wxSize(25 * GUI::wxGetApp().em_unit(), -1);
// Set rescaled min height to correct layout // Set rescaled min height to correct layout
this->SetMinSize(size); this->SetMinSize(size);
@ -294,11 +323,11 @@ void SearchCtrl::OnSelect(wxCommandEvent& event)
return; return;
prevent_update = true; prevent_update = true;
wxGetApp().sidebar().jump_to_option(selection); GUI::wxGetApp().sidebar().jump_to_option(selection);
prevent_update = false; prevent_update = false;
} }
void SearchCtrl::update_list(std::vector<SearchOptions::Filter>& filters) void SearchCtrl::update_list(const std::vector<FoundOption>& filters)
{ {
if (popupListBox->GetCount() == filters.size() && if (popupListBox->GetCount() == filters.size() &&
popupListBox->GetString(0) == filters[0].label && popupListBox->GetString(0) == filters[0].label &&
@ -306,7 +335,7 @@ void SearchCtrl::update_list(std::vector<SearchOptions::Filter>& filters)
return; return;
popupListBox->Clear(); popupListBox->Clear();
for (const SearchOptions::Filter& item : filters) for (const FoundOption& item : filters)
popupListBox->Append(item.label); popupListBox->Append(item.label);
} }
@ -318,4 +347,6 @@ void SearchCtrl::OnLeftUpInTextCtrl(wxEvent &event)
event.Skip(); event.Skip();
} }
}} // namespace Slic3r::GUI }
} // namespace Slic3r::GUI

View file

@ -2,11 +2,10 @@
#define slic3r_SearchComboBox_hpp_ #define slic3r_SearchComboBox_hpp_
#include <vector> #include <vector>
#include <map>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/sizer.h> #include <wx/sizer.h>
//#include <wx/bmpcbox.h>
#include <wx/popupwin.h>
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/combo.h> #include <wx/combo.h>
@ -17,72 +16,98 @@
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace Search{
struct SearchInput struct InputInfo
{ {
DynamicPrintConfig* config {nullptr}; DynamicPrintConfig* config {nullptr};
Preset::Type type {Preset::TYPE_INVALID}; Preset::Type type {Preset::TYPE_INVALID};
ConfigOptionMode mode {comSimple}; ConfigOptionMode mode {comSimple};
}; };
class SearchOptions struct GroupAndCategory {
wxString group;
wxString category;
};
// fuzzy_match flag
enum FMFlag
{
fmUndef = 0, // didn't find
fmOptKey,
fmLabel,
fmLabelLocal,
fmGroup,
fmGroupLocal,
fmCategory,
fmCategoryLocal
};
struct Option {
bool operator<(const Option& other) const { return other.label > this->label; }
bool operator>(const Option& other) const { return other.label < this->label; }
std::string opt_key;
Preset::Type type {Preset::TYPE_INVALID};
wxString label;
wxString label_local;
wxString group;
wxString group_local;
wxString category;
wxString category_local;
FMFlag fuzzy_match_simple(char const *search_pattern) const;
FMFlag fuzzy_match_simple(const wxString& search) const;
FMFlag fuzzy_match_simple(const std::string &search) const;
FMFlag fuzzy_match(char const *search_pattern, int &outScore) const;
FMFlag fuzzy_match(const wxString &search, int &outScore) const ;
FMFlag fuzzy_match(const std::string &search, int &outScore) const ;
};
struct FoundOption {
wxString label;
wxString marked_label;
size_t option_idx {0};
int outScore {0};
void get_label(const char** out_text) const;
void get_marked_label(const char** out_text) const;
};
class OptionsSearcher
{ {
std::string search_line; std::string search_line;
public: std::map<std::string, GroupAndCategory> groups_and_categories;
struct Option {
bool operator<(const Option& other) const { return other.label > this->label; }
bool operator>(const Option& other) const { return other.label < this->label; }
wxString label; std::vector<Option> options {};
std::string opt_key; std::vector<FoundOption> found {};
wxString category;
Preset::Type type {Preset::TYPE_INVALID};
// wxString grope;
bool fuzzy_match_simple(char const *search_pattern) const;
bool fuzzy_match_simple(const wxString& search) const;
bool fuzzy_match_simple(const std::string &search) const;
bool fuzzy_match(char const *search_pattern, int &outScore);
bool fuzzy_match(const wxString &search, int &outScore);
bool fuzzy_match(const std::string &search, int &outScore);
};
std::vector<Option> options {};
struct Filter {
wxString label;
wxString marked_label;
size_t option_idx {0};
int outScore {0};
void get_label(const char** out_text) const;
void get_marked_label(const char** out_text) const;
};
std::vector<Filter> filters {};
void clear_options() { options.clear(); }
void clear_filters() { filters.clear(); }
void init(std::vector<SearchInput> input_values);
void append_options(DynamicPrintConfig* config, Preset::Type type, ConfigOptionMode mode); void append_options(DynamicPrintConfig* config, Preset::Type type, ConfigOptionMode mode);
bool apply_filters(const std::string& search, bool force = false);
void sort_options() { void sort_options() {
std::sort(options.begin(), options.end(), [](const Option& o1, const Option& o2) { std::sort(options.begin(), options.end(), [](const Option& o1, const Option& o2) {
return o1.label < o2.label; }); return o1.label < o2.label; });
} }
void sort_filters() { void sort_found() {
std::sort(filters.begin(), filters.end(), [](const Filter& f1, const Filter& f2) { std::sort(found.begin(), found.end(), [](const FoundOption& f1, const FoundOption& f2) {
return f1.outScore > f2.outScore; }); return f1.outScore > f2.outScore; });
}; };
size_t options_size() const { return options.size(); } size_t options_size() const { return options.size(); }
size_t filters_size() const { return filters.size(); } size_t found_size() const { return found.size(); }
size_t size() const { return filters_size(); }
const Filter& operator[](const size_t pos) const noexcept { return filters[pos]; } public:
void init(std::vector<InputInfo> input_values);
bool search(const std::string& search, bool force = false);
void add_key(const std::string& opt_key, const wxString& group, const wxString& category);
size_t size() const { return found_size(); }
const FoundOption& operator[](const size_t pos) const noexcept { return found[pos]; }
const Option& get_option(size_t pos_in_filter) const; const Option& get_option(size_t pos_in_filter) const;
const std::vector<FoundOption>& found_options() { return found; }
}; };
@ -146,7 +171,7 @@ class SearchCtrl : public wxComboCtrl
{ {
SearchComboPopup* popupListBox {nullptr}; SearchComboPopup* popupListBox {nullptr};
bool prevent_update{ false }; bool prevent_update { false };
wxString default_string; wxString default_string;
bool editing {false}; bool editing {false};
@ -163,10 +188,10 @@ public:
void set_search_line(const std::string& search_line); void set_search_line(const std::string& search_line);
void msw_rescale(); void msw_rescale();
void update_list(std::vector<SearchOptions::Filter>& filters); void update_list(const std::vector<FoundOption>& filters);
}; };
} // Search namespace
}} }
#endif //slic3r_SearchComboBox_hpp_ #endif //slic3r_SearchComboBox_hpp_

View file

@ -145,7 +145,7 @@ void Tab::create_preset_tab()
m_presets_choice = new PresetBitmapComboBox(panel, wxSize(35 * m_em_unit, -1)); m_presets_choice = new PresetBitmapComboBox(panel, wxSize(35 * m_em_unit, -1));
// search combox // search combox
m_search = new SearchCtrl(panel); m_search = new Search::SearchCtrl(panel);
auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
@ -424,7 +424,7 @@ void Tab::update_labels_colour()
auto title = m_treectrl->GetItemText(cur_item); auto title = m_treectrl->GetItemText(cur_item);
for (auto page : m_pages) for (auto page : m_pages)
{ {
if (page->title() != title) if (_(page->title()) != title)
continue; continue;
const wxColor *clr = !page->m_is_nonsys_values ? &m_sys_label_clr : const wxColor *clr = !page->m_is_nonsys_values ? &m_sys_label_clr :
@ -623,17 +623,17 @@ void Tab::update_changed_tree_ui()
auto title = m_treectrl->GetItemText(cur_item); auto title = m_treectrl->GetItemText(cur_item);
for (auto page : m_pages) for (auto page : m_pages)
{ {
if (page->title() != title) if (_(page->title()) != title)
continue; continue;
bool sys_page = true; bool sys_page = true;
bool modified_page = false; bool modified_page = false;
if (title == _("General")) { if (page->title() == "General") {
std::initializer_list<const char*> optional_keys{ "extruders_count", "bed_shape" }; std::initializer_list<const char*> optional_keys{ "extruders_count", "bed_shape" };
for (auto &opt_key : optional_keys) { for (auto &opt_key : optional_keys) {
get_sys_and_mod_flags(opt_key, sys_page, modified_page); get_sys_and_mod_flags(opt_key, sys_page, modified_page);
} }
} }
if (title == _("Dependencies")) { if (page->title() == "Dependencies") {
if (m_type == Slic3r::Preset::TYPE_PRINTER) { if (m_type == Slic3r::Preset::TYPE_PRINTER) {
sys_page = m_presets->get_selected_preset_parent() != nullptr; sys_page = m_presets->get_selected_preset_parent() != nullptr;
modified_page = false; modified_page = false;
@ -700,20 +700,20 @@ void Tab::on_roll_back_value(const bool to_sys /*= true*/)
auto selection = m_treectrl->GetItemText(m_treectrl->GetSelection()); auto selection = m_treectrl->GetItemText(m_treectrl->GetSelection());
for (auto page : m_pages) for (auto page : m_pages)
if (page->title() == selection) { if (_(page->title()) == selection) {
for (auto group : page->m_optgroups) { for (auto group : page->m_optgroups) {
if (group->title == _("Capabilities")) { if (group->title == "Capabilities") {
if ((m_options_list["extruders_count"] & os) == 0) if ((m_options_list["extruders_count"] & os) == 0)
to_sys ? group->back_to_sys_value("extruders_count") : group->back_to_initial_value("extruders_count"); to_sys ? group->back_to_sys_value("extruders_count") : group->back_to_initial_value("extruders_count");
} }
if (group->title == _("Size and coordinates")) { if (group->title == "Size and coordinates") {
if ((m_options_list["bed_shape"] & os) == 0) { if ((m_options_list["bed_shape"] & os) == 0) {
to_sys ? group->back_to_sys_value("bed_shape") : group->back_to_initial_value("bed_shape"); to_sys ? group->back_to_sys_value("bed_shape") : group->back_to_initial_value("bed_shape");
load_key_value("bed_shape", true/*some value*/, true); load_key_value("bed_shape", true/*some value*/, true);
} }
} }
if (group->title == _("Profile dependencies")) { if (group->title == "Profile dependencies") {
// "compatible_printers" option doesn't exists in Printer Settimgs Tab // "compatible_printers" option doesn't exists in Printer Settimgs Tab
if (m_type != Preset::TYPE_PRINTER && (m_options_list["compatible_printers"] & os) == 0) { if (m_type != Preset::TYPE_PRINTER && (m_options_list["compatible_printers"] & os) == 0) {
to_sys ? group->back_to_sys_value("compatible_printers") : group->back_to_initial_value("compatible_printers"); to_sys ? group->back_to_sys_value("compatible_printers") : group->back_to_initial_value("compatible_printers");
@ -1003,7 +1003,7 @@ void Tab::activate_option(const std::string& opt_key, const wxString& category)
while (cur_item) { while (cur_item) {
auto title = m_treectrl->GetItemText(cur_item); auto title = m_treectrl->GetItemText(cur_item);
if (page_title != title) { if (_(page_title) != title) {
cur_item = m_treectrl->GetNextVisible(cur_item); cur_item = m_treectrl->GetNextVisible(cur_item);
continue; continue;
} }
@ -1028,6 +1028,12 @@ void Tab::activate_option(const std::string& opt_key, const wxString& category)
m_highlighting_timer.Start(100, false); m_highlighting_timer.Start(100, false);
m_highlighter.init(field); m_highlighter.init(field);
} }
else
{
// "bed_shape", "bed_custom_texture", "bed_custom_model"
}
} }
@ -1210,12 +1216,12 @@ void TabPrint::build()
m_presets = &m_preset_bundle->prints; m_presets = &m_preset_bundle->prints;
load_initial_data(); load_initial_data();
auto page = add_options_page(_(L("Layers and perimeters")), "layers"); auto page = add_options_page(L("Layers and perimeters"), "layers");
auto optgroup = page->new_optgroup(_(L("Layer height"))); auto optgroup = page->new_optgroup(L("Layer height"));
optgroup->append_single_option_line("layer_height"); optgroup->append_single_option_line("layer_height");
optgroup->append_single_option_line("first_layer_height"); optgroup->append_single_option_line("first_layer_height");
optgroup = page->new_optgroup(_(L("Vertical shells"))); optgroup = page->new_optgroup(L("Vertical shells"));
optgroup->append_single_option_line("perimeters"); optgroup->append_single_option_line("perimeters");
optgroup->append_single_option_line("spiral_vase"); optgroup->append_single_option_line("spiral_vase");
@ -1226,12 +1232,12 @@ void TabPrint::build()
}; };
optgroup->append_line(line); optgroup->append_line(line);
optgroup = page->new_optgroup(_(L("Horizontal shells"))); optgroup = page->new_optgroup(L("Horizontal shells"));
line = { _(L("Solid layers")), "" }; line = { L("Solid layers"), "" };
line.append_option(optgroup->get_option("top_solid_layers")); line.append_option(optgroup->get_option("top_solid_layers"));
line.append_option(optgroup->get_option("bottom_solid_layers")); line.append_option(optgroup->get_option("bottom_solid_layers"));
optgroup->append_line(line); optgroup->append_line(line);
line = { _(L("Minimum shell thickness")), "" }; line = { L("Minimum shell thickness"), "" };
line.append_option(optgroup->get_option("top_solid_min_thickness")); line.append_option(optgroup->get_option("top_solid_min_thickness"));
line.append_option(optgroup->get_option("bottom_solid_min_thickness")); line.append_option(optgroup->get_option("bottom_solid_min_thickness"));
optgroup->append_line(line); optgroup->append_line(line);
@ -1242,29 +1248,29 @@ void TabPrint::build()
}; };
optgroup->append_line(line); optgroup->append_line(line);
optgroup = page->new_optgroup(_(L("Quality (slower slicing)"))); optgroup = page->new_optgroup(L("Quality (slower slicing)"));
optgroup->append_single_option_line("extra_perimeters"); optgroup->append_single_option_line("extra_perimeters");
optgroup->append_single_option_line("ensure_vertical_shell_thickness"); optgroup->append_single_option_line("ensure_vertical_shell_thickness");
optgroup->append_single_option_line("avoid_crossing_perimeters"); optgroup->append_single_option_line("avoid_crossing_perimeters");
optgroup->append_single_option_line("thin_walls"); optgroup->append_single_option_line("thin_walls");
optgroup->append_single_option_line("overhangs"); optgroup->append_single_option_line("overhangs");
optgroup = page->new_optgroup(_(L("Advanced"))); optgroup = page->new_optgroup(L("Advanced"));
optgroup->append_single_option_line("seam_position"); optgroup->append_single_option_line("seam_position");
optgroup->append_single_option_line("external_perimeters_first"); optgroup->append_single_option_line("external_perimeters_first");
page = add_options_page(_(L("Infill")), "infill"); page = add_options_page(L("Infill"), "infill");
optgroup = page->new_optgroup(_(L("Infill"))); optgroup = page->new_optgroup(L("Infill"));
optgroup->append_single_option_line("fill_density"); optgroup->append_single_option_line("fill_density");
optgroup->append_single_option_line("fill_pattern"); optgroup->append_single_option_line("fill_pattern");
optgroup->append_single_option_line("top_fill_pattern"); optgroup->append_single_option_line("top_fill_pattern");
optgroup->append_single_option_line("bottom_fill_pattern"); optgroup->append_single_option_line("bottom_fill_pattern");
optgroup = page->new_optgroup(_(L("Reducing printing time"))); optgroup = page->new_optgroup(L("Reducing printing time"));
optgroup->append_single_option_line("infill_every_layers"); optgroup->append_single_option_line("infill_every_layers");
optgroup->append_single_option_line("infill_only_where_needed"); optgroup->append_single_option_line("infill_only_where_needed");
optgroup = page->new_optgroup(_(L("Advanced"))); optgroup = page->new_optgroup(L("Advanced"));
optgroup->append_single_option_line("solid_infill_every_layers"); optgroup->append_single_option_line("solid_infill_every_layers");
optgroup->append_single_option_line("fill_angle"); optgroup->append_single_option_line("fill_angle");
optgroup->append_single_option_line("solid_infill_below_area"); optgroup->append_single_option_line("solid_infill_below_area");
@ -1272,29 +1278,29 @@ void TabPrint::build()
optgroup->append_single_option_line("only_retract_when_crossing_perimeters"); optgroup->append_single_option_line("only_retract_when_crossing_perimeters");
optgroup->append_single_option_line("infill_first"); optgroup->append_single_option_line("infill_first");
page = add_options_page(_(L("Skirt and brim")), "skirt+brim"); page = add_options_page(L("Skirt and brim"), "skirt+brim");
optgroup = page->new_optgroup(_(L("Skirt"))); optgroup = page->new_optgroup(L("Skirt"));
optgroup->append_single_option_line("skirts"); optgroup->append_single_option_line("skirts");
optgroup->append_single_option_line("skirt_distance"); optgroup->append_single_option_line("skirt_distance");
optgroup->append_single_option_line("skirt_height"); optgroup->append_single_option_line("skirt_height");
optgroup->append_single_option_line("draft_shield"); optgroup->append_single_option_line("draft_shield");
optgroup->append_single_option_line("min_skirt_length"); optgroup->append_single_option_line("min_skirt_length");
optgroup = page->new_optgroup(_(L("Brim"))); optgroup = page->new_optgroup(L("Brim"));
optgroup->append_single_option_line("brim_width"); optgroup->append_single_option_line("brim_width");
page = add_options_page(_(L("Support material")), "support"); page = add_options_page(L("Support material"), "support");
optgroup = page->new_optgroup(_(L("Support material"))); optgroup = page->new_optgroup(L("Support material"));
optgroup->append_single_option_line("support_material"); optgroup->append_single_option_line("support_material");
optgroup->append_single_option_line("support_material_auto"); optgroup->append_single_option_line("support_material_auto");
optgroup->append_single_option_line("support_material_threshold"); optgroup->append_single_option_line("support_material_threshold");
optgroup->append_single_option_line("support_material_enforce_layers"); optgroup->append_single_option_line("support_material_enforce_layers");
optgroup = page->new_optgroup(_(L("Raft"))); optgroup = page->new_optgroup(L("Raft"));
optgroup->append_single_option_line("raft_layers"); optgroup->append_single_option_line("raft_layers");
// # optgroup->append_single_option_line(get_option_("raft_contact_distance"); // # optgroup->append_single_option_line(get_option_("raft_contact_distance");
optgroup = page->new_optgroup(_(L("Options for support material and raft"))); optgroup = page->new_optgroup(L("Options for support material and raft"));
optgroup->append_single_option_line("support_material_contact_distance"); optgroup->append_single_option_line("support_material_contact_distance");
optgroup->append_single_option_line("support_material_pattern"); optgroup->append_single_option_line("support_material_pattern");
optgroup->append_single_option_line("support_material_with_sheath"); optgroup->append_single_option_line("support_material_with_sheath");
@ -1308,8 +1314,8 @@ void TabPrint::build()
optgroup->append_single_option_line("dont_support_bridges"); optgroup->append_single_option_line("dont_support_bridges");
optgroup->append_single_option_line("support_material_synchronize_layers"); optgroup->append_single_option_line("support_material_synchronize_layers");
page = add_options_page(_(L("Speed")), "time"); page = add_options_page(L("Speed"), "time");
optgroup = page->new_optgroup(_(L("Speed for print moves"))); optgroup = page->new_optgroup(L("Speed for print moves"));
optgroup->append_single_option_line("perimeter_speed"); optgroup->append_single_option_line("perimeter_speed");
optgroup->append_single_option_line("small_perimeter_speed"); optgroup->append_single_option_line("small_perimeter_speed");
optgroup->append_single_option_line("external_perimeter_speed"); optgroup->append_single_option_line("external_perimeter_speed");
@ -1321,20 +1327,20 @@ void TabPrint::build()
optgroup->append_single_option_line("bridge_speed"); optgroup->append_single_option_line("bridge_speed");
optgroup->append_single_option_line("gap_fill_speed"); optgroup->append_single_option_line("gap_fill_speed");
optgroup = page->new_optgroup(_(L("Speed for non-print moves"))); optgroup = page->new_optgroup(L("Speed for non-print moves"));
optgroup->append_single_option_line("travel_speed"); optgroup->append_single_option_line("travel_speed");
optgroup = page->new_optgroup(_(L("Modifiers"))); optgroup = page->new_optgroup(L("Modifiers"));
optgroup->append_single_option_line("first_layer_speed"); optgroup->append_single_option_line("first_layer_speed");
optgroup = page->new_optgroup(_(L("Acceleration control (advanced)"))); optgroup = page->new_optgroup(L("Acceleration control (advanced)"));
optgroup->append_single_option_line("perimeter_acceleration"); optgroup->append_single_option_line("perimeter_acceleration");
optgroup->append_single_option_line("infill_acceleration"); optgroup->append_single_option_line("infill_acceleration");
optgroup->append_single_option_line("bridge_acceleration"); optgroup->append_single_option_line("bridge_acceleration");
optgroup->append_single_option_line("first_layer_acceleration"); optgroup->append_single_option_line("first_layer_acceleration");
optgroup->append_single_option_line("default_acceleration"); optgroup->append_single_option_line("default_acceleration");
optgroup = page->new_optgroup(_(L("Autospeed (advanced)"))); optgroup = page->new_optgroup(L("Autospeed (advanced)"));
optgroup->append_single_option_line("max_print_speed"); optgroup->append_single_option_line("max_print_speed");
optgroup->append_single_option_line("max_volumetric_speed"); optgroup->append_single_option_line("max_volumetric_speed");
#ifdef HAS_PRESSURE_EQUALIZER #ifdef HAS_PRESSURE_EQUALIZER
@ -1342,19 +1348,19 @@ void TabPrint::build()
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_negative"); optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_negative");
#endif /* HAS_PRESSURE_EQUALIZER */ #endif /* HAS_PRESSURE_EQUALIZER */
page = add_options_page(_(L("Multiple Extruders")), "funnel"); page = add_options_page(L("Multiple Extruders"), "funnel");
optgroup = page->new_optgroup(_(L("Extruders"))); optgroup = page->new_optgroup(L("Extruders"));
optgroup->append_single_option_line("perimeter_extruder"); optgroup->append_single_option_line("perimeter_extruder");
optgroup->append_single_option_line("infill_extruder"); optgroup->append_single_option_line("infill_extruder");
optgroup->append_single_option_line("solid_infill_extruder"); optgroup->append_single_option_line("solid_infill_extruder");
optgroup->append_single_option_line("support_material_extruder"); optgroup->append_single_option_line("support_material_extruder");
optgroup->append_single_option_line("support_material_interface_extruder"); optgroup->append_single_option_line("support_material_interface_extruder");
optgroup = page->new_optgroup(_(L("Ooze prevention"))); optgroup = page->new_optgroup(L("Ooze prevention"));
optgroup->append_single_option_line("ooze_prevention"); optgroup->append_single_option_line("ooze_prevention");
optgroup->append_single_option_line("standby_temperature_delta"); optgroup->append_single_option_line("standby_temperature_delta");
optgroup = page->new_optgroup(_(L("Wipe tower"))); optgroup = page->new_optgroup(L("Wipe tower"));
optgroup->append_single_option_line("wipe_tower"); optgroup->append_single_option_line("wipe_tower");
optgroup->append_single_option_line("wipe_tower_x"); optgroup->append_single_option_line("wipe_tower_x");
optgroup->append_single_option_line("wipe_tower_y"); optgroup->append_single_option_line("wipe_tower_y");
@ -1364,11 +1370,11 @@ void TabPrint::build()
optgroup->append_single_option_line("wipe_tower_no_sparse_layers"); optgroup->append_single_option_line("wipe_tower_no_sparse_layers");
optgroup->append_single_option_line("single_extruder_multi_material_priming"); optgroup->append_single_option_line("single_extruder_multi_material_priming");
optgroup = page->new_optgroup(_(L("Advanced"))); optgroup = page->new_optgroup(L("Advanced"));
optgroup->append_single_option_line("interface_shells"); optgroup->append_single_option_line("interface_shells");
page = add_options_page(_(L("Advanced")), "wrench"); page = add_options_page(L("Advanced"), "wrench");
optgroup = page->new_optgroup(_(L("Extrusion width"))); optgroup = page->new_optgroup(L("Extrusion width"));
optgroup->append_single_option_line("extrusion_width"); optgroup->append_single_option_line("extrusion_width");
optgroup->append_single_option_line("first_layer_extrusion_width"); optgroup->append_single_option_line("first_layer_extrusion_width");
optgroup->append_single_option_line("perimeter_extrusion_width"); optgroup->append_single_option_line("perimeter_extrusion_width");
@ -1378,51 +1384,51 @@ void TabPrint::build()
optgroup->append_single_option_line("top_infill_extrusion_width"); optgroup->append_single_option_line("top_infill_extrusion_width");
optgroup->append_single_option_line("support_material_extrusion_width"); optgroup->append_single_option_line("support_material_extrusion_width");
optgroup = page->new_optgroup(_(L("Overlap"))); optgroup = page->new_optgroup(L("Overlap"));
optgroup->append_single_option_line("infill_overlap"); optgroup->append_single_option_line("infill_overlap");
optgroup = page->new_optgroup(_(L("Flow"))); optgroup = page->new_optgroup(L("Flow"));
optgroup->append_single_option_line("bridge_flow_ratio"); optgroup->append_single_option_line("bridge_flow_ratio");
optgroup = page->new_optgroup(_(L("Slicing"))); optgroup = page->new_optgroup(L("Slicing"));
optgroup->append_single_option_line("slice_closing_radius"); optgroup->append_single_option_line("slice_closing_radius");
optgroup->append_single_option_line("resolution"); optgroup->append_single_option_line("resolution");
optgroup->append_single_option_line("xy_size_compensation"); optgroup->append_single_option_line("xy_size_compensation");
optgroup->append_single_option_line("elefant_foot_compensation"); optgroup->append_single_option_line("elefant_foot_compensation");
optgroup = page->new_optgroup(_(L("Other"))); optgroup = page->new_optgroup(L("Other"));
optgroup->append_single_option_line("clip_multipart_objects"); optgroup->append_single_option_line("clip_multipart_objects");
page = add_options_page(_(L("Output options")), "output+page_white"); page = add_options_page(L("Output options"), "output+page_white");
optgroup = page->new_optgroup(_(L("Sequential printing"))); optgroup = page->new_optgroup(L("Sequential printing"));
optgroup->append_single_option_line("complete_objects"); optgroup->append_single_option_line("complete_objects");
line = { _(L("Extruder clearance (mm)")), "" }; line = { L("Extruder clearance (mm)"), "" };
line.append_option(optgroup->get_option("extruder_clearance_radius")); line.append_option(optgroup->get_option("extruder_clearance_radius"));
line.append_option(optgroup->get_option("extruder_clearance_height")); line.append_option(optgroup->get_option("extruder_clearance_height"));
optgroup->append_line(line); optgroup->append_line(line);
optgroup = page->new_optgroup(_(L("Output file"))); optgroup = page->new_optgroup(L("Output file"));
optgroup->append_single_option_line("gcode_comments"); optgroup->append_single_option_line("gcode_comments");
optgroup->append_single_option_line("gcode_label_objects"); optgroup->append_single_option_line("gcode_label_objects");
Option option = optgroup->get_option("output_filename_format"); Option option = optgroup->get_option("output_filename_format");
option.opt.full_width = true; option.opt.full_width = true;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(_(L("Post-processing scripts")), 0); optgroup = page->new_optgroup(L("Post-processing scripts"), 0);
option = optgroup->get_option("post_process"); option = optgroup->get_option("post_process");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = 5;//50; option.opt.height = 5;//50;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
page = add_options_page(_(L("Notes")), "note.png"); page = add_options_page(L("Notes"), "note.png");
optgroup = page->new_optgroup(_(L("Notes")), 0); optgroup = page->new_optgroup(L("Notes"), 0);
option = optgroup->get_option("notes"); option = optgroup->get_option("notes");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = 25;//250; option.opt.height = 25;//250;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
page = add_options_page(_(L("Dependencies")), "wrench.png"); page = add_options_page(L("Dependencies"), "wrench.png");
optgroup = page->new_optgroup(_(L("Profile dependencies"))); optgroup = page->new_optgroup(L("Profile dependencies"));
create_line_with_widget(optgroup.get(), "compatible_printers", [this](wxWindow* parent) { create_line_with_widget(optgroup.get(), "compatible_printers", [this](wxWindow* parent) {
return compatible_widget_create(parent, m_compatible_printers); return compatible_widget_create(parent, m_compatible_printers);
@ -1484,8 +1490,8 @@ void TabPrint::OnActivate()
void TabFilament::add_filament_overrides_page() void TabFilament::add_filament_overrides_page()
{ {
PageShp page = add_options_page(_(L("Filament Overrides")), "wrench"); PageShp page = add_options_page(L("Filament Overrides"), "wrench");
ConfigOptionsGroupShp optgroup = page->new_optgroup(_(L("Retraction"))); ConfigOptionsGroupShp optgroup = page->new_optgroup(L("Retraction"));
auto append_single_option_line = [optgroup, this](const std::string& opt_key, int opt_index) auto append_single_option_line = [optgroup, this](const std::string& opt_key, int opt_index)
{ {
@ -1539,12 +1545,12 @@ void TabFilament::add_filament_overrides_page()
void TabFilament::update_filament_overrides_page() void TabFilament::update_filament_overrides_page()
{ {
const auto page_it = std::find_if(m_pages.begin(), m_pages.end(), [](const PageShp page) {return page->title() == _(L("Filament Overrides")); }); const auto page_it = std::find_if(m_pages.begin(), m_pages.end(), [](const PageShp page) { return page->title() == "Filament Overrides"; });
if (page_it == m_pages.end()) if (page_it == m_pages.end())
return; return;
PageShp page = *page_it; PageShp page = *page_it;
const auto og_it = std::find_if(page->m_optgroups.begin(), page->m_optgroups.end(), [](const ConfigOptionsGroupShp og) {return og->title == _(L("Retraction")); }); const auto og_it = std::find_if(page->m_optgroups.begin(), page->m_optgroups.end(), [](const ConfigOptionsGroupShp og) { return og->title == "Retraction"; });
if (og_it == page->m_optgroups.end()) if (og_it == page->m_optgroups.end())
return; return;
ConfigOptionsGroupShp optgroup = *og_it; ConfigOptionsGroupShp optgroup = *og_it;
@ -1586,27 +1592,28 @@ void TabFilament::build()
m_presets = &m_preset_bundle->filaments; m_presets = &m_preset_bundle->filaments;
load_initial_data(); load_initial_data();
auto page = add_options_page(_(L("Filament")), "spool.png"); auto page = add_options_page(L("Filament"), "spool.png");
auto optgroup = page->new_optgroup(_(L("Filament"))); auto optgroup = page->new_optgroup(L("Filament"));
optgroup->append_single_option_line("filament_colour"); optgroup->append_single_option_line("filament_colour");
optgroup->append_single_option_line("filament_diameter"); optgroup->append_single_option_line("filament_diameter");
optgroup->append_single_option_line("extrusion_multiplier"); optgroup->append_single_option_line("extrusion_multiplier");
optgroup->append_single_option_line("filament_density"); optgroup->append_single_option_line("filament_density");
optgroup->append_single_option_line("filament_cost"); optgroup->append_single_option_line("filament_cost");
optgroup = page->new_optgroup(_(L("Temperature")) + wxString(" °C", wxConvUTF8)); // optgroup = page->new_optgroup(_(L("Temperature")) + wxString(" °C", wxConvUTF8));
Line line = { _(L("Extruder")), "" }; optgroup = page->new_optgroup(L("Temperature"));
Line line = { L("Extruder"), "" };
line.append_option(optgroup->get_option("first_layer_temperature")); line.append_option(optgroup->get_option("first_layer_temperature"));
line.append_option(optgroup->get_option("temperature")); line.append_option(optgroup->get_option("temperature"));
optgroup->append_line(line); optgroup->append_line(line);
line = { _(L("Bed")), "" }; line = { L("Bed"), "" };
line.append_option(optgroup->get_option("first_layer_bed_temperature")); line.append_option(optgroup->get_option("first_layer_bed_temperature"));
line.append_option(optgroup->get_option("bed_temperature")); line.append_option(optgroup->get_option("bed_temperature"));
optgroup->append_line(line); optgroup->append_line(line);
page = add_options_page(_(L("Cooling")), "cooling"); page = add_options_page(L("Cooling"), "cooling");
optgroup = page->new_optgroup(_(L("Enable"))); optgroup = page->new_optgroup(L("Enable"));
optgroup->append_single_option_line("fan_always_on"); optgroup->append_single_option_line("fan_always_on");
optgroup->append_single_option_line("cooling"); optgroup->append_single_option_line("cooling");
@ -1617,8 +1624,8 @@ void TabFilament::build()
}; };
optgroup->append_line(line); optgroup->append_line(line);
optgroup = page->new_optgroup(_(L("Fan settings"))); optgroup = page->new_optgroup(L("Fan settings"));
line = { _(L("Fan speed")), "" }; line = { L("Fan speed"), "" };
line.append_option(optgroup->get_option("min_fan_speed")); line.append_option(optgroup->get_option("min_fan_speed"));
line.append_option(optgroup->get_option("max_fan_speed")); line.append_option(optgroup->get_option("max_fan_speed"));
optgroup->append_line(line); optgroup->append_line(line);
@ -1626,20 +1633,20 @@ void TabFilament::build()
optgroup->append_single_option_line("bridge_fan_speed"); optgroup->append_single_option_line("bridge_fan_speed");
optgroup->append_single_option_line("disable_fan_first_layers"); optgroup->append_single_option_line("disable_fan_first_layers");
optgroup = page->new_optgroup(_(L("Cooling thresholds")), 25); optgroup = page->new_optgroup(L("Cooling thresholds"), 25);
optgroup->append_single_option_line("fan_below_layer_time"); optgroup->append_single_option_line("fan_below_layer_time");
optgroup->append_single_option_line("slowdown_below_layer_time"); optgroup->append_single_option_line("slowdown_below_layer_time");
optgroup->append_single_option_line("min_print_speed"); optgroup->append_single_option_line("min_print_speed");
page = add_options_page(_(L("Advanced")), "wrench"); page = add_options_page(L("Advanced"), "wrench");
optgroup = page->new_optgroup(_(L("Filament properties"))); optgroup = page->new_optgroup(L("Filament properties"));
// Set size as all another fields for a better alignment // Set size as all another fields for a better alignment
Option option = optgroup->get_option("filament_type"); Option option = optgroup->get_option("filament_type");
option.opt.width = Field::def_width(); option.opt.width = Field::def_width();
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
optgroup->append_single_option_line("filament_soluble"); optgroup->append_single_option_line("filament_soluble");
optgroup = page->new_optgroup(_(L("Print speed override"))); optgroup = page->new_optgroup(L("Print speed override"));
optgroup->append_single_option_line("filament_max_volumetric_speed"); optgroup->append_single_option_line("filament_max_volumetric_speed");
line = { "", "" }; line = { "", "" };
@ -1649,10 +1656,10 @@ void TabFilament::build()
}; };
optgroup->append_line(line); optgroup->append_line(line);
optgroup = page->new_optgroup(_(L("Wipe tower parameters"))); optgroup = page->new_optgroup(L("Wipe tower parameters"));
optgroup->append_single_option_line("filament_minimal_purge_on_wipe_tower"); optgroup->append_single_option_line("filament_minimal_purge_on_wipe_tower");
optgroup = page->new_optgroup(_(L("Toolchange parameters with single extruder MM printers"))); optgroup = page->new_optgroup(L("Toolchange parameters with single extruder MM printers"));
optgroup->append_single_option_line("filament_loading_speed_start"); optgroup->append_single_option_line("filament_loading_speed_start");
optgroup->append_single_option_line("filament_loading_speed"); optgroup->append_single_option_line("filament_loading_speed");
optgroup->append_single_option_line("filament_unloading_speed_start"); optgroup->append_single_option_line("filament_unloading_speed_start");
@ -1688,29 +1695,29 @@ void TabFilament::build()
const int gcode_field_height = 15; // 150 const int gcode_field_height = 15; // 150
const int notes_field_height = 25; // 250 const int notes_field_height = 25; // 250
page = add_options_page(_(L("Custom G-code")), "cog"); page = add_options_page(L("Custom G-code"), "cog");
optgroup = page->new_optgroup(_(L("Start G-code")), 0); optgroup = page->new_optgroup(L("Start G-code"), 0);
option = optgroup->get_option("start_filament_gcode"); option = optgroup->get_option("start_filament_gcode");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = gcode_field_height;// 150; option.opt.height = gcode_field_height;// 150;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(_(L("End G-code")), 0); optgroup = page->new_optgroup(L("End G-code"), 0);
option = optgroup->get_option("end_filament_gcode"); option = optgroup->get_option("end_filament_gcode");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = gcode_field_height;// 150; option.opt.height = gcode_field_height;// 150;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
page = add_options_page(_(L("Notes")), "note.png"); page = add_options_page(L("Notes"), "note.png");
optgroup = page->new_optgroup(_(L("Notes")), 0); optgroup = page->new_optgroup(L("Notes"), 0);
optgroup->label_width = 0; optgroup->label_width = 0;
option = optgroup->get_option("filament_notes"); option = optgroup->get_option("filament_notes");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = notes_field_height;// 250; option.opt.height = notes_field_height;// 250;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
page = add_options_page(_(L("Dependencies")), "wrench.png"); page = add_options_page(L("Dependencies"), "wrench.png");
optgroup = page->new_optgroup(_(L("Profile dependencies"))); optgroup = page->new_optgroup(L("Profile dependencies"));
create_line_with_widget(optgroup.get(), "compatible_printers", [this](wxWindow* parent) { create_line_with_widget(optgroup.get(), "compatible_printers", [this](wxWindow* parent) {
return compatible_widget_create(parent, m_compatible_printers); return compatible_widget_create(parent, m_compatible_printers);
}); });
@ -1952,8 +1959,8 @@ void TabPrinter::build_fff()
m_sys_extruders_count = parent_preset == nullptr ? 0 : m_sys_extruders_count = parent_preset == nullptr ? 0 :
static_cast<const ConfigOptionFloats*>(parent_preset->config.option("nozzle_diameter"))->values.size(); static_cast<const ConfigOptionFloats*>(parent_preset->config.option("nozzle_diameter"))->values.size();
auto page = add_options_page(_(L("General")), "printer"); auto page = add_options_page(L("General"), "printer");
auto optgroup = page->new_optgroup(_(L("Size and coordinates"))); auto optgroup = page->new_optgroup(L("Size and coordinates"));
create_line_with_widget(optgroup.get(), "bed_shape", [this](wxWindow* parent) { create_line_with_widget(optgroup.get(), "bed_shape", [this](wxWindow* parent) {
return create_bed_shape_widget(parent); return create_bed_shape_widget(parent);
@ -1962,7 +1969,7 @@ void TabPrinter::build_fff()
optgroup->append_single_option_line("max_print_height"); optgroup->append_single_option_line("max_print_height");
optgroup->append_single_option_line("z_offset"); optgroup->append_single_option_line("z_offset");
optgroup = page->new_optgroup(_(L("Capabilities"))); optgroup = page->new_optgroup(L("Capabilities"));
ConfigOptionDef def; ConfigOptionDef def;
def.type = coInt, def.type = coInt,
def.set_default_value(new ConfigOptionInt(1)); def.set_default_value(new ConfigOptionInt(1));
@ -2072,10 +2079,10 @@ void TabPrinter::build_fff()
} }
#endif #endif
optgroup = page->new_optgroup(_(L("Print Host upload"))); optgroup = page->new_optgroup(L("Print Host upload"));
build_printhost(optgroup.get()); build_printhost(optgroup.get());
optgroup = page->new_optgroup(_(L("Firmware"))); optgroup = page->new_optgroup(L("Firmware"));
optgroup->append_single_option_line("gcode_flavor"); optgroup->append_single_option_line("gcode_flavor");
optgroup->append_single_option_line("silent_mode"); optgroup->append_single_option_line("silent_mode");
optgroup->append_single_option_line("remaining_times"); optgroup->append_single_option_line("remaining_times");
@ -2095,7 +2102,7 @@ void TabPrinter::build_fff()
}); });
}; };
optgroup = page->new_optgroup(_(L("Advanced"))); optgroup = page->new_optgroup(L("Advanced"));
optgroup->append_single_option_line("use_relative_e_distances"); optgroup->append_single_option_line("use_relative_e_distances");
optgroup->append_single_option_line("use_firmware_retraction"); optgroup->append_single_option_line("use_firmware_retraction");
optgroup->append_single_option_line("use_volumetric_e"); optgroup->append_single_option_line("use_volumetric_e");
@ -2103,52 +2110,52 @@ void TabPrinter::build_fff()
const int gcode_field_height = 15; // 150 const int gcode_field_height = 15; // 150
const int notes_field_height = 25; // 250 const int notes_field_height = 25; // 250
page = add_options_page(_(L("Custom G-code")), "cog"); page = add_options_page(L("Custom G-code"), "cog");
optgroup = page->new_optgroup(_(L("Start G-code")), 0); optgroup = page->new_optgroup(L("Start G-code"), 0);
option = optgroup->get_option("start_gcode"); option = optgroup->get_option("start_gcode");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = gcode_field_height;//150; option.opt.height = gcode_field_height;//150;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(_(L("End G-code")), 0); optgroup = page->new_optgroup(L("End G-code"), 0);
option = optgroup->get_option("end_gcode"); option = optgroup->get_option("end_gcode");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = gcode_field_height;//150; option.opt.height = gcode_field_height;//150;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(_(L("Before layer change G-code")), 0); optgroup = page->new_optgroup(L("Before layer change G-code"), 0);
option = optgroup->get_option("before_layer_gcode"); option = optgroup->get_option("before_layer_gcode");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = gcode_field_height;//150; option.opt.height = gcode_field_height;//150;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(_(L("After layer change G-code")), 0); optgroup = page->new_optgroup(L("After layer change G-code"), 0);
option = optgroup->get_option("layer_gcode"); option = optgroup->get_option("layer_gcode");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = gcode_field_height;//150; option.opt.height = gcode_field_height;//150;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(_(L("Tool change G-code")), 0); optgroup = page->new_optgroup(L("Tool change G-code"), 0);
option = optgroup->get_option("toolchange_gcode"); option = optgroup->get_option("toolchange_gcode");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = gcode_field_height;//150; option.opt.height = gcode_field_height;//150;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(_(L("Between objects G-code (for sequential printing)")), 0); optgroup = page->new_optgroup(L("Between objects G-code (for sequential printing)"), 0);
option = optgroup->get_option("between_objects_gcode"); option = optgroup->get_option("between_objects_gcode");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = gcode_field_height;//150; option.opt.height = gcode_field_height;//150;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
page = add_options_page(_(L("Notes")), "note.png"); page = add_options_page(L("Notes"), "note.png");
optgroup = page->new_optgroup(_(L("Notes")), 0); optgroup = page->new_optgroup(L("Notes"), 0);
option = optgroup->get_option("printer_notes"); option = optgroup->get_option("printer_notes");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = notes_field_height;//250; option.opt.height = notes_field_height;//250;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
page = add_options_page(_(L("Dependencies")), "wrench.png"); page = add_options_page(L("Dependencies"), "wrench.png");
optgroup = page->new_optgroup(_(L("Profile dependencies"))); optgroup = page->new_optgroup(L("Profile dependencies"));
build_preset_description_line(optgroup.get()); build_preset_description_line(optgroup.get());
@ -2164,20 +2171,20 @@ void TabPrinter::build_sla()
{ {
if (!m_pages.empty()) if (!m_pages.empty())
m_pages.resize(0); m_pages.resize(0);
auto page = add_options_page(_(L("General")), "printer"); auto page = add_options_page(L("General"), "printer");
auto optgroup = page->new_optgroup(_(L("Size and coordinates"))); auto optgroup = page->new_optgroup(L("Size and coordinates"));
create_line_with_widget(optgroup.get(), "bed_shape", [this](wxWindow* parent) { create_line_with_widget(optgroup.get(), "bed_shape", [this](wxWindow* parent) {
return create_bed_shape_widget(parent); return create_bed_shape_widget(parent);
}); });
optgroup->append_single_option_line("max_print_height"); optgroup->append_single_option_line("max_print_height");
optgroup = page->new_optgroup(_(L("Display"))); optgroup = page->new_optgroup(L("Display"));
optgroup->append_single_option_line("display_width"); optgroup->append_single_option_line("display_width");
optgroup->append_single_option_line("display_height"); optgroup->append_single_option_line("display_height");
auto option = optgroup->get_option("display_pixels_x"); auto option = optgroup->get_option("display_pixels_x");
Line line = { _(option.opt.full_label), "" }; Line line = { option.opt.full_label, "" };
line.append_option(option); line.append_option(option);
line.append_option(optgroup->get_option("display_pixels_y")); line.append_option(optgroup->get_option("display_pixels_y"));
optgroup->append_line(line); optgroup->append_line(line);
@ -2187,15 +2194,15 @@ void TabPrinter::build_sla()
optgroup->append_single_option_line("display_mirror_x"); optgroup->append_single_option_line("display_mirror_x");
optgroup->append_single_option_line("display_mirror_y"); optgroup->append_single_option_line("display_mirror_y");
optgroup = page->new_optgroup(_(L("Tilt"))); optgroup = page->new_optgroup(L("Tilt"));
line = { _(L("Tilt time")), "" }; line = { L("Tilt time"), "" };
line.append_option(optgroup->get_option("fast_tilt_time")); line.append_option(optgroup->get_option("fast_tilt_time"));
line.append_option(optgroup->get_option("slow_tilt_time")); line.append_option(optgroup->get_option("slow_tilt_time"));
optgroup->append_line(line); optgroup->append_line(line);
optgroup->append_single_option_line("area_fill"); optgroup->append_single_option_line("area_fill");
optgroup = page->new_optgroup(_(L("Corrections"))); optgroup = page->new_optgroup(L("Corrections"));
line = Line{ _(m_config->def()->get("relative_correction")->full_label), "" }; line = Line{ m_config->def()->get("relative_correction")->full_label, "" };
// std::vector<std::string> axes{ "X", "Y", "Z" }; // std::vector<std::string> axes{ "X", "Y", "Z" };
std::vector<std::string> axes{ "XY", "Z" }; std::vector<std::string> axes{ "XY", "Z" };
int id = 0; int id = 0;
@ -2211,26 +2218,26 @@ void TabPrinter::build_sla()
optgroup->append_single_option_line("elefant_foot_min_width"); optgroup->append_single_option_line("elefant_foot_min_width");
optgroup->append_single_option_line("gamma_correction"); optgroup->append_single_option_line("gamma_correction");
optgroup = page->new_optgroup(_(L("Exposure"))); optgroup = page->new_optgroup(L("Exposure"));
optgroup->append_single_option_line("min_exposure_time"); optgroup->append_single_option_line("min_exposure_time");
optgroup->append_single_option_line("max_exposure_time"); optgroup->append_single_option_line("max_exposure_time");
optgroup->append_single_option_line("min_initial_exposure_time"); optgroup->append_single_option_line("min_initial_exposure_time");
optgroup->append_single_option_line("max_initial_exposure_time"); optgroup->append_single_option_line("max_initial_exposure_time");
optgroup = page->new_optgroup(_(L("Print Host upload"))); optgroup = page->new_optgroup(L("Print Host upload"));
build_printhost(optgroup.get()); build_printhost(optgroup.get());
const int notes_field_height = 25; // 250 const int notes_field_height = 25; // 250
page = add_options_page(_(L("Notes")), "note.png"); page = add_options_page(L("Notes"), "note.png");
optgroup = page->new_optgroup(_(L("Notes")), 0); optgroup = page->new_optgroup(L("Notes"), 0);
option = optgroup->get_option("printer_notes"); option = optgroup->get_option("printer_notes");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = notes_field_height;//250; option.opt.height = notes_field_height;//250;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
page = add_options_page(_(L("Dependencies")), "wrench.png"); page = add_options_page(L("Dependencies"), "wrench.png");
optgroup = page->new_optgroup(_(L("Profile dependencies"))); optgroup = page->new_optgroup(L("Profile dependencies"));
build_preset_description_line(optgroup.get()); build_preset_description_line(optgroup.get());
} }
@ -2269,7 +2276,7 @@ void TabPrinter::extruders_count_changed(size_t extruders_count)
void TabPrinter::append_option_line(ConfigOptionsGroupShp optgroup, const std::string opt_key) void TabPrinter::append_option_line(ConfigOptionsGroupShp optgroup, const std::string opt_key)
{ {
auto option = optgroup->get_option(opt_key, 0); auto option = optgroup->get_option(opt_key, 0);
auto line = Line{ _(option.opt.full_label), "" }; auto line = Line{ option.opt.full_label, "" };
line.append_option(option); line.append_option(option);
if (m_use_silent_mode) if (m_use_silent_mode)
line.append_option(optgroup->get_option(opt_key, 1)); line.append_option(optgroup->get_option(opt_key, 1));
@ -2278,7 +2285,7 @@ void TabPrinter::append_option_line(ConfigOptionsGroupShp optgroup, const std::s
PageShp TabPrinter::build_kinematics_page() PageShp TabPrinter::build_kinematics_page()
{ {
auto page = add_options_page(_(L("Machine limits")), "cog", true); auto page = add_options_page(L("Machine limits"), "cog", true);
if (m_use_silent_mode) { if (m_use_silent_mode) {
// Legend for OptionsGroups // Legend for OptionsGroups
@ -2307,24 +2314,24 @@ PageShp TabPrinter::build_kinematics_page()
} }
std::vector<std::string> axes{ "x", "y", "z", "e" }; std::vector<std::string> axes{ "x", "y", "z", "e" };
auto optgroup = page->new_optgroup(_(L("Maximum feedrates"))); auto optgroup = page->new_optgroup(L("Maximum feedrates"));
for (const std::string &axis : axes) { for (const std::string &axis : axes) {
append_option_line(optgroup, "machine_max_feedrate_" + axis); append_option_line(optgroup, "machine_max_feedrate_" + axis);
} }
optgroup = page->new_optgroup(_(L("Maximum accelerations"))); optgroup = page->new_optgroup(L("Maximum accelerations"));
for (const std::string &axis : axes) { for (const std::string &axis : axes) {
append_option_line(optgroup, "machine_max_acceleration_" + axis); append_option_line(optgroup, "machine_max_acceleration_" + axis);
} }
append_option_line(optgroup, "machine_max_acceleration_extruding"); append_option_line(optgroup, "machine_max_acceleration_extruding");
append_option_line(optgroup, "machine_max_acceleration_retracting"); append_option_line(optgroup, "machine_max_acceleration_retracting");
optgroup = page->new_optgroup(_(L("Jerk limits"))); optgroup = page->new_optgroup(L("Jerk limits"));
for (const std::string &axis : axes) { for (const std::string &axis : axes) {
append_option_line(optgroup, "machine_max_jerk_" + axis); append_option_line(optgroup, "machine_max_jerk_" + axis);
} }
optgroup = page->new_optgroup(_(L("Minimum feedrates"))); optgroup = page->new_optgroup(L("Minimum feedrates"));
append_option_line(optgroup, "machine_min_extruding_rate"); append_option_line(optgroup, "machine_min_extruding_rate");
append_option_line(optgroup, "machine_min_travel_rate"); append_option_line(optgroup, "machine_min_travel_rate");
@ -2363,7 +2370,7 @@ void TabPrinter::build_unregular_pages()
// Add/delete Kinematics page according to is_marlin_flavor // Add/delete Kinematics page according to is_marlin_flavor
size_t existed_page = 0; size_t existed_page = 0;
for (size_t i = n_before_extruders; i < m_pages.size(); ++i) // first make sure it's not there already for (size_t i = n_before_extruders; i < m_pages.size(); ++i) // first make sure it's not there already
if (m_pages[i]->title().find(_(L("Machine limits"))) != std::string::npos) { if (m_pages[i]->title().find(L("Machine limits")) != std::string::npos) {
if (!is_marlin_flavor || m_rebuild_kinematics_page) if (!is_marlin_flavor || m_rebuild_kinematics_page)
m_pages.erase(m_pages.begin() + i); m_pages.erase(m_pages.begin() + i);
else else
@ -2388,7 +2395,7 @@ void TabPrinter::build_unregular_pages()
{ {
// if we have a single extruder MM setup, add a page with configuration options: // if we have a single extruder MM setup, add a page with configuration options:
for (size_t i = 0; i < m_pages.size(); ++i) // first make sure it's not there already for (size_t i = 0; i < m_pages.size(); ++i) // first make sure it's not there already
if (m_pages[i]->title().find(_(L("Single extruder MM setup"))) != std::string::npos) { if (m_pages[i]->title().find(L("Single extruder MM setup")) != std::string::npos) {
m_pages.erase(m_pages.begin() + i); m_pages.erase(m_pages.begin() + i);
break; break;
} }
@ -2396,8 +2403,8 @@ void TabPrinter::build_unregular_pages()
} }
if (m_extruders_count > 1 && m_config->opt_bool("single_extruder_multi_material") && !m_has_single_extruder_MM_page) { if (m_extruders_count > 1 && m_config->opt_bool("single_extruder_multi_material") && !m_has_single_extruder_MM_page) {
// create a page, but pretend it's an extruder page, so we can add it to m_pages ourselves // create a page, but pretend it's an extruder page, so we can add it to m_pages ourselves
auto page = add_options_page(_(L("Single extruder MM setup")), "printer", true); auto page = add_options_page(L("Single extruder MM setup"), "printer", true);
auto optgroup = page->new_optgroup(_(L("Single extruder multimaterial parameters"))); auto optgroup = page->new_optgroup(L("Single extruder multimaterial parameters"));
optgroup->append_single_option_line("cooling_tube_retraction"); optgroup->append_single_option_line("cooling_tube_retraction");
optgroup->append_single_option_line("cooling_tube_length"); optgroup->append_single_option_line("cooling_tube_length");
optgroup->append_single_option_line("parking_pos_retraction"); optgroup->append_single_option_line("parking_pos_retraction");
@ -2410,11 +2417,11 @@ void TabPrinter::build_unregular_pages()
// Build missed extruder pages // Build missed extruder pages
for (auto extruder_idx = m_extruders_count_old; extruder_idx < m_extruders_count; ++extruder_idx) { for (auto extruder_idx = m_extruders_count_old; extruder_idx < m_extruders_count; ++extruder_idx) {
//# build page //# build page
const wxString& page_name = wxString::Format(_(L("Extruder %d")), int(extruder_idx + 1)); const wxString& page_name = wxString::Format(L("Extruder %d"), int(extruder_idx + 1));
auto page = add_options_page(page_name, "funnel", true); auto page = add_options_page(page_name, "funnel", true);
m_pages.insert(m_pages.begin() + n_before_extruders + extruder_idx, page); m_pages.insert(m_pages.begin() + n_before_extruders + extruder_idx, page);
auto optgroup = page->new_optgroup(_(L("Size"))); auto optgroup = page->new_optgroup(L("Size"));
optgroup->append_single_option_line("nozzle_diameter", extruder_idx); optgroup->append_single_option_line("nozzle_diameter", extruder_idx);
optgroup->m_on_change = [this, extruder_idx](const t_config_option_key& opt_key, boost::any value) optgroup->m_on_change = [this, extruder_idx](const t_config_option_key& opt_key, boost::any value)
@ -2452,18 +2459,18 @@ void TabPrinter::build_unregular_pages()
update(); update();
}; };
optgroup = page->new_optgroup(_(L("Layer height limits"))); optgroup = page->new_optgroup(L("Layer height limits"));
optgroup->append_single_option_line("min_layer_height", extruder_idx); optgroup->append_single_option_line("min_layer_height", extruder_idx);
optgroup->append_single_option_line("max_layer_height", extruder_idx); optgroup->append_single_option_line("max_layer_height", extruder_idx);
optgroup = page->new_optgroup(_(L("Position (for multi-extruder printers)"))); optgroup = page->new_optgroup(L("Position (for multi-extruder printers)"));
optgroup->append_single_option_line("extruder_offset", extruder_idx); optgroup->append_single_option_line("extruder_offset", extruder_idx);
optgroup = page->new_optgroup(_(L("Retraction"))); optgroup = page->new_optgroup(L("Retraction"));
optgroup->append_single_option_line("retract_length", extruder_idx); optgroup->append_single_option_line("retract_length", extruder_idx);
optgroup->append_single_option_line("retract_lift", extruder_idx); optgroup->append_single_option_line("retract_lift", extruder_idx);
Line line = { _(L("Only lift Z")), "" }; Line line = { L("Only lift Z"), "" };
line.append_option(optgroup->get_option("retract_lift_above", extruder_idx)); line.append_option(optgroup->get_option("retract_lift_above", extruder_idx));
line.append_option(optgroup->get_option("retract_lift_below", extruder_idx)); line.append_option(optgroup->get_option("retract_lift_below", extruder_idx));
optgroup->append_line(line); optgroup->append_line(line);
@ -2476,11 +2483,11 @@ void TabPrinter::build_unregular_pages()
optgroup->append_single_option_line("wipe", extruder_idx); optgroup->append_single_option_line("wipe", extruder_idx);
optgroup->append_single_option_line("retract_before_wipe", extruder_idx); optgroup->append_single_option_line("retract_before_wipe", extruder_idx);
optgroup = page->new_optgroup(_(L("Retraction when tool is disabled (advanced settings for multi-extruder setups)"))); optgroup = page->new_optgroup(L("Retraction when tool is disabled (advanced settings for multi-extruder setups)"));
optgroup->append_single_option_line("retract_length_toolchange", extruder_idx); optgroup->append_single_option_line("retract_length_toolchange", extruder_idx);
optgroup->append_single_option_line("retract_restart_extra_toolchange", extruder_idx); optgroup->append_single_option_line("retract_restart_extra_toolchange", extruder_idx);
optgroup = page->new_optgroup(_(L("Preview"))); optgroup = page->new_optgroup(L("Preview"));
auto reset_to_filament_color = [this, extruder_idx](wxWindow* parent) { auto reset_to_filament_color = [this, extruder_idx](wxWindow* parent) {
add_scaled_button(parent, &m_reset_to_filament_color, "undo", add_scaled_button(parent, &m_reset_to_filament_color, "undo",
@ -2799,7 +2806,7 @@ void Tab::rebuild_page_tree()
m_treectrl->DeleteChildren(rootItem); m_treectrl->DeleteChildren(rootItem);
for (auto p : m_pages) for (auto p : m_pages)
{ {
auto itemId = m_treectrl->AppendItem(rootItem, p->title(), p->iconID()); auto itemId = m_treectrl->AppendItem(rootItem, _(p->title()), p->iconID());
m_treectrl->SetItemTextColour(itemId, p->get_item_colour()); m_treectrl->SetItemTextColour(itemId, p->get_item_colour());
if (p->title() == selected) { if (p->title() == selected) {
m_treectrl->SelectItem(itemId); m_treectrl->SelectItem(itemId);
@ -2828,7 +2835,7 @@ void Tab::update_page_tree_visibility()
{ {
if (!p->get_show()) if (!p->get_show())
continue; continue;
auto itemId = m_treectrl->AppendItem(rootItem, p->title(), p->iconID()); auto itemId = m_treectrl->AppendItem(rootItem, _(p->title()), p->iconID());
m_treectrl->SetItemTextColour(itemId, p->get_item_colour()); m_treectrl->SetItemTextColour(itemId, p->get_item_colour());
if (p->title() == selected) { if (p->title() == selected) {
m_treectrl->SelectItem(itemId); m_treectrl->SelectItem(itemId);
@ -3087,7 +3094,7 @@ void Tab::OnTreeSelChange(wxTreeEvent& event)
const auto sel_item = m_treectrl->GetSelection(); const auto sel_item = m_treectrl->GetSelection();
const auto selection = sel_item ? m_treectrl->GetItemText(sel_item) : ""; const auto selection = sel_item ? m_treectrl->GetItemText(sel_item) : "";
for (auto p : m_pages) for (auto p : m_pages)
if (p->title() == selection) if (_(p->title()) == selection)
{ {
page = p.get(); page = p.get();
m_is_nonsys_values = page->m_is_nonsys_values; m_is_nonsys_values = page->m_is_nonsys_values;
@ -3536,6 +3543,7 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la
//! config_ have to be "right" //! config_ have to be "right"
ConfigOptionsGroupShp optgroup = std::make_shared<ConfigOptionsGroup>(this, title, m_config, true, extra_column); ConfigOptionsGroupShp optgroup = std::make_shared<ConfigOptionsGroup>(this, title, m_config, true, extra_column);
optgroup->config_category = m_title.ToStdString();
if (noncommon_label_width >= 0) if (noncommon_label_width >= 0)
optgroup->label_width = noncommon_label_width; optgroup->label_width = noncommon_label_width;
@ -3646,9 +3654,9 @@ void TabSLAMaterial::build()
m_presets = &m_preset_bundle->sla_materials; m_presets = &m_preset_bundle->sla_materials;
load_initial_data(); load_initial_data();
auto page = add_options_page(_(L("Material")), "resin"); auto page = add_options_page(L("Material"), "resin");
auto optgroup = page->new_optgroup(_(L("Material"))); auto optgroup = page->new_optgroup(L("Material"));
optgroup->append_single_option_line("bottle_cost"); optgroup->append_single_option_line("bottle_cost");
optgroup->append_single_option_line("bottle_volume"); optgroup->append_single_option_line("bottle_volume");
optgroup->append_single_option_line("bottle_weight"); optgroup->append_single_option_line("bottle_weight");
@ -3680,19 +3688,19 @@ void TabSLAMaterial::build()
wxGetApp().sidebar().Layout(); wxGetApp().sidebar().Layout();
}; };
optgroup = page->new_optgroup(_(L("Layers"))); optgroup = page->new_optgroup(L("Layers"));
optgroup->append_single_option_line("initial_layer_height"); optgroup->append_single_option_line("initial_layer_height");
optgroup = page->new_optgroup(_(L("Exposure"))); optgroup = page->new_optgroup(L("Exposure"));
optgroup->append_single_option_line("exposure_time"); optgroup->append_single_option_line("exposure_time");
optgroup->append_single_option_line("initial_exposure_time"); optgroup->append_single_option_line("initial_exposure_time");
optgroup = page->new_optgroup(_(L("Corrections"))); optgroup = page->new_optgroup(L("Corrections"));
std::vector<std::string> corrections = {"material_correction"}; std::vector<std::string> corrections = {"material_correction"};
// std::vector<std::string> axes{ "X", "Y", "Z" }; // std::vector<std::string> axes{ "X", "Y", "Z" };
std::vector<std::string> axes{ "XY", "Z" }; std::vector<std::string> axes{ "XY", "Z" };
for (auto& opt_key : corrections) { for (auto& opt_key : corrections) {
auto line = Line{ _(m_config->def()->get(opt_key)->full_label), "" }; auto line = Line{ m_config->def()->get(opt_key)->full_label, "" };
int id = 0; int id = 0;
for (auto& axis : axes) { for (auto& axis : axes) {
auto opt = optgroup->get_option(opt_key, id); auto opt = optgroup->get_option(opt_key, id);
@ -3703,16 +3711,16 @@ void TabSLAMaterial::build()
optgroup->append_line(line); optgroup->append_line(line);
} }
page = add_options_page(_(L("Notes")), "note.png"); page = add_options_page(L("Notes"), "note.png");
optgroup = page->new_optgroup(_(L("Notes")), 0); optgroup = page->new_optgroup(L("Notes"), 0);
optgroup->label_width = 0; optgroup->label_width = 0;
Option option = optgroup->get_option("material_notes"); Option option = optgroup->get_option("material_notes");
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = 25;//250; option.opt.height = 25;//250;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
page = add_options_page(_(L("Dependencies")), "wrench.png"); page = add_options_page(L("Dependencies"), "wrench.png");
optgroup = page->new_optgroup(_(L("Profile dependencies"))); optgroup = page->new_optgroup(L("Profile dependencies"));
create_line_with_widget(optgroup.get(), "compatible_printers", [this](wxWindow* parent) { create_line_with_widget(optgroup.get(), "compatible_printers", [this](wxWindow* parent) {
return compatible_widget_create(parent, m_compatible_printers); return compatible_widget_create(parent, m_compatible_printers);
@ -3760,22 +3768,22 @@ void TabSLAPrint::build()
m_presets = &m_preset_bundle->sla_prints; m_presets = &m_preset_bundle->sla_prints;
load_initial_data(); load_initial_data();
auto page = add_options_page(_(L("Layers and perimeters")), "layers"); auto page = add_options_page(L("Layers and perimeters"), "layers");
auto optgroup = page->new_optgroup(_(L("Layers"))); auto optgroup = page->new_optgroup(L("Layers"));
optgroup->append_single_option_line("layer_height"); optgroup->append_single_option_line("layer_height");
optgroup->append_single_option_line("faded_layers"); optgroup->append_single_option_line("faded_layers");
page = add_options_page(_(L("Supports")), "support"/*"sla_supports"*/); page = add_options_page(L("Supports"), "support"/*"sla_supports"*/);
optgroup = page->new_optgroup(_(L("Supports"))); optgroup = page->new_optgroup(L("Supports"));
optgroup->append_single_option_line("supports_enable"); optgroup->append_single_option_line("supports_enable");
optgroup = page->new_optgroup(_(L("Support head"))); optgroup = page->new_optgroup(L("Support head"));
optgroup->append_single_option_line("support_head_front_diameter"); optgroup->append_single_option_line("support_head_front_diameter");
optgroup->append_single_option_line("support_head_penetration"); optgroup->append_single_option_line("support_head_penetration");
optgroup->append_single_option_line("support_head_width"); optgroup->append_single_option_line("support_head_width");
optgroup = page->new_optgroup(_(L("Support pillar"))); optgroup = page->new_optgroup(L("Support pillar"));
optgroup->append_single_option_line("support_pillar_diameter"); optgroup->append_single_option_line("support_pillar_diameter");
optgroup->append_single_option_line("support_max_bridges_on_pillar"); optgroup->append_single_option_line("support_max_bridges_on_pillar");
@ -3791,17 +3799,17 @@ void TabSLAPrint::build()
optgroup->append_single_option_line("pad_around_object"); optgroup->append_single_option_line("pad_around_object");
optgroup->append_single_option_line("support_object_elevation"); optgroup->append_single_option_line("support_object_elevation");
optgroup = page->new_optgroup(_(L("Connection of the support sticks and junctions"))); optgroup = page->new_optgroup(L("Connection of the support sticks and junctions"));
optgroup->append_single_option_line("support_critical_angle"); optgroup->append_single_option_line("support_critical_angle");
optgroup->append_single_option_line("support_max_bridge_length"); optgroup->append_single_option_line("support_max_bridge_length");
optgroup->append_single_option_line("support_max_pillar_link_distance"); optgroup->append_single_option_line("support_max_pillar_link_distance");
optgroup = page->new_optgroup(_(L("Automatic generation"))); optgroup = page->new_optgroup(L("Automatic generation"));
optgroup->append_single_option_line("support_points_density_relative"); optgroup->append_single_option_line("support_points_density_relative");
optgroup->append_single_option_line("support_points_minimal_distance"); optgroup->append_single_option_line("support_points_minimal_distance");
page = add_options_page(_(L("Pad")), "pad"); page = add_options_page(L("Pad"), "pad");
optgroup = page->new_optgroup(_(L("Pad"))); optgroup = page->new_optgroup(L("Pad"));
optgroup->append_single_option_line("pad_enable"); optgroup->append_single_option_line("pad_enable");
optgroup->append_single_option_line("pad_wall_thickness"); optgroup->append_single_option_line("pad_wall_thickness");
optgroup->append_single_option_line("pad_wall_height"); optgroup->append_single_option_line("pad_wall_height");
@ -3818,25 +3826,25 @@ void TabSLAPrint::build()
optgroup->append_single_option_line("pad_object_connector_width"); optgroup->append_single_option_line("pad_object_connector_width");
optgroup->append_single_option_line("pad_object_connector_penetration"); optgroup->append_single_option_line("pad_object_connector_penetration");
page = add_options_page(_(L("Hollowing")), "hollowing"); page = add_options_page(L("Hollowing"), "hollowing");
optgroup = page->new_optgroup(_(L("Hollowing"))); optgroup = page->new_optgroup(L("Hollowing"));
optgroup->append_single_option_line("hollowing_enable"); optgroup->append_single_option_line("hollowing_enable");
optgroup->append_single_option_line("hollowing_min_thickness"); optgroup->append_single_option_line("hollowing_min_thickness");
optgroup->append_single_option_line("hollowing_quality"); optgroup->append_single_option_line("hollowing_quality");
optgroup->append_single_option_line("hollowing_closing_distance"); optgroup->append_single_option_line("hollowing_closing_distance");
page = add_options_page(_(L("Advanced")), "wrench"); page = add_options_page(L("Advanced"), "wrench");
optgroup = page->new_optgroup(_(L("Slicing"))); optgroup = page->new_optgroup(L("Slicing"));
optgroup->append_single_option_line("slice_closing_radius"); optgroup->append_single_option_line("slice_closing_radius");
page = add_options_page(_(L("Output options")), "output+page_white"); page = add_options_page(L("Output options"), "output+page_white");
optgroup = page->new_optgroup(_(L("Output file"))); optgroup = page->new_optgroup(L("Output file"));
Option option = optgroup->get_option("output_filename_format"); Option option = optgroup->get_option("output_filename_format");
option.opt.full_width = true; option.opt.full_width = true;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
page = add_options_page(_(L("Dependencies")), "wrench"); page = add_options_page(L("Dependencies"), "wrench");
optgroup = page->new_optgroup(_(L("Profile dependencies"))); optgroup = page->new_optgroup(L("Profile dependencies"));
create_line_with_widget(optgroup.get(), "compatible_printers", [this](wxWindow* parent) { create_line_with_widget(optgroup.get(), "compatible_printers", [this](wxWindow* parent) {
return compatible_widget_create(parent, m_compatible_printers); return compatible_widget_create(parent, m_compatible_printers);

View file

@ -50,7 +50,7 @@ class Page : public wxScrolledWindow
wxBoxSizer* m_vsizer; wxBoxSizer* m_vsizer;
bool m_show = true; bool m_show = true;
public: public:
Page(wxWindow* parent, const wxString title, const int iconID, const std::vector<ScalableBitmap>& mode_bmp_cache) : Page(wxWindow* parent, const wxString& title, const int iconID, const std::vector<ScalableBitmap>& mode_bmp_cache) :
m_parent(parent), m_parent(parent),
m_title(title), m_title(title),
m_iconID(iconID), m_iconID(iconID),
@ -122,8 +122,7 @@ protected:
std::string m_name; std::string m_name;
const wxString m_title; const wxString m_title;
PresetBitmapComboBox* m_presets_choice; PresetBitmapComboBox* m_presets_choice;
// SearchComboBox* m_search_cb; Search::SearchCtrl* m_search;
SearchCtrl* m_search;
ScalableButton* m_btn_save_preset; ScalableButton* m_btn_save_preset;
ScalableButton* m_btn_delete_preset; ScalableButton* m_btn_delete_preset;
ScalableButton* m_btn_hide_incompatible_presets; ScalableButton* m_btn_hide_incompatible_presets;

View file

@ -181,12 +181,14 @@ namespace fts {
// Check for bonuses based on neighbor character value // Check for bonuses based on neighbor character value
if (currIdx > 0) { if (currIdx > 0) {
// Camel case // Camel case
char neighbor = strBegin[currIdx - 1]; // ::islower() expects an unsigned char in range of 0 to 255.
char curr = strBegin[currIdx]; unsigned char uneighbor = ((unsigned char *)strBegin)[currIdx - 1];
if (::islower(neighbor) && ::isupper(curr)) unsigned char ucurr = ((unsigned char*)strBegin)[currIdx];
if (::islower(uneighbor) && ::isupper(ucurr))
outScore += camel_bonus; outScore += camel_bonus;
// Separator // Separator
char neighbor = strBegin[currIdx - 1];
bool neighborSeparator = neighbor == '_' || neighbor == ' '; bool neighborSeparator = neighbor == '_' || neighbor == ' ';
if (neighborSeparator) if (neighborSeparator)
outScore += separator_bonus; outScore += separator_bonus;