This commit is contained in:
bubnikv 2019-02-22 15:25:44 +01:00
commit ed5598f59f
6 changed files with 34 additions and 23 deletions

View file

@ -1178,7 +1178,7 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode
const auto obj_idx = get_selected_obj_idx();
if (obj_idx < 0) return;
const std::string name = _(L("Generic")) + "-" + _(type_name);
const wxString name = _(L("Generic")) + "-" + _(type_name);
TriangleMesh mesh;
auto& bed_shape = wxGetApp().preset_bundle->printers.get_edited_preset().config.option<ConfigOptionPoints>("bed_shape")->values;
@ -1230,7 +1230,7 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode
}
#endif // ENABLE_GENERIC_SUBPARTS_PLACEMENT
new_volume->name = name;
new_volume->name = into_u8(name);
// set a default extruder value, since user can't add it manually
new_volume->config.set_key_value("extruder", new ConfigOptionInt(0));
@ -1238,7 +1238,7 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode
parts_changed(obj_idx);
const auto object_item = m_objects_model->GetTopParent(GetSelection());
select_item(m_objects_model->AddVolumeChild(object_item, from_u8(name), type));
select_item(m_objects_model->AddVolumeChild(object_item, name, type));
#ifndef __WXOSX__ //#ifdef __WXMSW__ // #ys_FIXME
selection_changed();
#endif //no __WXOSX__ //__WXMSW__

View file

@ -101,6 +101,10 @@ void ImGuiWrapper::set_style_scaling(float scaling)
bool ImGuiWrapper::update_mouse_data(wxMouseEvent& evt)
{
if (! display_initialized()) {
return false;
}
ImGuiIO& io = ImGui::GetIO();
io.MousePos = ImVec2((float)evt.GetX(), (float)evt.GetY());
io.MouseDown[0] = evt.LeftDown();
@ -116,6 +120,10 @@ bool ImGuiWrapper::update_mouse_data(wxMouseEvent& evt)
bool ImGuiWrapper::update_key_data(wxKeyEvent &evt)
{
if (! display_initialized()) {
return false;
}
ImGuiIO& io = ImGui::GetIO();
if (evt.GetEventType() == wxEVT_CHAR) {
@ -521,6 +529,12 @@ void ImGuiWrapper::render_draw_data(ImDrawData *draw_data)
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
}
bool ImGuiWrapper::display_initialized() const
{
const ImGuiIO& io = ImGui::GetIO();
return io.DisplaySize.x >= 0.0f && io.DisplaySize.y >= 0.0f;
}
void ImGuiWrapper::destroy_device_objects()
{
destroy_fonts_texture();

View file

@ -75,6 +75,7 @@ private:
void init_input();
void init_style();
void render_draw_data(ImDrawData *draw_data);
bool display_initialized() const;
void destroy_device_objects();
void destroy_fonts_texture();