ENH: param tab variant index & extruder switch

Change-Id: Icad6bce3b23ea98d5ef497ceabacc52f294af8f2
This commit is contained in:
chunmao.guo 2024-07-01 18:37:46 +08:00 committed by lane.wei
parent 366a14d8f7
commit 575572f184
7 changed files with 193 additions and 107 deletions

View File

@ -678,7 +678,7 @@ void ConfigOptionsGroup::on_change_OG(const t_config_option_key& opt_id, const b
auto itOption = it->second; auto itOption = it->second;
const std::string &opt_key = itOption.first; const std::string &opt_key = itOption.first;
int opt_index = get_extruder_idx(*m_config, itOption.first, itOption.second); int opt_index = itOption.second;
this->change_opt_value(opt_key, value, opt_index == -1 ? 0 : opt_index); this->change_opt_value(opt_key, value, opt_index == -1 ? 0 : opt_index);
} }
@ -737,7 +737,6 @@ void ConfigOptionsGroup::back_to_config_value(const DynamicPrintConfig& config,
auto opt_id = m_opt_map.find(opt_key)->first; auto opt_id = m_opt_map.find(opt_key)->first;
std::string opt_short_key = m_opt_map.at(opt_id).first; std::string opt_short_key = m_opt_map.at(opt_id).first;
int opt_index = m_opt_map.at(opt_id).second; int opt_index = m_opt_map.at(opt_id).second;
opt_index = get_extruder_idx(*m_config, opt_short_key, opt_index);
value = get_config_value(config, opt_short_key, opt_index); value = get_config_value(config, opt_short_key, opt_index);
} }
@ -789,7 +788,7 @@ void ConfigOptionsGroup::reload_config()
// option key (may be scalar or vector) // option key (may be scalar or vector)
const std::string &opt_key = kvp.second.first; const std::string &opt_key = kvp.second.first;
// index in the vector option, zero for scalars // index in the vector option, zero for scalars
int opt_index = get_extruder_idx(*m_config, kvp.second.first, kvp.second.second); int opt_index = kvp.second.second;
const ConfigOptionDef &option = m_options.at(opt_id).opt; const ConfigOptionDef &option = m_options.at(opt_id).opt;
#if 0 #if 0
// BBS // BBS
@ -1304,9 +1303,6 @@ void ExtruderOptionsGroup::on_change_OG(const t_config_option_key& opt_id, const
const std::string& opt_key = itOption.first; const std::string& opt_key = itOption.first;
int opt_index = itOption.second; int opt_index = itOption.second;
if (printer_extruder_options.find(opt_key) == printer_extruder_options.end()) {
opt_index = get_extruder_idx(*m_config, itOption.first, itOption.second);
}
this->change_opt_value(opt_key, value, opt_index == -1 ? 0 : opt_index); this->change_opt_value(opt_key, value, opt_index == -1 ? 0 : opt_index);
} }

View File

@ -1645,6 +1645,8 @@ void Sidebar::msw_rescale()
//BBS //BBS
p->m_bed_type_list->Rescale(); p->m_bed_type_list->Rescale();
p->m_bed_type_list->SetMinSize({-1, 3 * wxGetApp().em_unit()}); p->m_bed_type_list->SetMinSize({-1, 3 * wxGetApp().em_unit()});
p->m_left_extruder_list->Rescale();
p->m_right_extruder_list->Rescale();
#if 0 #if 0
if (p->mode_sizer) if (p->mode_sizer)
p->mode_sizer->msw_rescale(); p->mode_sizer->msw_rescale();
@ -1704,9 +1706,10 @@ void Sidebar::sys_color_changed()
// wxGetApp().UpdateDarkUI(btn, true); // wxGetApp().UpdateDarkUI(btn, true);
p->m_printer_icon->msw_rescale(); p->m_printer_icon->msw_rescale();
p->m_printer_setting->msw_rescale(); p->m_printer_setting->msw_rescale();
p->m_printer_setting->msw_rescale();
p->m_filament_icon->msw_rescale(); p->m_filament_icon->msw_rescale();
p->m_bpButton_add_filament->msw_rescale(); p->m_bpButton_add_filament->msw_rescale();
p->m_bpButton_del_filament->msw_rescale(); //p->m_bpButton_del_filament->msw_rescale();
p->m_bpButton_ams_filament->msw_rescale(); p->m_bpButton_ams_filament->msw_rescale();
p->m_bpButton_set_filament->msw_rescale(); p->m_bpButton_set_filament->msw_rescale();
p->m_flushing_volume_btn->Rescale(); p->m_flushing_volume_btn->Rescale();

