diff --git a/resources/localization/uk/Slic3rPE.mo b/resources/localization/uk/Slic3rPE.mo index 08bf555b58..8c5c5437b5 100644 Binary files a/resources/localization/uk/Slic3rPE.mo and b/resources/localization/uk/Slic3rPE.mo differ diff --git a/resources/localization/uk/Slic3rPE_uk.po b/resources/localization/uk/Slic3rPE_uk.po index 7880453bba..3845994bfc 100644 --- a/resources/localization/uk/Slic3rPE_uk.po +++ b/resources/localization/uk/Slic3rPE_uk.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-01-17 13:39+0100\n" -"PO-Revision-Date: 2019-02-19 14:42+0100\n" +"PO-Revision-Date: 2019-02-26 10:38+0100\n" "Last-Translator: Oleksandra Iushchenko \n" "Language-Team: \n" "Language: uk\n" @@ -51,6 +51,12 @@ msgstr "Відстань координат 0,0 G-коду від нижньог msgid "Circular" msgstr "Круговий" +msgid "Switch to %s mode" +msgstr "Перейти до режиму %s" + +msgid "Current mode is %s" +msgstr "Поточний режим - %s" + #: src/slic3r/GUI/BedShapeDialog.cpp:69 src/slic3r/GUI/ConfigWizard.cpp:92 #: src/slic3r/GUI/ConfigWizard.cpp:456 src/slic3r/GUI/ConfigWizard.cpp:470 #: src/slic3r/GUI/GUI_ObjectManipulation.cpp:204 @@ -730,11 +736,11 @@ msgstr "Преференції застосування" #: src/slic3r/GUI/GUI_App.cpp:616 msgid "Simple" -msgstr "" +msgstr "Простий" #: src/slic3r/GUI/GUI_App.cpp:616 msgid "Simple View Mode" -msgstr "" +msgstr "Простий режим перегляду" #: src/slic3r/GUI/GUI_App.cpp:617 src/slic3r/GUI/GUI_ObjectList.cpp:39 #: src/slic3r/GUI/Tab.cpp:948 src/slic3r/GUI/Tab.cpp:962 @@ -747,23 +753,23 @@ msgstr "Розширений" #: src/slic3r/GUI/GUI_App.cpp:617 msgid "Advanced View Mode" -msgstr "" +msgstr "Розширений режим перегляду" #: src/slic3r/GUI/GUI_App.cpp:618 msgid "Expert" -msgstr "" +msgstr "Експерт" #: src/slic3r/GUI/GUI_App.cpp:618 msgid "Expert View Mode" -msgstr "" +msgstr "Режим перегляду Експерт" #: src/slic3r/GUI/GUI_App.cpp:620 msgid "Mode" -msgstr "" +msgstr "Режим" #: src/slic3r/GUI/GUI_App.cpp:620 msgid "Slic3r View Mode" -msgstr "" +msgstr "Режим перегляду Slic3r'у" #: src/slic3r/GUI/GUI_App.cpp:622 msgid "Change Application &Language" @@ -1752,7 +1758,7 @@ msgstr "Вид" #: src/slic3r/GUI/MainFrame.cpp:445 msgid "&Help" -msgstr "Доромога" +msgstr "Допомога" #: src/slic3r/GUI/MainFrame.cpp:472 msgid "Choose a file to slice (STL/OBJ/AMF/3MF/PRUSA):" @@ -5064,11 +5070,11 @@ msgstr "Вертикальна відстань між об'єктом та ін #: src/libslic3r/PrintConfig.cpp:1923 msgid "soluble" -msgstr "" +msgstr "розчинний" #: src/libslic3r/PrintConfig.cpp:1924 msgid "detachable" -msgstr "" +msgstr "відривний" #: src/libslic3r/PrintConfig.cpp:1929 msgid "Enforce support for the first" @@ -5672,7 +5678,7 @@ msgstr "" #: src/libslic3r/PrintConfig.cpp:3050 msgid "Help" -msgstr "" +msgstr "Допомога" #: src/libslic3r/PrintConfig.cpp:3051 msgid "Show this help." diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 253bb5bdab..23f1502af8 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -5071,6 +5071,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } #endif // ENABLE_IMGUI +#ifdef __WXMSW__ bool on_enter_workaround = false; if (! evt.Entering() && ! evt.Leaving() && m_mouse.position.x() == -1.0) { // Workaround for SPE-832: There seems to be a mouse event sent to the window before evt.Entering() @@ -5080,7 +5081,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) printf((format_mouse_event_debug_message(evt) + " - OnEnter workaround\n").c_str()); #endif /* SLIC3R_DEBUG_MOUSE_EVENTS */ on_enter_workaround = true; - } else { + } else +#endif /* __WXMSW__ */ + { #ifdef SLIC3R_DEBUG_MOUSE_EVENTS printf((format_mouse_event_debug_message(evt) + " - other\n").c_str()); #endif /* SLIC3R_DEBUG_MOUSE_EVENTS */ @@ -5104,6 +5107,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } #endif // ENABLE_MOVE_MIN_THRESHOLD + if (evt.ButtonDown() && wxWindow::FindFocus() != this->m_canvas) + // Grab keyboard focus on any mouse click event. + m_canvas->SetFocus(); + if (evt.Entering()) { //#if defined(__WXMSW__) || defined(__linux__) @@ -5116,15 +5123,12 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) p = p->GetParent(); auto *top_level_wnd = dynamic_cast(p); if (top_level_wnd && top_level_wnd->IsActive()) - { m_canvas->SetFocus(); - - // forces a frame render to ensure that m_hover_volume_id is updated even when the user right clicks while - // the context menu is shown, ensuring it to disappear if the mouse is outside any volume and to - // change the volume hover state if any is under the mouse - m_mouse.position = pos.cast(); - render(); - } + // forces a frame render to ensure that m_hover_volume_id is updated even when the user right clicks while + // the context menu is shown, ensuring it to disappear if the mouse is outside any volume and to + // change the volume hover state if any is under the mouse + m_mouse.position = pos.cast(); + render(); } m_mouse.set_start_position_2D_as_invalid(); //#endif @@ -5312,11 +5316,42 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) #endif // ENABLE_MOVE_MIN_THRESHOLD m_mouse.dragging = true; - // Get new position at the same Z of the initial click point. - float z0 = 0.0f; - float z1 = 1.0f; + Vec3d cur_pos = m_mouse.drag.start_position_3D; // we do not want to translate objects if the user just clicked on an object while pressing shift to remove it from the selection and then drag - Vec3d cur_pos = m_selection.contains_volume(m_hover_volume_id) ? Linef3(_mouse_to_3d(pos, &z0), _mouse_to_3d(pos, &z1)).intersect_plane(m_mouse.drag.start_position_3D(2)) : m_mouse.drag.start_position_3D; + if (m_selection.contains_volume(m_hover_volume_id)) + { + if (m_camera.get_theta() == 90.0f) + { + // side view -> move selected volumes orthogonally to camera view direction + Linef3 ray = mouse_ray(pos); + Vec3d dir = ray.unit_vector(); + // finds the intersection of the mouse ray with the plane parallel to the camera viewport and passing throught the starting position + // use ray-plane intersection see i.e. https://en.wikipedia.org/wiki/Line%E2%80%93plane_intersection algebric form + // in our case plane normal and ray direction are the same (orthogonal view) + // when moving to perspective camera the negative z unit axis of the camera needs to be transformed in world space and used as plane normal + Vec3d inters = ray.a + (m_mouse.drag.start_position_3D - ray.a).dot(dir) / dir.squaredNorm() * dir; + // vector from the starting position to the found intersection + Vec3d inters_vec = inters - m_mouse.drag.start_position_3D; + + // get the view matrix back from opengl + GLfloat matrix[16]; + ::glGetFloatv(GL_MODELVIEW_MATRIX, matrix); + Vec3d camera_right((double)matrix[0], (double)matrix[4], (double)matrix[8]); + + // finds projection of the vector along the camera right axis + double projection = inters_vec.dot(camera_right); + + cur_pos = m_mouse.drag.start_position_3D + projection * camera_right; + } + else + { + // Generic view + // Get new position at the same Z of the initial click point. + float z0 = 0.0f; + float z1 = 1.0f; + cur_pos = Linef3(_mouse_to_3d(pos, &z0), _mouse_to_3d(pos, &z1)).intersect_plane(m_mouse.drag.start_position_3D(2)); + } + } m_regenerate_volumes = false; m_selection.translate(cur_pos - m_mouse.drag.start_position_3D); @@ -5533,8 +5568,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) else evt.Skip(); +#ifdef __WXMSW__ if (on_enter_workaround) m_mouse.position = Vec2d(-1., -1.); +#endif /* __WXMSW__ */ } void GLCanvas3D::on_paint(wxPaintEvent& evt) diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index a3eeb45f44..7eb600a52a 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -42,7 +42,6 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description, std::function cb, const std::string& icon, wxEvtHandler* event_handler) { -// const wxBitmap& bmp = !icon.empty() ? wxBitmap(from_u8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG) : wxNullBitmap; const wxBitmap& bmp = !icon.empty() ? create_scaled_bitmap(icon) : wxNullBitmap; return append_menu_item(menu, id, string, description, cb, bmp, event_handler); } @@ -54,7 +53,6 @@ wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxStrin wxMenuItem* item = new wxMenuItem(menu, id, string, description); if (!icon.empty()) -// item->SetBitmap(wxBitmap(from_u8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG)); item->SetBitmap(create_scaled_bitmap(icon)); item->SetSubMenu(sub_menu); @@ -421,11 +419,9 @@ wxBitmap create_scaled_bitmap(const std::string& bmp_name) } void PrusaObjectDataViewModelNode::set_object_action_icon() { -// m_action_icon = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("add_object.png")), wxBITMAP_TYPE_PNG); m_action_icon = create_scaled_bitmap("add_object.png"); } void PrusaObjectDataViewModelNode::set_part_action_icon() { -// m_action_icon = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var(m_type == itVolume ? "cog.png" : "brick_go.png")), wxBITMAP_TYPE_PNG); m_action_icon = create_scaled_bitmap(m_type == itVolume ? "cog.png" : "brick_go.png"); } @@ -1440,28 +1436,16 @@ PrusaDoubleSlider::PrusaDoubleSlider(wxWindow *parent, SetDoubleBuffered(true); #endif //__WXOSX__ -// m_bmp_thumb_higher = wxBitmap(style == wxSL_HORIZONTAL ? Slic3r::GUI::from_u8(Slic3r::var("right_half_circle.png")) : -// Slic3r::GUI::from_u8(Slic3r::var("up_half_circle.png")), wxBITMAP_TYPE_PNG); -// m_bmp_thumb_lower = wxBitmap(style == wxSL_HORIZONTAL ? Slic3r::GUI::from_u8(Slic3r::var("left_half_circle.png")) : -// Slic3r::GUI::from_u8(Slic3r::var("down_half_circle.png")), wxBITMAP_TYPE_PNG); m_bmp_thumb_higher = wxBitmap(create_scaled_bitmap(style == wxSL_HORIZONTAL ? "right_half_circle.png" : "up_half_circle.png")); m_bmp_thumb_lower = wxBitmap(create_scaled_bitmap(style == wxSL_HORIZONTAL ? "left_half_circle.png" : "down_half_circle.png")); m_thumb_size = m_bmp_thumb_lower.GetSize(); -// m_bmp_add_tick_on = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("colorchange_add_on.png")), wxBITMAP_TYPE_PNG); -// m_bmp_add_tick_off = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("colorchange_add_off.png")), wxBITMAP_TYPE_PNG); -// m_bmp_del_tick_on = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("colorchange_delete_on.png")), wxBITMAP_TYPE_PNG); -// m_bmp_del_tick_off = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("colorchange_delete_off.png")), wxBITMAP_TYPE_PNG); m_bmp_add_tick_on = create_scaled_bitmap("colorchange_add_on.png"); m_bmp_add_tick_off = create_scaled_bitmap("colorchange_add_off.png"); m_bmp_del_tick_on = create_scaled_bitmap("colorchange_delete_on.png"); m_bmp_del_tick_off = create_scaled_bitmap("colorchange_delete_off.png"); m_tick_icon_dim = m_bmp_add_tick_on.GetSize().x; -// m_bmp_one_layer_lock_on = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("one_layer_lock_on.png")), wxBITMAP_TYPE_PNG); -// m_bmp_one_layer_lock_off = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("one_layer_lock_off.png")), wxBITMAP_TYPE_PNG); -// m_bmp_one_layer_unlock_on = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("one_layer_unlock_on.png")), wxBITMAP_TYPE_PNG); -// m_bmp_one_layer_unlock_off = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("one_layer_unlock_off.png")), wxBITMAP_TYPE_PNG); m_bmp_one_layer_lock_on = create_scaled_bitmap("one_layer_lock_on.png"); m_bmp_one_layer_lock_off = create_scaled_bitmap("one_layer_lock_off.png"); m_bmp_one_layer_unlock_on = create_scaled_bitmap("one_layer_unlock_on.png"); @@ -2283,11 +2267,6 @@ PrusaLockButton::PrusaLockButton( wxWindow *parent, const wxSize& size /*= wxDefaultSize*/): wxButton(parent, id, wxEmptyString, pos, size, wxBU_EXACTFIT | wxNO_BORDER) { -// m_bmp_lock_on = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("one_layer_lock_on.png")), wxBITMAP_TYPE_PNG); -// m_bmp_lock_off = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("one_layer_lock_off.png")), wxBITMAP_TYPE_PNG); -// m_bmp_unlock_on = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("one_layer_unlock_on.png")), wxBITMAP_TYPE_PNG); -// m_bmp_unlock_off = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("one_layer_unlock_off.png")), wxBITMAP_TYPE_PNG); - m_bmp_lock_on = create_scaled_bitmap("one_layer_lock_on.png"); m_bmp_lock_off = create_scaled_bitmap("one_layer_lock_off.png"); m_bmp_unlock_on = create_scaled_bitmap("one_layer_unlock_on.png"); @@ -2349,9 +2328,11 @@ PrusaModeButton::PrusaModeButton( wxWindow *parent, #ifdef __WXMSW__ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); #endif // __WXMSW__ -// m_bmp_off = wxBitmap(Slic3r::GUI::from_u8(Slic3r::var("mode_off_sq.png")), wxBITMAP_TYPE_PNG); m_bmp_off = create_scaled_bitmap("mode_off_sq.png"); + m_tt_focused = wxString::Format(_(L("Switch to the %s mode")), mode); + m_tt_selected = wxString::Format(_(L("Current mode is %s")), mode); + SetBitmap(m_bmp_on); //button events @@ -2372,6 +2353,7 @@ void PrusaModeButton::SetState(const bool state) { m_is_selected = state; focus_button(m_is_selected); + SetToolTip(state ? m_tt_selected : m_tt_focused); } void PrusaModeButton::focus_button(const bool focus) diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index 1a1fe0f45d..22884bff4a 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -906,6 +906,8 @@ private: wxBitmap m_bmp_on; wxBitmap m_bmp_off; + wxString m_tt_selected; + wxString m_tt_focused; };