mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Removal of tabs from plater -> added buttons to scene to switch between views
This commit is contained in:
parent
cc14676ca5
commit
c908a4674a
8 changed files with 595 additions and 18 deletions
|
@ -26,7 +26,11 @@
|
|||
#include <wx/dcmemory.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/settings.h>
|
||||
#if ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
#include <wx/tipwin.h>
|
||||
#else
|
||||
#include <wx/tooltip.h>
|
||||
#endif // ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
#include <wx/debug.h>
|
||||
|
||||
// Print now includes tbb, and tbb includes Windows. This breaks compilation of wxWidgets if included before wx.
|
||||
|
@ -3360,6 +3364,9 @@ void GLCanvas3D::LegendTexture::render(const GLCanvas3D& canvas) const
|
|||
}
|
||||
}
|
||||
|
||||
#if ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
wxDEFINE_EVENT(EVT_GLCANVAS_INIT, SimpleEvent);
|
||||
#endif // ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
wxDEFINE_EVENT(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent);
|
||||
wxDEFINE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, SimpleEvent);
|
||||
wxDEFINE_EVENT(EVT_GLCANVAS_VIEWPORT_CHANGED, SimpleEvent);
|
||||
|
@ -3379,6 +3386,9 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
|
|||
, m_context(nullptr)
|
||||
, m_in_render(false)
|
||||
, m_toolbar(*this)
|
||||
#if ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
, m_view_toolbar(nullptr)
|
||||
#endif // ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
, m_use_clipping_planes(false)
|
||||
, m_config(nullptr)
|
||||
, m_process(nullptr)
|
||||
|
@ -3522,6 +3532,10 @@ bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl)
|
|||
if (!_init_toolbar())
|
||||
return false;
|
||||
|
||||
#if ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
post_event(SimpleEvent(EVT_GLCANVAS_INIT));
|
||||
#endif // ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
|
||||
m_initialized = true;
|
||||
|
||||
return true;
|
||||
|
@ -3845,7 +3859,9 @@ void GLCanvas3D::render()
|
|||
float theta = m_camera.get_theta();
|
||||
bool is_custom_bed = m_bed.is_custom();
|
||||
|
||||
#if !ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
set_tooltip("");
|
||||
#endif // !ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
|
||||
#if ENABLE_IMGUI
|
||||
wxGetApp().imgui()->new_frame();
|
||||
|
@ -3889,7 +3905,13 @@ void GLCanvas3D::render()
|
|||
_render_gizmos_overlay();
|
||||
_render_warning_texture();
|
||||
_render_legend_texture();
|
||||
#if ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
_resize_toolbars();
|
||||
#endif // ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
_render_toolbar();
|
||||
#if ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
_render_view_toolbar();
|
||||
#endif // ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
_render_layer_editing_overlay();
|
||||
|
||||
#if ENABLE_IMGUI
|
||||
|
@ -4575,6 +4597,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
m_layers_editing.last_object_id = layer_editing_object_idx;
|
||||
bool gizmos_overlay_contains_mouse = m_gizmos.overlay_contains_mouse(*this, m_mouse.position);
|
||||
int toolbar_contains_mouse = m_toolbar.contains_mouse(m_mouse.position);
|
||||
#if ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
int view_toolbar_contains_mouse = (m_view_toolbar != nullptr) ? m_view_toolbar->contains_mouse(m_mouse.position, *this) : -1;
|
||||
#endif // ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
|
||||
if (evt.Entering())
|
||||
{
|
||||
|
@ -4660,6 +4685,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
if (m_gizmos.get_current_type() == Gizmos::SlaSupports)
|
||||
m_gizmos.delete_current_grabber();
|
||||
}
|
||||
#if ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
else if (view_toolbar_contains_mouse != -1)
|
||||
{
|
||||
if (m_view_toolbar != nullptr)
|
||||
m_view_toolbar->do_action((unsigned int)view_toolbar_contains_mouse, *this);
|
||||
}
|
||||
#endif // ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
else if (toolbar_contains_mouse != -1)
|
||||
{
|
||||
m_toolbar_action_running = true;
|
||||
|
@ -4936,7 +4968,31 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
}
|
||||
else if (evt.Moving())
|
||||
{
|
||||
m_mouse.position = Vec2d((double)pos(0), (double)pos(1));
|
||||
m_mouse.position = pos.cast<double>();
|
||||
#if ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
std::string tooltip = "";
|
||||
|
||||
// updates gizmos overlay
|
||||
if (!m_selection.is_empty())
|
||||
tooltip = m_gizmos.update_hover_state(*this, m_mouse.position, m_selection);
|
||||
else
|
||||
m_gizmos.reset_all_states();
|
||||
|
||||
// updates toolbar overlay
|
||||
if (tooltip.empty())
|
||||
tooltip = m_toolbar.update_hover_state(m_mouse.position);
|
||||
|
||||
// updates view toolbar overlay
|
||||
if (tooltip.empty() && (m_view_toolbar != nullptr))
|
||||
{
|
||||
tooltip = m_view_toolbar->update_hover_state(m_mouse.position, *this);
|
||||
if (!tooltip.empty())
|
||||
m_dirty = true;
|
||||
}
|
||||
|
||||
set_tooltip(tooltip);
|
||||
#endif // ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
|
||||
// Only refresh if picking is enabled, in that case the objects may get highlighted if the mouse cursor hovers over.
|
||||
if (m_picking_enabled)
|
||||
m_dirty = true;
|
||||
|
@ -5660,6 +5716,7 @@ void GLCanvas3D::_picking_pass() const
|
|||
|
||||
_update_volumes_hover_state();
|
||||
|
||||
#if !ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
// updates gizmos overlay
|
||||
if (!m_selection.is_empty())
|
||||
{
|
||||
|
@ -5671,6 +5728,7 @@ void GLCanvas3D::_picking_pass() const
|
|||
m_gizmos.reset_all_states();
|
||||
|
||||
m_toolbar.update_hover_state(pos);
|
||||
#endif // !ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5899,10 +5957,20 @@ void GLCanvas3D::_render_gizmos_overlay() const
|
|||
|
||||
void GLCanvas3D::_render_toolbar() const
|
||||
{
|
||||
#if !ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
_resize_toolbar();
|
||||
#endif // !ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
m_toolbar.render();
|
||||
}
|
||||
|
||||
#if ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
void GLCanvas3D::_render_view_toolbar() const
|
||||
{
|
||||
if (m_view_toolbar != nullptr)
|
||||
m_view_toolbar->render(*this);
|
||||
}
|
||||
#endif // ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
|
||||
#if ENABLE_SHOW_CAMERA_TARGET
|
||||
void GLCanvas3D::_render_camera_target() const
|
||||
{
|
||||
|
@ -7495,7 +7563,11 @@ bool GLCanvas3D::_is_any_volume_outside() const
|
|||
return false;
|
||||
}
|
||||
|
||||
#if ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
void GLCanvas3D::_resize_toolbars() const
|
||||
#else
|
||||
void GLCanvas3D::_resize_toolbar() const
|
||||
#endif // ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
{
|
||||
Size cnv_size = get_canvas_size();
|
||||
float zoom = get_camera_zoom();
|
||||
|
@ -7524,6 +7596,15 @@ void GLCanvas3D::_resize_toolbar() const
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
if (m_view_toolbar != nullptr)
|
||||
{
|
||||
float top = (-0.5f * (float)cnv_size.get_height() + m_view_toolbar->get_height()) * inv_zoom;
|
||||
float left = -0.5f * (float)cnv_size.get_width() * inv_zoom;
|
||||
m_view_toolbar->set_position(top, left);
|
||||
}
|
||||
#endif // ENABLE_REMOVE_TABS_FROM_PLATER
|
||||
}
|
||||
|
||||
const Print* GLCanvas3D::fff_print() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue