Changed Manipulation panel. (Simple mode)There is exclamation mark icon next for the object name, if it has errors.

+ some code refactoring
This commit is contained in:
YuSanka 2019-04-24 13:33:05 +02:00
parent e9d629f248
commit 203e9e848c
4 changed files with 183 additions and 65 deletions

View file

@ -10,6 +10,7 @@
#include "Selection.hpp"
#include <boost/algorithm/string.hpp>
#include "slic3r/Utils/FixModelByWin10.hpp"
namespace Slic3r
{
@ -20,6 +21,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
OG_Settings(parent, true)
#ifndef __APPLE__
, m_focused_option("")
, m_manifold_warning_bmp(create_scaled_bitmap(parent, "exclamation"))
#endif // __APPLE__
{
m_og->set_name(_(L("Object Manipulation")));
@ -42,17 +44,47 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
ConfigOptionDef def;
// Objects(sub-objects) name
def.label = L("Name");
// def.label = L("Name");
// def.gui_type = "legend";
// def.tooltip = L("Object name");
// def.width = 21 * wxGetApp().em_unit();
// def.default_value = new ConfigOptionString{ " " };
// m_og->append_single_option_line(Option(def, "object_name"));
Line line = Line{ "Name", "Object name" };
auto manifold_warning_icon = [this](wxWindow* parent) {
m_fix_throught_netfab_bitmap = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap);
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(m_fix_throught_netfab_bitmap);
if (is_windows10())
m_fix_throught_netfab_bitmap->Bind(wxEVT_CONTEXT_MENU, [this](wxCommandEvent &e)
{
// if object/sub-object has no errors
if (m_fix_throught_netfab_bitmap->GetBitmap().GetRefData() == wxNullBitmap.GetRefData())
return;
wxGetApp().obj_list()->fix_through_netfabb();
update_manifold_warning_icon_state(wxGetApp().obj_list()->get_mesh_errors_list());
});
return sizer;
};
line.append_widget(manifold_warning_icon);
def.label = "";
def.gui_type = "legend";
def.tooltip = L("Object name");
def.width = 21 * wxGetApp().em_unit();
def.default_value = new ConfigOptionString{ " " };
m_og->append_single_option_line(Option(def, "object_name"));
line.append_option(Option(def, "object_name"));
m_og->append_line(line);
const int field_width = 5 * wxGetApp().em_unit()/*50*/;
// Legend for object modification
auto line = Line{ "", "" };
line = Line{ "", "" };
def.label = "";
def.type = coString;
def.width = field_width/*50*/;
@ -334,6 +366,14 @@ void ObjectManipulation::emulate_kill_focus()
else
on_change(option, 0);
}
void ObjectManipulation::update_manifold_warning_icon_state(const wxString& tooltip)
{
m_fix_throught_netfab_bitmap->SetBitmap(tooltip.IsEmpty() ? wxNullBitmap : m_manifold_warning_bmp);
m_fix_throught_netfab_bitmap->SetToolTip(tooltip);
}
#endif // __APPLE__
void ObjectManipulation::reset_settings_value()