Deleted "scale" column from object list
This commit is contained in:
parent
7fd7d83470
commit
6c1b52afa2
@ -136,7 +136,7 @@ sub new {
|
|||||||
$_->set_scaling_factor($scale) for @{ $model_object->instances };
|
$_->set_scaling_factor($scale) for @{ $model_object->instances };
|
||||||
|
|
||||||
# Set object scale on c++ side
|
# Set object scale on c++ side
|
||||||
Slic3r::GUI::set_object_scale($obj_idx, $model_object->instances->[0]->scaling_factor * 100);
|
# Slic3r::GUI::set_object_scale($obj_idx, $model_object->instances->[0]->scaling_factor * 100);
|
||||||
|
|
||||||
# $object->transform_thumbnail($self->{model}, $obj_idx);
|
# $object->transform_thumbnail($self->{model}, $obj_idx);
|
||||||
|
|
||||||
@ -1278,7 +1278,7 @@ sub changescale {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Set object scale on c++ side
|
# Set object scale on c++ side
|
||||||
Slic3r::GUI::set_object_scale($obj_idx, $scale);
|
# Slic3r::GUI::set_object_scale($obj_idx, $scale);
|
||||||
$scale /= 100; # turn percent into factor
|
$scale /= 100; # turn percent into factor
|
||||||
|
|
||||||
my $variation = $scale / $model_instance->scaling_factor;
|
my $variation = $scale / $model_instance->scaling_factor;
|
||||||
|
@ -226,7 +226,7 @@ wxDataViewColumn* object_ctrl_create_extruder_column(int extruders_count)
|
|||||||
choices.Add(wxString::Format("%d", i));
|
choices.Add(wxString::Format("%d", i));
|
||||||
wxDataViewChoiceRenderer *c =
|
wxDataViewChoiceRenderer *c =
|
||||||
new wxDataViewChoiceRenderer(choices, wxDATAVIEW_CELL_EDITABLE, wxALIGN_CENTER_HORIZONTAL);
|
new wxDataViewChoiceRenderer(choices, wxDATAVIEW_CELL_EDITABLE, wxALIGN_CENTER_HORIZONTAL);
|
||||||
wxDataViewColumn* column = new wxDataViewColumn(_(L("Extruder")), c, 3, 60, wxALIGN_CENTER_HORIZONTAL, wxDATAVIEW_COL_RESIZABLE);
|
wxDataViewColumn* column = new wxDataViewColumn(_(L("Extruder")), c, 2, 60, wxALIGN_CENTER_HORIZONTAL, wxDATAVIEW_COL_RESIZABLE);
|
||||||
return column;
|
return column;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ void create_objects_ctrl(wxWindow* win, wxBoxSizer*& objects_sz)
|
|||||||
#endif // wxUSE_DRAG_AND_DROP && wxUSE_UNICODE
|
#endif // wxUSE_DRAG_AND_DROP && wxUSE_UNICODE
|
||||||
|
|
||||||
// column 0(Icon+Text) of the view control:
|
// column 0(Icon+Text) of the view control:
|
||||||
m_objects_ctrl->AppendIconTextColumn(_(L("Name")), 0, wxDATAVIEW_CELL_INERT, 120,
|
m_objects_ctrl->AppendIconTextColumn(_(L("Name")), 0, wxDATAVIEW_CELL_INERT, 200,
|
||||||
wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE);
|
wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE);
|
||||||
|
|
||||||
// column 1 of the view control:
|
// column 1 of the view control:
|
||||||
@ -254,14 +254,10 @@ void create_objects_ctrl(wxWindow* win, wxBoxSizer*& objects_sz)
|
|||||||
wxALIGN_CENTER_HORIZONTAL, wxDATAVIEW_COL_RESIZABLE);
|
wxALIGN_CENTER_HORIZONTAL, wxDATAVIEW_COL_RESIZABLE);
|
||||||
|
|
||||||
// column 2 of the view control:
|
// column 2 of the view control:
|
||||||
m_objects_ctrl->AppendTextColumn(_(L("Scale")), 2, wxDATAVIEW_CELL_INERT, 55,
|
|
||||||
wxALIGN_CENTER_HORIZONTAL, wxDATAVIEW_COL_RESIZABLE);
|
|
||||||
|
|
||||||
// column 3 of the view control:
|
|
||||||
m_objects_ctrl->AppendColumn(object_ctrl_create_extruder_column(4));
|
m_objects_ctrl->AppendColumn(object_ctrl_create_extruder_column(4));
|
||||||
|
|
||||||
// column 4 of the view control:
|
// column 3 of the view control:
|
||||||
m_objects_ctrl->AppendBitmapColumn(" ", 4, wxDATAVIEW_CELL_INERT, 25,
|
m_objects_ctrl->AppendBitmapColumn(" ", 3, wxDATAVIEW_CELL_INERT, 25,
|
||||||
wxALIGN_CENTER_HORIZONTAL, wxDATAVIEW_COL_RESIZABLE);
|
wxALIGN_CENTER_HORIZONTAL, wxDATAVIEW_COL_RESIZABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,8 +655,7 @@ void show_collpane_settings(bool expert_mode)
|
|||||||
void add_object_to_list(const std::string &name, ModelObject* model_object)
|
void add_object_to_list(const std::string &name, ModelObject* model_object)
|
||||||
{
|
{
|
||||||
wxString item_name = name;
|
wxString item_name = name;
|
||||||
int scale = model_object->instances[0]->scaling_factor * 100;
|
auto item = m_objects_model->Add(item_name, model_object->instances.size());
|
||||||
auto item = m_objects_model->Add(item_name, model_object->instances.size(), scale);
|
|
||||||
m_objects_ctrl->Select(item);
|
m_objects_ctrl->Select(item);
|
||||||
|
|
||||||
// Add error icon if detected auto-repaire
|
// Add error icon if detected auto-repaire
|
||||||
@ -697,6 +692,8 @@ void delete_object_from_list()
|
|||||||
// m_objects_ctrl->Select(m_objects_model->Delete(item));
|
// m_objects_ctrl->Select(m_objects_model->Delete(item));
|
||||||
m_objects_model->Delete(item);
|
m_objects_model->Delete(item);
|
||||||
|
|
||||||
|
part_selection_changed();
|
||||||
|
|
||||||
// if (m_objects_model->IsEmpty())
|
// if (m_objects_model->IsEmpty())
|
||||||
// m_collpane_settings->Show(false);
|
// m_collpane_settings->Show(false);
|
||||||
}
|
}
|
||||||
@ -704,6 +701,8 @@ void delete_object_from_list()
|
|||||||
void delete_all_objects_from_list()
|
void delete_all_objects_from_list()
|
||||||
{
|
{
|
||||||
m_objects_model->DeleteAll();
|
m_objects_model->DeleteAll();
|
||||||
|
|
||||||
|
part_selection_changed();
|
||||||
// m_collpane_settings->Show(false);
|
// m_collpane_settings->Show(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -713,12 +712,6 @@ void set_object_count(int idx, int count)
|
|||||||
m_objects_ctrl->Refresh();
|
m_objects_ctrl->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_object_scale(int idx, int scale)
|
|
||||||
{
|
|
||||||
m_objects_model->SetValue(wxString::Format("%d%%", scale), idx, 2);
|
|
||||||
m_objects_ctrl->Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
void unselect_objects()
|
void unselect_objects()
|
||||||
{
|
{
|
||||||
if (!m_objects_ctrl->GetSelection())
|
if (!m_objects_ctrl->GetSelection())
|
||||||
@ -834,10 +827,10 @@ void object_ctrl_key_event(wxKeyEvent& event)
|
|||||||
|
|
||||||
void object_ctrl_item_value_change(wxDataViewEvent& event)
|
void object_ctrl_item_value_change(wxDataViewEvent& event)
|
||||||
{
|
{
|
||||||
if (event.GetColumn() == 3)
|
if (event.GetColumn() == 2)
|
||||||
{
|
{
|
||||||
wxVariant variant;
|
wxVariant variant;
|
||||||
m_objects_model->GetValue(variant, event.GetItem(), 3);
|
m_objects_model->GetValue(variant, event.GetItem(), 2);
|
||||||
#ifdef __WXOSX__
|
#ifdef __WXOSX__
|
||||||
g_selected_extruder = variant.GetString();
|
g_selected_extruder = variant.GetString();
|
||||||
#else // --> for Linux
|
#else // --> for Linux
|
||||||
@ -930,8 +923,8 @@ void update_settings_list()
|
|||||||
no_updates.reset(nullptr);
|
no_updates.reset(nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
get_right_panel()->Layout();
|
/*get_right_panel()*/parent->Layout();
|
||||||
get_right_panel()->GetParent()->Layout();
|
get_right_panel()->GetParent()->GetParent()->Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_settings_choice(wxMenu *menu, int id, bool is_part)
|
void get_settings_choice(wxMenu *menu, int id, bool is_part)
|
||||||
@ -1523,7 +1516,7 @@ void part_selection_changed()
|
|||||||
|
|
||||||
void set_extruder_column_hidden(bool hide)
|
void set_extruder_column_hidden(bool hide)
|
||||||
{
|
{
|
||||||
m_objects_ctrl->GetColumn(3)->SetHidden(hide);
|
m_objects_ctrl->GetColumn(2)->SetHidden(hide);
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_extruder_in_config(const wxString& selection)
|
void update_extruder_in_config(const wxString& selection)
|
||||||
@ -1668,9 +1661,9 @@ void update_objects_list_extruder_column(int extruders_count)
|
|||||||
extruders_count = 1;
|
extruders_count = 1;
|
||||||
|
|
||||||
// delete old 3rd column
|
// delete old 3rd column
|
||||||
m_objects_ctrl->DeleteColumn(m_objects_ctrl->GetColumn(3));
|
m_objects_ctrl->DeleteColumn(m_objects_ctrl->GetColumn(2));
|
||||||
// insert new created 3rd column
|
// insert new created 3rd column
|
||||||
m_objects_ctrl->InsertColumn(3, object_ctrl_create_extruder_column(extruders_count));
|
m_objects_ctrl->InsertColumn(2, object_ctrl_create_extruder_column(extruders_count));
|
||||||
// set show/hide for this column
|
// set show/hide for this column
|
||||||
set_extruder_column_hidden(extruders_count <= 1);
|
set_extruder_column_hidden(extruders_count <= 1);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ class wxArrayString;
|
|||||||
class wxMenu;
|
class wxMenu;
|
||||||
class wxDataViewEvent;
|
class wxDataViewEvent;
|
||||||
class wxKeyEvent;
|
class wxKeyEvent;
|
||||||
|
class wxControl;
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
class ModelObject;
|
class ModelObject;
|
||||||
@ -61,8 +62,6 @@ void delete_object_from_list();
|
|||||||
void delete_all_objects_from_list();
|
void delete_all_objects_from_list();
|
||||||
// Set count of object on c++ side
|
// Set count of object on c++ side
|
||||||
void set_object_count(int idx, int count);
|
void set_object_count(int idx, int count);
|
||||||
// Set object scale on c++ side
|
|
||||||
void set_object_scale(int idx, int scale);
|
|
||||||
// Unselect all objects in the list on c++ side
|
// Unselect all objects in the list on c++ side
|
||||||
void unselect_objects();
|
void unselect_objects();
|
||||||
// Select current object in the list on c++ side
|
// Select current object in the list on c++ side
|
||||||
@ -70,6 +69,8 @@ void select_current_object(int idx);
|
|||||||
// Remove objects/sub-object from the list
|
// Remove objects/sub-object from the list
|
||||||
void remove();
|
void remove();
|
||||||
|
|
||||||
|
//void create_double_slider(wxWindow* parent, wxControl* slider);
|
||||||
|
|
||||||
void object_ctrl_selection_changed();
|
void object_ctrl_selection_changed();
|
||||||
void object_ctrl_context_menu();
|
void object_ctrl_context_menu();
|
||||||
void object_ctrl_key_event(wxKeyEvent& event);
|
void object_ctrl_key_event(wxKeyEvent& event);
|
||||||
|
@ -362,7 +362,7 @@ void PrusaObjectDataViewModelNode::set_part_action_icon() {
|
|||||||
// PrusaObjectDataViewModel
|
// PrusaObjectDataViewModel
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxDataViewItem PrusaObjectDataViewModel::Add(wxString &name)
|
wxDataViewItem PrusaObjectDataViewModel::Add(const wxString &name)
|
||||||
{
|
{
|
||||||
auto root = new PrusaObjectDataViewModelNode(name);
|
auto root = new PrusaObjectDataViewModelNode(name);
|
||||||
m_objects.push_back(root);
|
m_objects.push_back(root);
|
||||||
@ -373,9 +373,9 @@ wxDataViewItem PrusaObjectDataViewModel::Add(wxString &name)
|
|||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataViewItem PrusaObjectDataViewModel::Add(wxString &name, int instances_count, int scale)
|
wxDataViewItem PrusaObjectDataViewModel::Add(const wxString &name, const int instances_count/*, int scale*/)
|
||||||
{
|
{
|
||||||
auto root = new PrusaObjectDataViewModelNode(name, instances_count, scale);
|
auto root = new PrusaObjectDataViewModelNode(name, instances_count);
|
||||||
m_objects.push_back(root);
|
m_objects.push_back(root);
|
||||||
// notify control
|
// notify control
|
||||||
wxDataViewItem child((void*)root);
|
wxDataViewItem child((void*)root);
|
||||||
@ -562,15 +562,6 @@ wxString PrusaObjectDataViewModel::GetCopy(const wxDataViewItem &item) const
|
|||||||
return node->m_copy;
|
return node->m_copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString PrusaObjectDataViewModel::GetScale(const wxDataViewItem &item) const
|
|
||||||
{
|
|
||||||
PrusaObjectDataViewModelNode *node = (PrusaObjectDataViewModelNode*)item.GetID();
|
|
||||||
if (!node) // happens if item.IsOk()==false
|
|
||||||
return wxEmptyString;
|
|
||||||
|
|
||||||
return node->m_scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxIcon& PrusaObjectDataViewModel::GetIcon(const wxDataViewItem &item) const
|
wxIcon& PrusaObjectDataViewModel::GetIcon(const wxDataViewItem &item) const
|
||||||
{
|
{
|
||||||
PrusaObjectDataViewModelNode *node = (PrusaObjectDataViewModelNode*)item.GetID();
|
PrusaObjectDataViewModelNode *node = (PrusaObjectDataViewModelNode*)item.GetID();
|
||||||
@ -592,12 +583,9 @@ void PrusaObjectDataViewModel::GetValue(wxVariant &variant, const wxDataViewItem
|
|||||||
variant = node->m_copy;
|
variant = node->m_copy;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
variant = node->m_scale;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
variant = node->m_extruder;
|
variant = node->m_extruder;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 3:
|
||||||
variant << node->m_action_icon;
|
variant << node->m_action_icon;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1016,8 +1004,8 @@ wxString PrusaDoubleSlider::get_label(const SelectedSlider& selection) const
|
|||||||
|
|
||||||
const wxString str = m_values.empty() ?
|
const wxString str = m_values.empty() ?
|
||||||
wxNumberFormatter::ToString(m_label_koef*value, 2, wxNumberFormatter::Style_None) :
|
wxNumberFormatter::ToString(m_label_koef*value, 2, wxNumberFormatter::Style_None) :
|
||||||
wxNumberFormatter::ToString(m_values[value], 2, wxNumberFormatter::Style_None);
|
wxNumberFormatter::ToString(m_values[value].second, 2, wxNumberFormatter::Style_None);
|
||||||
return wxString::Format("%s\n(%d)", str, value);
|
return wxString::Format("%s\n(%d)", str, m_values.empty() ? value : m_values[value].first);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrusaDoubleSlider::draw_thumb_text(wxDC& dc, const wxPoint& pos, const SelectedSlider& selection) const
|
void PrusaDoubleSlider::draw_thumb_text(wxDC& dc, const wxPoint& pos, const SelectedSlider& selection) const
|
||||||
|
@ -157,11 +157,10 @@ class PrusaObjectDataViewModelNode
|
|||||||
MyObjectTreeModelNodePtrArray m_children;
|
MyObjectTreeModelNodePtrArray m_children;
|
||||||
wxIcon m_empty_icon;
|
wxIcon m_empty_icon;
|
||||||
public:
|
public:
|
||||||
PrusaObjectDataViewModelNode(const wxString &name, int instances_count=1, int scale=100) {
|
PrusaObjectDataViewModelNode(const wxString &name, const int instances_count=1) {
|
||||||
m_parent = NULL;
|
m_parent = NULL;
|
||||||
m_name = name;
|
m_name = name;
|
||||||
m_copy = wxString::Format("%d", instances_count);
|
m_copy = wxString::Format("%d", instances_count);
|
||||||
m_scale = wxString::Format("%d%%", scale);
|
|
||||||
m_type = "object";
|
m_type = "object";
|
||||||
m_volume_id = -1;
|
m_volume_id = -1;
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
@ -181,7 +180,6 @@ public:
|
|||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
m_name = sub_obj_name;
|
m_name = sub_obj_name;
|
||||||
m_copy = wxEmptyString;
|
m_copy = wxEmptyString;
|
||||||
m_scale = wxEmptyString;
|
|
||||||
m_icon = icon;
|
m_icon = icon;
|
||||||
m_type = "volume";
|
m_type = "volume";
|
||||||
m_volume_id = volume_id;
|
m_volume_id = volume_id;
|
||||||
@ -203,7 +201,6 @@ public:
|
|||||||
wxString m_name;
|
wxString m_name;
|
||||||
wxIcon& m_icon = m_empty_icon;
|
wxIcon& m_icon = m_empty_icon;
|
||||||
wxString m_copy;
|
wxString m_copy;
|
||||||
wxString m_scale;
|
|
||||||
std::string m_type;
|
std::string m_type;
|
||||||
int m_volume_id;
|
int m_volume_id;
|
||||||
bool m_container = false;
|
bool m_container = false;
|
||||||
@ -270,12 +267,9 @@ public:
|
|||||||
m_copy = variant.GetString();
|
m_copy = variant.GetString();
|
||||||
return true;
|
return true;
|
||||||
case 2:
|
case 2:
|
||||||
m_scale = variant.GetString();
|
|
||||||
return true;
|
|
||||||
case 3:
|
|
||||||
m_extruder = variant.GetString();
|
m_extruder = variant.GetString();
|
||||||
return true;
|
return true;
|
||||||
case 4:
|
case 3:
|
||||||
m_action_icon << variant;
|
m_action_icon << variant;
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
@ -349,8 +343,8 @@ public:
|
|||||||
delete object;
|
delete object;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataViewItem Add(wxString &name);
|
wxDataViewItem Add(const wxString &name);
|
||||||
wxDataViewItem Add(wxString &name, int instances_count, int scale);
|
wxDataViewItem Add(const wxString &name, const int instances_count);
|
||||||
wxDataViewItem AddChild(const wxDataViewItem &parent_item,
|
wxDataViewItem AddChild(const wxDataViewItem &parent_item,
|
||||||
const wxString &name,
|
const wxString &name,
|
||||||
const wxIcon& icon,
|
const wxIcon& icon,
|
||||||
@ -368,7 +362,6 @@ public:
|
|||||||
|
|
||||||
wxString GetName(const wxDataViewItem &item) const;
|
wxString GetName(const wxDataViewItem &item) const;
|
||||||
wxString GetCopy(const wxDataViewItem &item) const;
|
wxString GetCopy(const wxDataViewItem &item) const;
|
||||||
wxString GetScale(const wxDataViewItem &item) const;
|
|
||||||
wxIcon& GetIcon(const wxDataViewItem &item) const;
|
wxIcon& GetIcon(const wxDataViewItem &item) const;
|
||||||
|
|
||||||
// helper methods to change the model
|
// helper methods to change the model
|
||||||
@ -542,7 +535,7 @@ public:
|
|||||||
void SetKoefForLabels(const double koef) {
|
void SetKoefForLabels(const double koef) {
|
||||||
m_label_koef = koef;
|
m_label_koef = koef;
|
||||||
}
|
}
|
||||||
void SetSliderValues(const std::vector<double>& values) {
|
void SetSliderValues(const std::vector<std::pair<int, double>>& values) {
|
||||||
m_values = values;
|
m_values = values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,7 +631,7 @@ private:
|
|||||||
std::vector<wxPen*> line_pens;
|
std::vector<wxPen*> line_pens;
|
||||||
std::vector<wxPen*> segm_pens;
|
std::vector<wxPen*> segm_pens;
|
||||||
std::set<int> m_ticks;
|
std::set<int> m_ticks;
|
||||||
std::vector<double> m_values;
|
std::vector<std::pair<int,double>> m_values;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,9 +146,6 @@ void delete_all_objects_from_list()
|
|||||||
void set_object_count(int idx, int count)
|
void set_object_count(int idx, int count)
|
||||||
%code%{ Slic3r::GUI::set_object_count(idx, count); %};
|
%code%{ Slic3r::GUI::set_object_count(idx, count); %};
|
||||||
|
|
||||||
void set_object_scale(int idx, int scale)
|
|
||||||
%code%{ Slic3r::GUI::set_object_scale(idx, scale); %};
|
|
||||||
|
|
||||||
void unselect_objects()
|
void unselect_objects()
|
||||||
%code%{ Slic3r::GUI::unselect_objects(); %};
|
%code%{ Slic3r::GUI::unselect_objects(); %};
|
||||||
|
|
||||||
@ -185,3 +182,7 @@ void register_on_request_update_callback(SV* callback)
|
|||||||
void deregister_on_request_update_callback()
|
void deregister_on_request_update_callback()
|
||||||
%code%{ Slic3r::GUI::g_on_request_update_callback.deregister_callback(); %};
|
%code%{ Slic3r::GUI::g_on_request_update_callback.deregister_callback(); %};
|
||||||
|
|
||||||
|
//void create_double_slider(SV *ui_parent, SV *ui_ds)
|
||||||
|
// %code%{ Slic3r::GUI::create_double_slider( (wxWindow*)wxPli_sv_2_object(aTHX_ ui_parent, "Wx::Window"),
|
||||||
|
// (wxControl*)wxPli_sv_2_object(aTHX_ ui_ds, "Wx::Control")); %};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user