Split snapshot text for separated fazes (in ObjectList)

This commit is contained in:
YuSanka 2019-08-01 15:38:00 +02:00
parent 170bd8b064
commit ec9117cc06

View file

@ -490,7 +490,7 @@ void ObjectList::update_name_in_model(const wxDataViewItem& item) const
if (obj_idx < 0) return;
const int volume_id = m_objects_model->GetVolumeIdByItem(item);
take_snapshot(wxString::Format(_(L("Rename %s")), volume_id < 0 ? _(L("Object")) : _(L("Sub-object"))));
take_snapshot(volume_id < 0 ? _(L("Rename Object")) : _(L("Rename Sub-object")));
if (m_objects_model->GetItemType(item) & itObject) {
(*m_objects)[obj_idx]->name = m_objects_model->GetName(item).ToUTF8().data();
@ -1043,8 +1043,10 @@ void ObjectList::get_settings_choice(const wxString& category_name)
wxArrayInt selections;
wxDataViewItem item = GetSelection();
const ItemType item_type = m_objects_model->GetItemType(item);
settings_menu_hierarchy settings_menu;
const bool is_part = m_objects_model->GetItemType(item) & (itVolume | itLayer);
const bool is_part = item_type & (itVolume | itLayer);
get_options_menu(settings_menu, is_part);
std::vector< std::pair<std::string, std::string> > *settings_list = nullptr;
@ -1121,7 +1123,10 @@ void ObjectList::get_settings_choice(const wxString& category_name)
}
#endif
take_snapshot(wxString::Format(_(L("Add Settings for %s")), is_part ? _(L("Sub-object")) : _(L("Object"))));
const wxString snapshot_text = item_type & itLayer ? _(L("Add Settings for Layers")) :
item_type & itVolume ? _(L("Add Settings for Sub-object")) :
_(L("Add Settings for Object"));
take_snapshot(snapshot_text);
std::vector <std::string> selected_options;
selected_options.reserve(selection_cnt);
@ -1153,7 +1158,7 @@ void ObjectList::get_settings_choice(const wxString& category_name)
// Add settings item for object/sub-object and show them
if (!(m_objects_model->GetItemType(item) & (itObject | itVolume | itLayer)))
if (!(item_type & (itObject | itVolume | itLayer)))
item = m_objects_model->GetTopParent(item);
show_settings(add_settings_item(item, m_config));
}
@ -1163,11 +1168,13 @@ void ObjectList::get_freq_settings_choice(const wxString& bundle_name)
std::vector<std::string> options = get_options_for_bundle(bundle_name);
wxDataViewItem item = GetSelection();
ItemType item_type = m_objects_model->GetItemType(item);
/* Because of we couldn't edited layer_height for ItVolume from settings list,
* correct options according to the selected item type :
* remove "layer_height" option
*/
if ((m_objects_model->GetItemType(item) & itVolume) && bundle_name == _("Layers and Perimeters")) {
if ((item_type & itVolume) && bundle_name == _("Layers and Perimeters")) {
const auto layer_height_it = std::find(options.begin(), options.end(), "layer_height");
if (layer_height_it != options.end())
options.erase(layer_height_it);
@ -1179,7 +1186,10 @@ void ObjectList::get_freq_settings_choice(const wxString& bundle_name)
assert(m_config);
auto opt_keys = m_config->keys();
take_snapshot(wxString::Format(_(L("Add Settings Bundle for %s")), m_objects_model->GetItemType(item) & (itVolume|itLayer) ? _(L("Sub-object")) : _(L("Object"))));
const wxString snapshot_text = item_type & itLayer ? _(L("Add Settings Bundle for Layers")) :
item_type & itVolume ? _(L("Add Settings Bundle for Sub-object")) :
_(L("Add Settings Bundle for Object"));
take_snapshot(snapshot_text);
const DynamicPrintConfig& from_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
for (auto& opt_key : options)
@ -1196,7 +1206,7 @@ void ObjectList::get_freq_settings_choice(const wxString& bundle_name)
}
// Add settings item for object/sub-object and show them
if (!(m_objects_model->GetItemType(item) & (itObject | itVolume | itLayer)))
if (!(item_type & (itObject | itVolume | itLayer)))
item = m_objects_model->GetTopParent(item);
show_settings(add_settings_item(item, m_config));
}
@ -1211,26 +1221,6 @@ void ObjectList::show_settings(const wxDataViewItem settings_item)
// update object selection on Plater
if (!m_prevent_canvas_selection_update)
update_selections_on_canvas();
/* auto item = GetSelection();
if (item) {
if (m_objects_model->GetItemType(item) == itInstance)
item = m_objects_model->GetTopParent(item);
const auto settings_item = m_objects_model->IsSettingsItem(item) ? item : m_objects_model->GetSettingsItem(item);
select_item(settings_item ? settings_item :
m_objects_model->AddSettingsChild(item));
// update object selection on Plater
if (!m_prevent_canvas_selection_update)
update_selections_on_canvas();
}
else {
//# ys_FIXME ??? use case ???
auto panel = wxGetApp().sidebar().scrolled_panel();
panel->Freeze();
wxGetApp().obj_settings()->UpdateAndShow(true);
panel->Thaw();
}
*/
}
wxMenu* ObjectList::append_submenu_add_generic(wxMenu* menu, const ModelVolumeType type) {