Copy/Paste for the Settings and Layers in the ObjectList

This commit is contained in:
YuSanka 2020-06-01 11:11:38 +02:00
parent 21de9d23ec
commit 9146ef2f61
3 changed files with 131 additions and 22 deletions

View file

@ -81,10 +81,32 @@ public:
smLayerRoot = 16, // used for undo/redo
};
struct Clipboard
{
void reset() {
m_type = itUndef;
m_layer_config_ranges_cache .clear();
m_config_cache.clear();
}
bool empty() const { return m_type == itUndef; }
ItemType get_type() const { return m_type; }
void set_type(ItemType type) { m_type = type; }
t_layer_config_ranges& get_ranges_cache() { return m_layer_config_ranges_cache; }
DynamicPrintConfig& get_config_cache() { return m_config_cache; }
private:
ItemType m_type {itUndef};
t_layer_config_ranges m_layer_config_ranges_cache;
DynamicPrintConfig m_config_cache;
};
private:
SELECTION_MODE m_selection_mode {smUndef};
int m_selected_layers_range_idx;
Clipboard m_clipboard;
struct dragged_item_data
{
void init(const int obj_idx, const int subobj_idx, const ItemType type) {
@ -148,8 +170,6 @@ private:
std::vector<wxBitmap*> m_bmp_vector;
t_layer_config_ranges m_layer_config_ranges_cache;
int m_selected_object_id = -1;
bool m_prevent_list_events = false; // We use this flag to avoid circular event handling Select()
// happens to fire a wxEVT_LIST_ITEM_SELECTED on OSX, whose event handler
@ -230,6 +250,8 @@ public:
void copy();
void paste();
bool copy_to_clipboard();
bool paste_from_clipboard();
void undo();
void redo();
@ -385,8 +407,11 @@ public:
void fix_through_netfabb();
void update_item_error_icon(const int obj_idx, int vol_idx) const ;
void fill_layer_config_ranges_cache();
void copy_layers_to_clipboard();
void paste_layers_into_list();
void copy_settings_to_clipboard();
void paste_settings_into_list();
bool clipboard_is_empty() const { return m_clipboard.empty(); }
void paste_volumes_into_list(int obj_idx, const ModelVolumePtrs& volumes);
void paste_objects_into_list(const std::vector<size_t>& object_idxs);