View File

@ -487,7 +487,19 @@ void Tab::create_preset_tab()
m_tabctrl->Bind(wxEVT_KEY_DOWN, &Tab::OnKeyDown, this); m_tabctrl->Bind(wxEVT_KEY_DOWN, &Tab::OnKeyDown, this);
m_main_sizer->Add(m_tabctrl, 1, wxEXPAND | wxALL, 0 ); m_main_sizer->Add(m_tabctrl, 0, wxEXPAND | wxALL, 0 );
if (dynamic_cast<TabPrint *>(this)) {
m_extruder_switch = new SwitchButton(panel);
m_extruder_switch->SetMaxSize({em_unit(this) * 24, -1});
m_extruder_switch->SetLabels(_L("Left"), _L("Right"));
m_extruder_switch->Bind(wxEVT_TOGGLEBUTTON, [this] (auto & evt) {
evt.Skip();
dynamic_cast<TabPrint *>(this)->switch_excluder(evt.GetInt());
reload_config();
});
m_main_sizer->Add(m_extruder_switch, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, 4);
}
this->SetSizer(m_main_sizer); this->SetSizer(m_main_sizer);
//this->Layout(); //this->Layout();
@ -805,44 +817,21 @@ void Tab::decorate()
m_active_page->refresh(); m_active_page->refresh();
} }
std::vector<std::string> Tab::filter_diff_option(const std::vector<std::string> &options) void Tab::filter_diff_option(std::vector<std::string> &options)
{ {
auto get_name_and_index = [](const std::string& value) -> std::pair<std::string, int>{ for (auto &opt : options) {
size_t pos = value.find("#"); if (opt.find_last_of('#') == std::string::npos) continue;
if (pos != std::string::npos) { bool found = false;
std::string param_name = value.substr(0, pos); for (auto page : m_pages) {
std::string number_str = value.substr(pos + 1); if (auto iter = page->m_opt_id_map.find(opt); iter != page->m_opt_id_map.end()) {
int index = 0; opt = iter->second;
if (!number_str.empty()) { found = true;
index = std::stoi(number_str); break;
}
return std::make_pair(param_name, index);
}
return std::make_pair(value, -1);
};
std::vector<std::string> diff_options;
for (std::string option : options) {
auto name_to_index = get_name_and_index(option);
if (name_to_index.second == -1) {
diff_options.emplace_back(option);
continue;
}
size_t nozzle_nums = wxGetApp().preset_bundle->get_printer_extruder_count();
std::vector<int> support_indexes;
for (size_t i = 0; i < nozzle_nums; ++i) {
support_indexes.push_back(get_extruder_idx(*m_config, name_to_index.first, i));
}
auto iter = std::find(support_indexes.begin(), support_indexes.end(), name_to_index.second);
if (iter != support_indexes.end()) {
int extruder_id = std::distance(support_indexes.begin(), iter);
std::string name_to_extruder_id = name_to_index.first + "#" + std::to_string(extruder_id);
diff_options.emplace_back(name_to_extruder_id);
} }
} }
if (!found) opt.clear();
return diff_options; }
options.erase(std::remove(options.begin(), options.end(), ""), options.end());
} }
// Update UI according to changes // Update UI according to changes
@ -865,8 +854,8 @@ void Tab::update_changed_ui()
for (auto& it : m_options_list) for (auto& it : m_options_list)
it.second = m_opt_status_value; it.second = m_opt_status_value;
dirty_options = filter_diff_option(dirty_options); filter_diff_option(dirty_options);
nonsys_options = filter_diff_option(nonsys_options); filter_diff_option(nonsys_options);
for (auto opt_key : dirty_options) { for (auto opt_key : dirty_options) {
m_options_list[opt_key] &= ~osInitValue; m_options_list[opt_key] &= ~osInitValue;
@ -1602,6 +1591,18 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
wxGetApp().plater()->on_extruders_change(boost::any_cast<size_t>(value)); wxGetApp().plater()->on_extruders_change(boost::any_cast<size_t>(value));
#endif #endif
if (opt_key.find_first_of("nozzle_volume_type") != std::string::npos) {
int extruder_idx = std::atoi(opt_key.substr(opt_key.find_last_of('#') + 1).c_str());
for (auto tab : wxGetApp().tabs_list) {
tab->update_extruder_variants(extruder_idx);
tab->reload_config();
}
for (auto tab : wxGetApp().model_tabs_list) {
tab->update_extruder_variants(extruder_idx);
tab->reload_config();
}
}
if (m_postpone_update_ui) { if (m_postpone_update_ui) {
// It means that not all values are rolled to the system/last saved values jet. // It means that not all values are rolled to the system/last saved values jet.
// And call of the update() can causes a redundant check of the config values, // And call of the update() can causes a redundant check of the config values,
@ -2058,51 +2059,51 @@ void TabPrint::build()
page = add_options_page(L("Speed"), "empty"); page = add_options_page(L("Speed"), "empty");
optgroup = page->new_optgroup(L("Initial layer speed"), L"param_speed_first", 15); optgroup = page->new_optgroup(L("Initial layer speed"), L"param_speed_first", 15);
optgroup->append_single_option_line("initial_layer_speed"); optgroup->append_single_option_line("initial_layer_speed", "", 0);
optgroup->append_single_option_line("initial_layer_infill_speed"); optgroup->append_single_option_line("initial_layer_infill_speed", "", 0);
optgroup = page->new_optgroup(L("Other layers speed"), L"param_speed", 15); optgroup = page->new_optgroup(L("Other layers speed"), L"param_speed", 15);
optgroup->append_single_option_line("outer_wall_speed"); optgroup->append_single_option_line("outer_wall_speed", "", 0);
optgroup->append_single_option_line("inner_wall_speed"); optgroup->append_single_option_line("inner_wall_speed", "", 0);
optgroup->append_single_option_line("small_perimeter_speed"); optgroup->append_single_option_line("small_perimeter_speed", "", 0);
optgroup->append_single_option_line("small_perimeter_threshold"); optgroup->append_single_option_line("small_perimeter_threshold", "", 0);
optgroup->append_single_option_line("sparse_infill_speed"); optgroup->append_single_option_line("sparse_infill_speed", "", 0);
optgroup->append_single_option_line("internal_solid_infill_speed"); optgroup->append_single_option_line("internal_solid_infill_speed", "", 0);
optgroup->append_single_option_line("top_surface_speed"); optgroup->append_single_option_line("top_surface_speed", "", 0);
optgroup->append_single_option_line("enable_overhang_speed", "slow-down-for-overhang"); optgroup->append_single_option_line("enable_overhang_speed", "slow-down-for-overhang", 0);
Line line = { L("Overhang speed"), L("This is the speed for various overhang degrees. Overhang degrees are expressed as a percentage of line width. 0 speed means no slowing down for the overhang degree range and wall speed is used") }; Line line = { L("Overhang speed"), L("This is the speed for various overhang degrees. Overhang degrees are expressed as a percentage of line width. 0 speed means no slowing down for the overhang degree range and wall speed is used") };
line.label_path = "slow-down-for-overhang"; line.label_path = "slow-down-for-overhang";
line.append_option(optgroup->get_option("overhang_1_4_speed")); line.append_option(optgroup->get_option("overhang_1_4_speed", 0));
line.append_option(optgroup->get_option("overhang_2_4_speed")); line.append_option(optgroup->get_option("overhang_2_4_speed", 0));
line.append_option(optgroup->get_option("overhang_3_4_speed")); line.append_option(optgroup->get_option("overhang_3_4_speed", 0));
line.append_option(optgroup->get_option("overhang_4_4_speed")); line.append_option(optgroup->get_option("overhang_4_4_speed", 0));
optgroup->append_line(line); optgroup->append_line(line);
optgroup->append_single_option_line("overhang_totally_speed"); optgroup->append_single_option_line("overhang_totally_speed", 0);
optgroup->append_single_option_line("bridge_speed"); optgroup->append_single_option_line("bridge_speed", "", 0);
optgroup->append_single_option_line("gap_infill_speed"); optgroup->append_single_option_line("gap_infill_speed", "", 0);
optgroup->append_single_option_line("support_speed"); optgroup->append_single_option_line("support_speed", "", 0);
optgroup->append_single_option_line("support_interface_speed"); optgroup->append_single_option_line("support_interface_speed", "", 0);
optgroup = page->new_optgroup(L("Travel speed"), L"param_travel_speed", 15); optgroup = page->new_optgroup(L("Travel speed"), L"param_travel_speed", 15);
optgroup->append_single_option_line("travel_speed"); optgroup->append_single_option_line("travel_speed", "", 0);
optgroup = page->new_optgroup(L("Acceleration"), L"param_acceleration", 15); optgroup = page->new_optgroup(L("Acceleration"), L"param_acceleration", 15);
optgroup->append_single_option_line("default_acceleration"); optgroup->append_single_option_line("default_acceleration", "", 0);
optgroup->append_single_option_line("initial_layer_acceleration"); optgroup->append_single_option_line("initial_layer_acceleration", "", 0);
optgroup->append_single_option_line("outer_wall_acceleration"); optgroup->append_single_option_line("outer_wall_acceleration", "", 0);
optgroup->append_single_option_line("inner_wall_acceleration"); optgroup->append_single_option_line("inner_wall_acceleration", "", 0);
optgroup->append_single_option_line("top_surface_acceleration"); optgroup->append_single_option_line("top_surface_acceleration", "", 0);
optgroup->append_single_option_line("sparse_infill_acceleration"); optgroup->append_single_option_line("sparse_infill_acceleration", "", 0);
optgroup->append_single_option_line("accel_to_decel_enable"); optgroup->append_single_option_line("accel_to_decel_enable", "", 0);
optgroup->append_single_option_line("accel_to_decel_factor"); optgroup->append_single_option_line("accel_to_decel_factor", "", 0);
optgroup = page->new_optgroup(L("Jerk(XY)"), L"param_acceleration", 15); optgroup = page->new_optgroup(L("Jerk(XY)"), L"param_acceleration", 15);
optgroup->append_single_option_line("default_jerk"); optgroup->append_single_option_line("default_jerk", "", 0);
optgroup->append_single_option_line("outer_wall_jerk"); optgroup->append_single_option_line("outer_wall_jerk", "", 0);
optgroup->append_single_option_line("inner_wall_jerk"); optgroup->append_single_option_line("inner_wall_jerk", "", 0);
optgroup->append_single_option_line("infill_jerk"); optgroup->append_single_option_line("infill_jerk", "", 0);
optgroup->append_single_option_line("top_surface_jerk"); optgroup->append_single_option_line("top_surface_jerk", "", 0);
optgroup->append_single_option_line("initial_layer_jerk"); optgroup->append_single_option_line("initial_layer_jerk", "", 0);
optgroup->append_single_option_line("travel_jerk"); optgroup->append_single_option_line("travel_jerk", "", 0);
#ifdef HAS_PRESSURE_EQUALIZER #ifdef HAS_PRESSURE_EQUALIZER
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_positive"); optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_positive");
@ -2345,7 +2346,6 @@ void TabPrint::clear_pages()
m_top_bottom_shell_thickness_explanation = nullptr; m_top_bottom_shell_thickness_explanation = nullptr;
} }
//BBS: GUI refactor //BBS: GUI refactor
static std::vector<std::string> intersect(std::vector<std::string> const& l, std::vector<std::string> const& r) static std::vector<std::string> intersect(std::vector<std::string> const& l, std::vector<std::string> const& r)
@ -3964,6 +3964,7 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/)
// load_config(new_conf); // load_config(new_conf);
// } // }
//} //}
update_dirty(); update_dirty();
on_value_change(opt_key, value); on_value_change(opt_key, value);
update(); update();
@ -4333,6 +4334,7 @@ void Tab::load_current_preset()
update(); update();
// Reload preset pages with the new configuration values. // Reload preset pages with the new configuration values.
update_extruder_variants();
reload_config(); reload_config();
update_ui_items_related_on_parent_preset(m_presets->get_selected_preset_parent()); update_ui_items_related_on_parent_preset(m_presets->get_selected_preset_parent());
@ -5059,6 +5061,8 @@ bool Tab::tree_sel_change_delayed(wxCommandEvent& event)
return false; return false;
m_active_page = page; m_active_page = page;
if (m_extruder_switch)
GetSizer()->Show(m_extruder_switch, !m_active_page->m_opt_id_map.empty());
auto throw_if_canceled = std::function<void()>([this](){ auto throw_if_canceled = std::function<void()>([this](){
#ifdef WIN32 #ifdef WIN32
@ -5550,6 +5554,7 @@ void TabPrinter::set_extruder_volume_type(int extruder_id, NozzleVolumeType type
auto nozzle_volumes = m_config->option<ConfigOptionEnumsGeneric>("nozzle_volume_type"); auto nozzle_volumes = m_config->option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
assert(nozzle_volumes->values.size() > (size_t)extruder_id); assert(nozzle_volumes->values.size() > (size_t)extruder_id);
nozzle_volumes->values[extruder_id] = type; nozzle_volumes->values[extruder_id] = type;
on_value_change((boost::format("nozzle_volume_type#%1%") % extruder_id).str(), int(type));
} }
// Return a callback to create a TabPrinter widget to edit bed shape // Return a callback to create a TabPrinter widget to edit bed shape
@ -5687,6 +5692,88 @@ void Tab::set_just_edit(bool just_edit)
} }
} }
/// <summary>
/// Call from:
/// 1: on_value_change "nozzle_volume_type"
/// 2: on_preset_loaded (extruder_id = -1)
/// </summary>
/// <param name="extruder_id"></param>
void Tab::update_extruder_variants(int extruder_id)
{
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << extruder_id;
if (m_extruder_switch) {
Preset &printer_preset = wxGetApp().preset_bundle->printers.get_edited_preset();
auto nozzle_volumes = printer_preset.config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
if (nozzle_volumes->size() == 2) {
auto nozzle_volumes_def = printer_preset.config.def()->get("nozzle_volume_type");
wxString left, right;
for (size_t i = 0; i < nozzle_volumes_def->enum_labels.size(); ++i) {
if (nozzle_volumes->values[0] == i) left = _L(nozzle_volumes_def->enum_labels[i]);
if (nozzle_volumes->values[1] == i) right = _L(nozzle_volumes_def->enum_labels[i]);
}
m_extruder_switch->SetLabels(wxString::Format(_L("Left: %s"), left), wxString::Format(_L("Right: %s"), right));
m_extruder_switch->SetValue(extruder_id == 1);
} else {
GetSizer()->Show(m_extruder_switch, false);
return;
}
}
switch_excluder(extruder_id);
if (m_extruder_switch)
GetSizer()->Show(m_extruder_switch, m_active_page && !m_active_page->m_opt_id_map.empty());
}
void Tab::switch_excluder(int extruder_id)
{
Preset & printer_preset = wxGetApp().preset_bundle->printers.get_edited_preset();
auto nozzle_volumes = printer_preset.config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type");
auto extruders = printer_preset.config.option<ConfigOptionEnumsGeneric>("extruder_type");
std::pair<std::string, std::string> variant_keys[]{
{}, {"print_extruder_id", "print_extruder_variant"}, // Preset::TYPE_PRINT
{}, {"", "filament_extruder_variant"}, // Preset::TYPE_FILAMENT filament don't use id anymore
{}, {"printer_extruder_id", "printer_extruder_variant"}, // Preset::TYPE_PRINTER
};
if (m_extruder_switch) {
int current_extruder = m_extruder_switch->GetValue() ? 1 : 0;
if (extruder_id == -1)
extruder_id = current_extruder;
else if (extruder_id != current_extruder)
return;
}
auto get_index_for_extruder =
[this, &extruders, &nozzle_volumes, variant_keys = variant_keys[m_type >= Preset::TYPE_COUNT ? Preset::TYPE_PRINT : m_type]](int extruder_id) {
return m_config->get_index_for_extruder(extruder_id + 1, variant_keys.first,
ExtruderType(extruders->values[extruder_id]), NozzleVolumeType(nozzle_volumes->values[extruder_id]), variant_keys.second);
};
auto index = get_index_for_extruder(extruder_id == -1 ? 0 : extruder_id);
for (auto page : m_pages) {
bool is_extruder = false;
page->m_opt_id_map.clear();
if (m_extruder_switch == nullptr && page->title().StartsWith("Extruder ")) {
int extruder_id2 = std::atoi(page->title().Mid(9).ToUTF8()) - 1;
if (extruder_id >= 0 && extruder_id2 != extruder_id)
continue;
if (extruder_id2 > 0)
index = get_index_for_extruder(extruder_id2);
is_extruder = true;
}
for (auto group : page->m_optgroups) {
if (is_extruder && group->title == "Type") {
for (auto &opt : group->opt_map())
page->m_opt_id_map.insert({opt.first, opt.first});
continue;
}
for (auto &opt : group->opt_map()) {
if (opt.second.second >= 0) {
const_cast<int &>(opt.second.second) = index;
page->m_opt_id_map.insert({opt.second.first + "#" + std::to_string(index), opt.first});
}
}
}
}
}
void Tab::compatible_widget_reload(PresetDependencies &deps) void Tab::compatible_widget_reload(PresetDependencies &deps)
{ {
Field* field = this->get_field(deps.key_condition); Field* field = this->get_field(deps.key_condition);

View File

@ -114,6 +114,8 @@ public:
} }
bool get_show() const { return m_show; } bool get_show() const { return m_show; }
std::map<std::string, std::string> m_opt_id_map;
protected: protected:
// Color of TreeCtrlItem. The wxColour will be updated only if the new wxColour pointer differs from the currently rendered one. // Color of TreeCtrlItem. The wxColour will be updated only if the new wxColour pointer differs from the currently rendered one.
const wxColour* m_item_color; const wxColour* m_item_color;
@ -297,6 +299,7 @@ public:
int m_update_cnt = 0; int m_update_cnt = 0;
SwitchButton *m_mode_view = nullptr; SwitchButton *m_mode_view = nullptr;
SwitchButton *m_extruder_switch = nullptr;
public: public:
// BBS // BBS
@ -410,6 +413,9 @@ public:
bool validate_custom_gcodes_was_shown{ false }; bool validate_custom_gcodes_was_shown{ false };
void set_just_edit(bool just_edit); void set_just_edit(bool just_edit);
void update_extruder_variants(int extruder_id = -1);
void switch_excluder(int extruder_id = -1);
protected: protected:
void create_line_with_widget(ConfigOptionsGroup* optgroup, const std::string& opt_key, const std::string& path, widget_t widget); void create_line_with_widget(ConfigOptionsGroup* optgroup, const std::string& opt_key, const std::string& path, widget_t widget);
wxSizer* compatible_widget_create(wxWindow* parent, PresetDependencies &deps); wxSizer* compatible_widget_create(wxWindow* parent, PresetDependencies &deps);
@ -424,7 +430,7 @@ protected:
void update_preset_description_line(); void update_preset_description_line();
void update_frequently_changed_parameters(); void update_frequently_changed_parameters();
void set_tooltips_text(); void set_tooltips_text();
std::vector<std::string> filter_diff_option(const std::vector<std::string> &options); void filter_diff_option(std::vector<std::string> &options);
ConfigManipulation m_config_manipulation; ConfigManipulation m_config_manipulation;
ConfigManipulation get_config_manipulation(); ConfigManipulation get_config_manipulation();

