2018-10-04 14:43:10 +00:00
|
|
|
#ifndef slic3r_GUI_ObjectList_hpp_
|
|
|
|
#define slic3r_GUI_ObjectList_hpp_
|
|
|
|
|
2018-10-05 21:29:15 +00:00
|
|
|
#include <map>
|
2018-10-22 13:18:05 +00:00
|
|
|
#include <vector>
|
2020-02-03 09:13:15 +00:00
|
|
|
#include <set>
|
2018-11-13 13:17:35 +00:00
|
|
|
|
2018-12-06 16:00:46 +00:00
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/dataview.h>
|
|
|
|
#include <wx/menu.h>
|
|
|
|
|
2018-11-01 11:33:56 +00:00
|
|
|
#include "Event.hpp"
|
2018-11-13 13:17:35 +00:00
|
|
|
#include "wxExtensions.hpp"
|
2020-02-02 21:22:40 +00:00
|
|
|
#include "ObjectDataViewModel.hpp"
|
2018-10-04 14:43:10 +00:00
|
|
|
|
|
|
|
class wxBoxSizer;
|
2019-10-02 10:17:02 +00:00
|
|
|
class wxBitmapComboBox;
|
2018-12-06 16:00:46 +00:00
|
|
|
class wxMenuItem;
|
2019-04-24 23:45:00 +00:00
|
|
|
class ObjectDataViewModel;
|
|
|
|
class MenuWithSeparators;
|
2018-10-04 14:43:10 +00:00
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
class ConfigOptionsGroup;
|
2018-10-05 21:29:15 +00:00
|
|
|
class DynamicPrintConfig;
|
|
|
|
class ModelObject;
|
|
|
|
class ModelVolume;
|
2019-02-22 11:12:10 +00:00
|
|
|
enum class ModelVolumeType : int;
|
2018-10-05 21:29:15 +00:00
|
|
|
|
2018-11-29 17:33:30 +00:00
|
|
|
// FIXME: broken build on mac os because of this is missing:
|
|
|
|
typedef std::vector<std::string> t_config_option_keys;
|
|
|
|
|
2019-07-11 21:46:23 +00:00
|
|
|
typedef std::map<std::string, std::vector<std::string>> SettingsBundle;
|
2019-01-28 11:13:53 +00:00
|
|
|
|
|
|
|
// category -> vector ( option ; label )
|
|
|
|
typedef std::map< std::string, std::vector< std::pair<std::string, std::string> > > settings_menu_hierarchy;
|
|
|
|
|
2019-04-10 06:40:58 +00:00
|
|
|
typedef std::vector<ModelVolume*> ModelVolumePtrs;
|
|
|
|
|
2019-06-10 13:22:09 +00:00
|
|
|
typedef double coordf_t;
|
|
|
|
typedef std::pair<coordf_t, coordf_t> t_layer_height_range;
|
|
|
|
typedef std::map<t_layer_height_range, DynamicPrintConfig> t_layer_config_ranges;
|
2019-06-05 09:50:59 +00:00
|
|
|
|
2018-10-05 21:29:15 +00:00
|
|
|
namespace GUI {
|
2018-10-04 14:43:10 +00:00
|
|
|
|
2018-11-01 13:02:38 +00:00
|
|
|
wxDECLARE_EVENT(EVT_OBJ_LIST_OBJECT_SELECT, SimpleEvent);
|
2018-11-01 11:33:56 +00:00
|
|
|
|
2018-11-13 13:17:35 +00:00
|
|
|
struct ItemForDelete
|
|
|
|
{
|
|
|
|
ItemType type;
|
|
|
|
int obj_idx;
|
|
|
|
int sub_obj_idx;
|
2018-11-14 07:53:56 +00:00
|
|
|
|
|
|
|
ItemForDelete(ItemType type, int obj_idx, int sub_obj_idx)
|
|
|
|
: type(type), obj_idx(obj_idx), sub_obj_idx(sub_obj_idx)
|
|
|
|
{}
|
2018-12-03 11:13:18 +00:00
|
|
|
|
|
|
|
bool operator==(const ItemForDelete& r) const
|
|
|
|
{
|
|
|
|
return (type == r.type && obj_idx == r.obj_idx && sub_obj_idx == r.sub_obj_idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator<(const ItemForDelete& r) const
|
|
|
|
{
|
|
|
|
if (obj_idx != r.obj_idx)
|
|
|
|
return (obj_idx < r.obj_idx);
|
|
|
|
return (sub_obj_idx < r.sub_obj_idx);
|
|
|
|
}
|
2018-11-13 13:17:35 +00:00
|
|
|
};
|
|
|
|
|
2018-10-08 14:27:38 +00:00
|
|
|
class ObjectList : public wxDataViewCtrl
|
2018-10-04 14:43:10 +00:00
|
|
|
{
|
2019-07-23 14:17:37 +00:00
|
|
|
public:
|
2019-04-02 14:33:52 +00:00
|
|
|
enum SELECTION_MODE
|
|
|
|
{
|
2019-06-10 13:22:09 +00:00
|
|
|
smUndef = 0,
|
|
|
|
smVolume = 1,
|
|
|
|
smInstance = 2,
|
2019-07-23 14:17:37 +00:00
|
|
|
smLayer = 4,
|
2019-07-23 16:17:57 +00:00
|
|
|
smSettings = 8, // used for undo/redo
|
|
|
|
smLayerRoot = 16, // used for undo/redo
|
|
|
|
};
|
2018-12-12 07:40:10 +00:00
|
|
|
|
2019-07-23 14:17:37 +00:00
|
|
|
private:
|
2019-07-24 10:32:38 +00:00
|
|
|
SELECTION_MODE m_selection_mode {smUndef};
|
|
|
|
int m_selected_layers_range_idx;
|
2019-07-23 16:17:57 +00:00
|
|
|
|
2018-12-12 07:40:10 +00:00
|
|
|
struct dragged_item_data
|
|
|
|
{
|
2019-01-22 15:40:10 +00:00
|
|
|
void init(const int obj_idx, const int subobj_idx, const ItemType type) {
|
2018-12-12 07:40:10 +00:00
|
|
|
m_obj_idx = obj_idx;
|
2019-01-23 15:01:37 +00:00
|
|
|
m_type = type;
|
|
|
|
if (m_type&itVolume)
|
|
|
|
m_vol_idx = subobj_idx;
|
|
|
|
else
|
|
|
|
m_inst_idxs.insert(subobj_idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void init(const int obj_idx, const ItemType type) {
|
|
|
|
m_obj_idx = obj_idx;
|
2019-01-22 15:40:10 +00:00
|
|
|
m_type = type;
|
2018-12-12 07:40:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void clear() {
|
|
|
|
m_obj_idx = -1;
|
2019-01-23 15:01:37 +00:00
|
|
|
m_vol_idx = -1;
|
|
|
|
m_inst_idxs.clear();
|
2019-01-22 15:40:10 +00:00
|
|
|
m_type = itUndef;
|
2018-12-12 07:40:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int obj_idx() const { return m_obj_idx; }
|
2019-01-23 15:01:37 +00:00
|
|
|
int sub_obj_idx() const { return m_vol_idx; }
|
2019-01-22 15:40:10 +00:00
|
|
|
ItemType type() const { return m_type; }
|
2019-01-23 15:01:37 +00:00
|
|
|
std::set<int>& inst_idxs() { return m_inst_idxs; }
|
2018-12-12 07:40:10 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
int m_obj_idx = -1;
|
2019-01-23 15:01:37 +00:00
|
|
|
int m_vol_idx = -1;
|
|
|
|
std::set<int> m_inst_idxs{};
|
2019-01-22 15:40:10 +00:00
|
|
|
ItemType m_type = itUndef;
|
|
|
|
|
2018-12-12 07:40:10 +00:00
|
|
|
} m_dragged_data;
|
|
|
|
|
2018-10-05 21:29:15 +00:00
|
|
|
wxBoxSizer *m_sizer {nullptr};
|
2018-12-06 13:49:14 +00:00
|
|
|
wxWindow *m_parent {nullptr};
|
|
|
|
|
2019-04-24 23:45:00 +00:00
|
|
|
ScalableBitmap m_bmp_modifiermesh;
|
|
|
|
ScalableBitmap m_bmp_solidmesh;
|
|
|
|
ScalableBitmap m_bmp_support_enforcer;
|
|
|
|
ScalableBitmap m_bmp_support_blocker;
|
|
|
|
ScalableBitmap m_bmp_manifold_warning;
|
|
|
|
ScalableBitmap m_bmp_cog;
|
|
|
|
|
|
|
|
MenuWithSeparators m_menu_object;
|
|
|
|
MenuWithSeparators m_menu_part;
|
|
|
|
MenuWithSeparators m_menu_sla_object;
|
|
|
|
MenuWithSeparators m_menu_instance;
|
2019-06-03 13:35:21 +00:00
|
|
|
MenuWithSeparators m_menu_layer;
|
2019-09-19 10:30:16 +00:00
|
|
|
MenuWithSeparators m_menu_default;
|
2018-12-06 13:49:14 +00:00
|
|
|
wxMenuItem* m_menu_item_settings { nullptr };
|
2019-01-23 15:01:37 +00:00
|
|
|
wxMenuItem* m_menu_item_split_instances { nullptr };
|
2018-12-06 13:49:14 +00:00
|
|
|
|
2019-05-28 14:38:04 +00:00
|
|
|
ObjectDataViewModel *m_objects_model{ nullptr };
|
|
|
|
DynamicPrintConfig *m_config {nullptr};
|
|
|
|
std::vector<ModelObject*> *m_objects{ nullptr };
|
|
|
|
|
2019-10-02 09:53:50 +00:00
|
|
|
wxBitmapComboBox *m_extruder_editor { nullptr };
|
|
|
|
|
2019-06-10 13:22:09 +00:00
|
|
|
std::vector<wxBitmap*> m_bmp_vector;
|
|
|
|
|
|
|
|
t_layer_config_ranges m_layer_config_ranges_cache;
|
2018-11-02 11:35:26 +00:00
|
|
|
|
2018-10-04 14:43:10 +00:00
|
|
|
int m_selected_object_id = -1;
|
2018-10-05 21:29:15 +00:00
|
|
|
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
|
|
|
|
// calls this method again and again and again
|
2018-12-10 16:00:28 +00:00
|
|
|
|
|
|
|
bool m_prevent_update_extruder_in_config = false; // We use this flag to avoid updating of the extruder value in config
|
|
|
|
// during updating of the extruder count.
|
|
|
|
|
2019-03-04 08:41:25 +00:00
|
|
|
bool m_prevent_canvas_selection_update = false; // This flag prevents changing selection on the canvas. See function
|
|
|
|
// update_settings_items - updating canvas selection is undesirable,
|
|
|
|
// because it would turn off the gizmos (mainly a problem for the SLA gizmo)
|
|
|
|
|
2018-12-13 12:05:47 +00:00
|
|
|
int m_selected_row = 0;
|
2019-04-02 14:33:52 +00:00
|
|
|
wxDataViewItem m_last_selected_item {nullptr};
|
2019-08-22 09:47:58 +00:00
|
|
|
#ifdef __WXMSW__
|
|
|
|
// Workaround for entering the column editing mode on Windows. Simulate keyboard enter when another column of the active line is selected.
|
|
|
|
int m_last_selected_column = -1;
|
|
|
|
#endif /* __MSW__ */
|
2018-12-13 12:05:47 +00:00
|
|
|
|
2019-01-28 11:13:53 +00:00
|
|
|
#if 0
|
2019-07-11 21:46:23 +00:00
|
|
|
SettingsBundle m_freq_settings_fff;
|
|
|
|
SettingsBundle m_freq_settings_sla;
|
2019-01-28 11:13:53 +00:00
|
|
|
#endif
|
|
|
|
|
2020-01-27 13:31:41 +00:00
|
|
|
inline void ensure_current_item_visible()
|
|
|
|
{
|
|
|
|
if (const auto &item = this->GetCurrentItem())
|
|
|
|
this->EnsureVisible(item);
|
|
|
|
}
|
|
|
|
|
2018-10-04 14:43:10 +00:00
|
|
|
public:
|
|
|
|
ObjectList(wxWindow* parent);
|
2018-10-05 21:29:15 +00:00
|
|
|
~ObjectList();
|
|
|
|
|
|
|
|
|
|
|
|
std::map<std::string, wxBitmap> CATEGORY_ICON;
|
|
|
|
|
2019-05-28 14:38:04 +00:00
|
|
|
ObjectDataViewModel* GetModel() const { return m_objects_model; }
|
|
|
|
DynamicPrintConfig* config() const { return m_config; }
|
|
|
|
std::vector<ModelObject*>* objects() const { return m_objects; }
|
2018-10-05 21:29:15 +00:00
|
|
|
|
2019-05-28 14:38:04 +00:00
|
|
|
ModelObject* object(const int obj_idx) const ;
|
2018-10-04 14:43:10 +00:00
|
|
|
|
|
|
|
void create_objects_ctrl();
|
2019-01-30 09:05:54 +00:00
|
|
|
void create_popup_menus();
|
2019-09-06 15:46:55 +00:00
|
|
|
void update_objects_list_extruder_column(size_t extruders_count);
|
2019-10-01 16:19:28 +00:00
|
|
|
void update_extruder_colors();
|
2018-10-05 21:29:15 +00:00
|
|
|
// show/hide "Extruder" column for Objects List
|
2018-12-11 08:37:58 +00:00
|
|
|
void set_extruder_column_hidden(const bool hide) const;
|
2018-10-05 21:29:15 +00:00
|
|
|
// update extruder in current config
|
2018-12-11 08:37:58 +00:00
|
|
|
void update_extruder_in_config(const wxDataViewItem& item);
|
2018-12-12 13:35:18 +00:00
|
|
|
// update changed name in the object model
|
2019-01-30 10:35:37 +00:00
|
|
|
void update_name_in_model(const wxDataViewItem& item) const;
|
2019-09-06 15:46:55 +00:00
|
|
|
void update_extruder_values_for_items(const size_t max_extruder);
|
2018-10-05 21:29:15 +00:00
|
|
|
|
|
|
|
void init_icons();
|
2019-05-09 12:53:01 +00:00
|
|
|
void msw_rescale_icons();
|
2018-10-04 14:43:10 +00:00
|
|
|
|
2019-04-24 11:33:05 +00:00
|
|
|
// Get obj_idx and vol_idx values for the selected (by default) or an adjusted item
|
|
|
|
void get_selected_item_indexes(int& obj_idx, int& vol_idx, const wxDataViewItem& item = wxDataViewItem(0));
|
|
|
|
// Get count of errors in the mesh
|
|
|
|
int get_mesh_errors_count(const int obj_idx, const int vol_idx = -1) const;
|
|
|
|
/* Get list of errors in the mesh. Return value is a string, used for the tooltip
|
|
|
|
* Function without parameters is for a call from Manipulation panel,
|
|
|
|
* when we don't know parameters of selected item
|
|
|
|
*/
|
|
|
|
wxString get_mesh_errors_list(const int obj_idx, const int vol_idx = -1) const;
|
|
|
|
wxString get_mesh_errors_list();
|
2018-10-04 14:43:10 +00:00
|
|
|
void set_tooltip_for_item(const wxPoint& pt);
|
|
|
|
|
2018-10-11 13:57:09 +00:00
|
|
|
void selection_changed();
|
2019-09-19 10:30:16 +00:00
|
|
|
void show_context_menu(const bool evt_context_menu);
|
2019-10-02 09:53:50 +00:00
|
|
|
void extruder_editing();
|
2019-05-16 08:37:06 +00:00
|
|
|
#ifndef __WXOSX__
|
2018-10-11 13:57:09 +00:00
|
|
|
void key_event(wxKeyEvent& event);
|
2019-05-16 08:37:06 +00:00
|
|
|
#endif /* __WXOSX__ */
|
2018-10-05 21:29:15 +00:00
|
|
|
|
2019-06-11 08:11:42 +00:00
|
|
|
void copy();
|
|
|
|
void paste();
|
2019-07-05 18:27:44 +00:00
|
|
|
void undo();
|
|
|
|
void redo();
|
2019-06-11 08:11:42 +00:00
|
|
|
|
2018-12-07 16:50:48 +00:00
|
|
|
void get_settings_choice(const wxString& category_name);
|
2019-01-25 15:39:50 +00:00
|
|
|
void get_freq_settings_choice(const wxString& bundle_name);
|
2019-07-11 21:46:23 +00:00
|
|
|
void show_settings(const wxDataViewItem settings_item);
|
2019-12-11 15:07:00 +00:00
|
|
|
bool is_instance_or_object_selected();
|
2019-01-25 15:39:50 +00:00
|
|
|
|
2019-05-09 12:53:01 +00:00
|
|
|
wxMenu* append_submenu_add_generic(wxMenu* menu, const ModelVolumeType type);
|
2019-01-25 12:16:32 +00:00
|
|
|
void append_menu_items_add_volume(wxMenu* menu);
|
2018-12-07 16:50:48 +00:00
|
|
|
wxMenuItem* append_menu_item_split(wxMenu* menu);
|
2019-12-11 15:07:00 +00:00
|
|
|
wxMenuItem* append_menu_item_layers_editing(wxMenu* menu, wxWindow* parent);
|
2018-12-07 16:50:48 +00:00
|
|
|
wxMenuItem* append_menu_item_settings(wxMenu* menu);
|
2020-02-14 12:27:01 +00:00
|
|
|
wxMenuItem* append_menu_item_change_type(wxMenu* menu, wxWindow* parent = nullptr);
|
2019-05-13 12:27:51 +00:00
|
|
|
wxMenuItem* append_menu_item_instance_to_object(wxMenu* menu, wxWindow* parent);
|
2019-07-31 08:12:13 +00:00
|
|
|
wxMenuItem* append_menu_item_printable(wxMenu* menu, wxWindow* parent);
|
2019-03-21 08:04:11 +00:00
|
|
|
void append_menu_items_osx(wxMenu* menu);
|
2019-04-24 14:04:47 +00:00
|
|
|
wxMenuItem* append_menu_item_fix_through_netfabb(wxMenu* menu);
|
2019-09-19 07:09:11 +00:00
|
|
|
void append_menu_item_export_stl(wxMenu* menu) const;
|
|
|
|
void append_menu_item_reload_from_disk(wxMenu* menu) const;
|
2020-02-14 12:27:01 +00:00
|
|
|
void append_menu_item_change_extruder(wxMenu* menu);
|
2019-04-02 14:33:52 +00:00
|
|
|
void append_menu_item_delete(wxMenu* menu);
|
2019-05-23 07:20:11 +00:00
|
|
|
void append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu);
|
2018-12-06 13:49:14 +00:00
|
|
|
void create_object_popupmenu(wxMenu *menu);
|
2018-12-07 16:50:48 +00:00
|
|
|
void create_sla_object_popupmenu(wxMenu*menu);
|
|
|
|
void create_part_popupmenu(wxMenu*menu);
|
2019-01-23 15:01:37 +00:00
|
|
|
void create_instance_popupmenu(wxMenu*menu);
|
2019-09-19 10:30:16 +00:00
|
|
|
void create_default_popupmenu(wxMenu *menu);
|
2018-12-07 16:50:48 +00:00
|
|
|
wxMenu* create_settings_popupmenu(wxMenu *parent_menu);
|
2019-09-02 12:44:00 +00:00
|
|
|
void create_freq_settings_popupmenu(wxMenu *parent_menu, const bool is_object_settings = true);
|
2018-10-05 21:29:15 +00:00
|
|
|
|
2019-07-25 15:24:00 +00:00
|
|
|
void update_opt_keys(t_config_option_keys& t_optopt_keys, const bool is_object);
|
2018-11-29 14:00:23 +00:00
|
|
|
|
2019-02-22 11:12:10 +00:00
|
|
|
void load_subobject(ModelVolumeType type);
|
2019-04-29 13:27:59 +00:00
|
|
|
void load_part(ModelObject* model_object, std::vector<std::pair<wxString, bool>> &volumes_info, ModelVolumeType type);
|
2019-02-22 11:12:10 +00:00
|
|
|
void load_generic_subobject(const std::string& type_name, const ModelVolumeType type);
|
2019-09-19 10:30:16 +00:00
|
|
|
void load_shape_object(const std::string &type_name);
|
2018-11-13 13:17:35 +00:00
|
|
|
void del_object(const int obj_idx);
|
2018-10-12 10:00:37 +00:00
|
|
|
void del_subobject_item(wxDataViewItem& item);
|
2019-06-06 12:14:29 +00:00
|
|
|
void del_settings_from_config(const wxDataViewItem& parent_item);
|
2018-10-16 09:08:37 +00:00
|
|
|
void del_instances_from_object(const int obj_idx);
|
2019-06-06 12:14:29 +00:00
|
|
|
void del_layer_from_object(const int obj_idx, const t_layer_height_range& layer_range);
|
2019-05-30 14:53:17 +00:00
|
|
|
void del_layers_from_object(const int obj_idx);
|
2018-10-16 09:08:37 +00:00
|
|
|
bool del_subobject_from_object(const int obj_idx, const int idx, const int type);
|
2018-12-06 13:49:14 +00:00
|
|
|
void split();
|
2019-05-27 11:07:37 +00:00
|
|
|
void layers_editing();
|
2019-06-10 08:48:43 +00:00
|
|
|
|
|
|
|
wxDataViewItem add_layer_root_item(const wxDataViewItem obj_item);
|
2019-07-11 21:46:23 +00:00
|
|
|
wxDataViewItem add_settings_item(wxDataViewItem parent_item, const DynamicPrintConfig* config);
|
2019-06-10 08:48:43 +00:00
|
|
|
|
2019-06-05 14:47:09 +00:00
|
|
|
DynamicPrintConfig get_default_layer_config(const int obj_idx);
|
2018-12-06 13:49:14 +00:00
|
|
|
bool get_volume_by_item(const wxDataViewItem& item, ModelVolume*& volume);
|
|
|
|
bool is_splittable();
|
2019-01-23 15:01:37 +00:00
|
|
|
bool selected_instances_of_same_object();
|
|
|
|
bool can_split_instances();
|
2018-10-05 21:29:15 +00:00
|
|
|
|
2020-03-14 06:00:09 +00:00
|
|
|
wxPoint get_mouse_position_in_control() const { return wxGetMousePosition() - this->GetScreenPosition(); }
|
2018-10-31 11:56:08 +00:00
|
|
|
wxBoxSizer* get_sizer() {return m_sizer;}
|
2018-10-12 10:00:37 +00:00
|
|
|
int get_selected_obj_idx() const;
|
2019-03-28 15:28:34 +00:00
|
|
|
DynamicPrintConfig& get_item_config(const wxDataViewItem& item) const;
|
2019-07-25 15:24:00 +00:00
|
|
|
SettingsBundle get_item_settings_bundle(const DynamicPrintConfig* config, const bool is_object_settings);
|
2018-10-05 21:29:15 +00:00
|
|
|
|
2019-04-21 23:51:10 +00:00
|
|
|
void changed_object(const int obj_idx = -1) const;
|
2019-03-28 15:28:34 +00:00
|
|
|
void part_selection_changed();
|
2018-10-05 21:29:15 +00:00
|
|
|
|
|
|
|
// Add object to the list
|
2019-07-05 17:06:19 +00:00
|
|
|
void add_object_to_list(size_t obj_idx, bool call_selection_changed = true);
|
2018-10-05 21:29:15 +00:00
|
|
|
// Delete object from the list
|
|
|
|
void delete_object_from_list();
|
2018-10-12 10:00:37 +00:00
|
|
|
void delete_object_from_list(const size_t obj_idx);
|
|
|
|
void delete_volume_from_list(const size_t obj_idx, const size_t vol_idx);
|
2018-11-13 12:34:31 +00:00
|
|
|
void delete_instance_from_list(const size_t obj_idx, const size_t inst_idx);
|
2018-11-13 13:17:35 +00:00
|
|
|
void delete_from_model_and_list(const ItemType type, const int obj_idx, const int sub_obj_idx);
|
2018-11-14 07:53:56 +00:00
|
|
|
void delete_from_model_and_list(const std::vector<ItemForDelete>& items_for_delete);
|
2018-10-05 21:29:15 +00:00
|
|
|
// Delete all objects from the list
|
|
|
|
void delete_all_objects_from_list();
|
2018-10-18 08:40:26 +00:00
|
|
|
// Increase instances count
|
|
|
|
void increase_object_instances(const size_t obj_idx, const size_t num);
|
|
|
|
// Decrease instances count
|
|
|
|
void decrease_object_instances(const size_t obj_idx, const size_t num);
|
2018-10-11 13:57:09 +00:00
|
|
|
|
|
|
|
// #ys_FIXME_to_delete
|
2018-10-05 21:29:15 +00:00
|
|
|
// Unselect all objects in the list on c++ side
|
|
|
|
void unselect_objects();
|
|
|
|
// Select current object in the list on c++ side
|
|
|
|
void select_current_object(int idx);
|
|
|
|
// Select current volume in the list on c++ side
|
|
|
|
void select_current_volume(int idx, int vol_idx);
|
2018-10-11 13:57:09 +00:00
|
|
|
|
2018-10-05 21:29:15 +00:00
|
|
|
// Remove objects/sub-object from the list
|
|
|
|
void remove();
|
2019-06-05 09:50:59 +00:00
|
|
|
void del_layer_range(const t_layer_height_range& range);
|
2020-03-11 08:10:25 +00:00
|
|
|
// Add a new layer height after the current range if possible.
|
|
|
|
// The current range is shortened and the new range is entered after the shortened current range if it fits.
|
|
|
|
// If no range fits after the current range, then no range is inserted.
|
|
|
|
// The layer range panel is updated even if this function does not change the layer ranges, as the panel update
|
|
|
|
// may have been postponed from the "kill focus" event of a text field, if the focus was lost for the "add layer" button.
|
|
|
|
// Rather providing the range by a value than by a reference, so that the memory referenced cannot be invalidated.
|
|
|
|
void add_layer_range_after_current(const t_layer_height_range current_range);
|
2020-03-12 13:50:20 +00:00
|
|
|
wxString can_add_new_range_after_current( t_layer_height_range current_range);
|
2019-06-05 09:50:59 +00:00
|
|
|
void add_layer_item (const t_layer_height_range& range,
|
2019-05-31 13:29:09 +00:00
|
|
|
const wxDataViewItem layers_item,
|
|
|
|
const int layer_idx = -1);
|
2019-06-12 14:28:25 +00:00
|
|
|
bool edit_layer_range(const t_layer_height_range& range, coordf_t layer_height);
|
2020-03-11 08:10:25 +00:00
|
|
|
// This function may be called when a text field loses focus for a "add layer" or "remove layer" button.
|
|
|
|
// In that case we don't want to destroy the panel with that "add layer" or "remove layer" buttons, as some messages
|
|
|
|
// are already planned for them and destroying these widgets leads to crashes at least on OSX.
|
|
|
|
// In that case the "add layer" or "remove layer" button handlers are responsible for always rebuilding the panel
|
|
|
|
// even if the "add layer" or "remove layer" buttons did not update the layer spans or layer heights.
|
2019-06-12 14:28:25 +00:00
|
|
|
bool edit_layer_range(const t_layer_height_range& range,
|
2020-03-11 08:10:25 +00:00
|
|
|
const t_layer_height_range& new_range,
|
|
|
|
// Don't destroy the panel with the "add layer" or "remove layer" buttons.
|
|
|
|
bool suppress_ui_update = false);
|
2018-10-05 21:29:15 +00:00
|
|
|
|
|
|
|
void init_objects();
|
2018-10-10 14:22:20 +00:00
|
|
|
bool multiple_selection() const ;
|
2019-03-29 13:36:09 +00:00
|
|
|
bool is_selected(const ItemType type) const;
|
2019-07-24 10:32:38 +00:00
|
|
|
int get_selected_layers_range_idx() const;
|
|
|
|
void set_selected_layers_range_idx(const int range_idx) { m_selected_layers_range_idx = range_idx; }
|
2019-07-23 14:17:37 +00:00
|
|
|
void set_selection_mode(SELECTION_MODE mode) { m_selection_mode = mode; }
|
2018-10-11 13:57:09 +00:00
|
|
|
void update_selections();
|
|
|
|
void update_selections_on_canvas();
|
|
|
|
void select_item(const wxDataViewItem& item);
|
|
|
|
void select_items(const wxDataViewItemArray& sels);
|
2018-10-12 10:00:37 +00:00
|
|
|
void select_all();
|
2018-11-08 14:45:55 +00:00
|
|
|
void select_item_all_children();
|
2019-04-02 14:33:52 +00:00
|
|
|
void update_selection_mode();
|
2019-04-04 13:07:54 +00:00
|
|
|
bool check_last_selection(wxString& msg_str);
|
2018-10-11 13:57:09 +00:00
|
|
|
// correct current selections to avoid of the possible conflicts
|
|
|
|
void fix_multiselection_conflicts();
|
2018-11-02 22:27:31 +00:00
|
|
|
|
|
|
|
ModelVolume* get_selected_model_volume();
|
|
|
|
void change_part_type();
|
2018-11-12 12:47:24 +00:00
|
|
|
|
|
|
|
void last_volume_is_deleted(const int obj_idx);
|
2018-11-29 14:00:23 +00:00
|
|
|
void update_settings_items();
|
2019-07-12 11:55:46 +00:00
|
|
|
void update_and_show_object_settings_item();
|
2019-06-10 13:22:09 +00:00
|
|
|
void update_settings_item_and_selection(wxDataViewItem item, wxDataViewItemArray& selections);
|
2019-06-10 08:48:43 +00:00
|
|
|
void update_object_list_by_printer_technology();
|
2019-01-25 09:34:32 +00:00
|
|
|
void update_object_menu();
|
2018-12-04 13:27:39 +00:00
|
|
|
|
2019-01-23 15:01:37 +00:00
|
|
|
void instances_to_separated_object(const int obj_idx, const std::set<int>& inst_idx);
|
2019-04-04 16:01:53 +00:00
|
|
|
void instances_to_separated_objects(const int obj_idx);
|
2019-01-23 15:01:37 +00:00
|
|
|
void split_instances();
|
2019-01-30 10:35:37 +00:00
|
|
|
void rename_item();
|
2019-04-24 11:33:05 +00:00
|
|
|
void fix_through_netfabb();
|
2019-03-13 14:34:27 +00:00
|
|
|
void update_item_error_icon(const int obj_idx, int vol_idx) const ;
|
2019-04-10 06:40:58 +00:00
|
|
|
|
2019-06-10 13:22:09 +00:00
|
|
|
void fill_layer_config_ranges_cache();
|
|
|
|
void paste_layers_into_list();
|
2019-04-10 06:40:58 +00:00
|
|
|
void paste_volumes_into_list(int obj_idx, const ModelVolumePtrs& volumes);
|
2019-04-10 13:55:32 +00:00
|
|
|
void paste_objects_into_list(const std::vector<size_t>& object_idxs);
|
2019-04-10 06:40:58 +00:00
|
|
|
|
2019-04-24 23:45:00 +00:00
|
|
|
void msw_rescale();
|
2019-04-13 21:46:52 +00:00
|
|
|
|
2019-07-11 16:42:02 +00:00
|
|
|
void update_after_undo_redo();
|
2019-08-05 08:05:28 +00:00
|
|
|
//update printable state for item from objects model
|
2019-08-05 06:44:55 +00:00
|
|
|
void update_printable_state(int obj_idx, int instance_idx);
|
2019-08-05 08:05:28 +00:00
|
|
|
void toggle_printable_state(wxDataViewItem item);
|
2019-07-04 15:33:19 +00:00
|
|
|
|
2019-12-18 08:06:21 +00:00
|
|
|
void show_multi_selection_menu();
|
|
|
|
|
2018-12-04 13:27:39 +00:00
|
|
|
private:
|
2019-05-16 08:37:06 +00:00
|
|
|
#ifdef __WXOSX__
|
|
|
|
// void OnChar(wxKeyEvent& event);
|
|
|
|
#endif /* __WXOSX__ */
|
2018-12-11 08:37:58 +00:00
|
|
|
void OnContextMenu(wxDataViewEvent &event);
|
2020-03-10 11:03:08 +00:00
|
|
|
void list_manipulation(const wxPoint& mouse_pos, bool evt_context_menu = false);
|
2018-12-11 08:37:58 +00:00
|
|
|
|
|
|
|
void OnBeginDrag(wxDataViewEvent &event);
|
|
|
|
void OnDropPossible(wxDataViewEvent &event);
|
|
|
|
void OnDrop(wxDataViewEvent &event);
|
2019-01-22 15:40:10 +00:00
|
|
|
bool can_drop(const wxDataViewItem& item) const ;
|
2018-12-11 08:37:58 +00:00
|
|
|
|
2018-12-10 12:39:56 +00:00
|
|
|
void ItemValueChanged(wxDataViewEvent &event);
|
2019-08-22 09:47:58 +00:00
|
|
|
#ifdef __WXMSW__
|
|
|
|
// Workaround for entering the column editing mode on Windows. Simulate keyboard enter when another column of the active line is selected.
|
|
|
|
void OnEditingStarted(wxDataViewEvent &event);
|
|
|
|
#endif /* __WXMSW__ */
|
2018-12-12 13:35:18 +00:00
|
|
|
void OnEditingDone(wxDataViewEvent &event);
|
2019-03-14 12:15:04 +00:00
|
|
|
void extruder_selection();
|
|
|
|
void set_extruder_for_selected_items(const int extruder) const ;
|
|
|
|
|
2019-01-28 11:13:53 +00:00
|
|
|
std::vector<std::string> get_options(const bool is_part);
|
|
|
|
const std::vector<std::string>& get_options_for_bundle(const wxString& bundle_name);
|
|
|
|
void get_options_menu(settings_menu_hierarchy& settings_menu, const bool is_part);
|
2018-10-04 14:43:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
#endif //slic3r_GUI_ObjectList_hpp_
|