View File

@ -89,7 +89,6 @@ void ComboBox::SetSelection(int n)
else else
SetIcon("drop_down"); SetIcon("drop_down");
} }
void ComboBox::SelectAndNotify(int n) { void ComboBox::SelectAndNotify(int n) {
SetSelection(n); SetSelection(n);
sendComboBoxEvent(); sendComboBoxEvent();
@ -163,7 +162,6 @@ int ComboBox::Append(const wxString &item,
tips.push_back(wxString{}); tips.push_back(wxString{});
icons.push_back(bitmap); icons.push_back(bitmap);
datas.push_back(clientData); datas.push_back(clientData);
types.push_back(wxClientData_None);
SetClientDataType(wxClientData_Void); SetClientDataType(wxClientData_Void);
drop.Invalidate(); drop.Invalidate();
return texts.size() - 1; return texts.size() - 1;
@ -176,7 +174,6 @@ void ComboBox::DoClear()
tips.clear(); tips.clear();
icons.clear(); icons.clear();
datas.clear(); datas.clear();
types.clear();
drop.Invalidate(true); drop.Invalidate(true);
} }
@ -187,7 +184,6 @@ void ComboBox::DoDeleteOneItem(unsigned int pos)
tips.erase(tips.begin() + pos); tips.erase(tips.begin() + pos);
icons.erase(icons.begin() + pos); icons.erase(icons.begin() + pos);
datas.erase(datas.begin() + pos); datas.erase(datas.begin() + pos);
types.erase(types.begin() + pos);
drop.Invalidate(true); drop.Invalidate(true);
} }
@ -238,7 +234,6 @@ int ComboBox::DoInsertItems(const wxArrayStringsAdapter &items,
tips.insert(tips.begin() + pos, wxString{}); tips.insert(tips.begin() + pos, wxString{});
icons.insert(icons.begin() + pos, wxNullBitmap); icons.insert(icons.begin() + pos, wxNullBitmap);
datas.insert(datas.begin() + pos, clientData ? clientData[i] : NULL); datas.insert(datas.begin() + pos, clientData ? clientData[i] : NULL);
types.insert(types.begin() + pos, type);
++pos; ++pos;
} }
drop.Invalidate(true); drop.Invalidate(true);

View File

@ -13,7 +13,6 @@ class ComboBox : public wxWindowWithItems<TextInput, wxItemContainer>
std::vector<wxString> tips; std::vector<wxString> tips;
std::vector<wxBitmap> icons; std::vector<wxBitmap> icons;
std::vector<void *> datas; std::vector<void *> datas;
std::vector<wxClientDataType> types;
DropDown drop; DropDown drop;
bool drop_down = false; bool drop_down = false;