mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
ENH:Optimized Gizmo toolbar layout
Change-Id: I9e323c310abd2afcf0f9586ba261f714dd718f38
This commit is contained in:
parent
5bea8a76fc
commit
dbe354995e
7 changed files with 132 additions and 108 deletions
|
@ -1,69 +1,3 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<svg width="200" height="484" viewBox="0 0 200 484" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M92 430.95L92 53L99.56 53L99.56 430.95L92 430.95Z" fill="#2B3436"/>
|
||||||
|
|
||||||
<svg
|
|
||||||
width="128mm"
|
|
||||||
height="128mm"
|
|
||||||
viewBox="0 0 128 128"
|
|
||||||
version="1.1"
|
|
||||||
id="svg5"
|
|
||||||
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
|
|
||||||
sodipodi:docname="seperator.svg"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg">
|
|
||||||
<sodipodi:namedview
|
|
||||||
id="namedview7"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1.0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:pageopacity="0.0"
|
|
||||||
inkscape:pagecheckerboard="0"
|
|
||||||
inkscape:document-units="mm"
|
|
||||||
showgrid="false"
|
|
||||||
width="128mm"
|
|
||||||
inkscape:zoom="0.77771465"
|
|
||||||
inkscape:cx="413.3907"
|
|
||||||
inkscape:cy="271.95065"
|
|
||||||
inkscape:window-width="3440"
|
|
||||||
inkscape:window-height="1361"
|
|
||||||
inkscape:window-x="-9"
|
|
||||||
inkscape:window-y="-9"
|
|
||||||
inkscape:window-maximized="1"
|
|
||||||
inkscape:current-layer="layer1" />
|
|
||||||
<defs
|
|
||||||
id="defs2" />
|
|
||||||
<g
|
|
||||||
inkscape:label="图层 1"
|
|
||||||
inkscape:groupmode="layer"
|
|
||||||
id="layer1">
|
|
||||||
<g
|
|
||||||
inkscape:label="图层 1"
|
|
||||||
id="layer1-9"
|
|
||||||
transform="matrix(0.73484844,0,0,0.50769191,-13.305129,-6.3896798)">
|
|
||||||
<rect
|
|
||||||
style="fill:#00ffff;stroke-width:0.640159;stroke-miterlimit:4;stroke-dasharray:0.640159, 1.28032;stroke-dashoffset:0"
|
|
||||||
id="rect865"
|
|
||||||
width="2.7216496"
|
|
||||||
height="57.987961"
|
|
||||||
x="103.83791"
|
|
||||||
y="40.161522" />
|
|
||||||
<rect
|
|
||||||
style="fill:#00ffff;stroke-width:0.552188;stroke-miterlimit:4;stroke-dasharray:0.552188, 1.10438;stroke-dashoffset:0"
|
|
||||||
id="rect865-1"
|
|
||||||
width="2.7216496"
|
|
||||||
height="43.145557"
|
|
||||||
x="103.83791"
|
|
||||||
y="115.61198" />
|
|
||||||
<rect
|
|
||||||
style="fill:#00ffff;stroke-width:0.644598;stroke-miterlimit:4;stroke-dasharray:0.644598, 1.2892;stroke-dashoffset:0"
|
|
||||||
id="rect865-1-4"
|
|
||||||
width="2.7216496"
|
|
||||||
height="58.79504"
|
|
||||||
x="103.83791"
|
|
||||||
y="178.33633" />
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 224 B |
|
@ -595,6 +595,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D &bed)
|
||||||
#endif
|
#endif
|
||||||
, m_in_render(false)
|
, m_in_render(false)
|
||||||
, m_main_toolbar(GLToolbar::Normal, "Main")
|
, m_main_toolbar(GLToolbar::Normal, "Main")
|
||||||
|
, m_separator_toolbar(GLToolbar::Normal, "Separator")
|
||||||
, m_assemble_view_toolbar(GLToolbar::Normal, "Assembly_View")
|
, m_assemble_view_toolbar(GLToolbar::Normal, "Assembly_View")
|
||||||
, m_return_toolbar()
|
, m_return_toolbar()
|
||||||
, m_canvas_type(ECanvasType::CanvasView3D)
|
, m_canvas_type(ECanvasType::CanvasView3D)
|
||||||
|
@ -1021,6 +1022,11 @@ void GLCanvas3D::enable_return_toolbar(bool enable)
|
||||||
m_return_toolbar.set_enabled(enable);
|
m_return_toolbar.set_enabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::enable_separator_toolbar(bool enable)
|
||||||
|
{
|
||||||
|
m_separator_toolbar.set_enabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3D::enable_dynamic_background(bool enable)
|
void GLCanvas3D::enable_dynamic_background(bool enable)
|
||||||
{
|
{
|
||||||
m_dynamic_background_enabled = enable;
|
m_dynamic_background_enabled = enable;
|
||||||
|
@ -4989,6 +4995,9 @@ bool GLCanvas3D::_init_toolbars()
|
||||||
if (!_init_return_toolbar())
|
if (!_init_return_toolbar())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!_init_separator_toolbar())
|
||||||
|
return false;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!_init_view_toolbar())
|
if (!_init_view_toolbar())
|
||||||
return false;
|
return false;
|
||||||
|
@ -5129,16 +5138,6 @@ bool GLCanvas3D::_init_main_toolbar()
|
||||||
if (!m_main_toolbar.add_item(item))
|
if (!m_main_toolbar.add_item(item))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
GLToolbarItem::Data sperate_item;
|
|
||||||
sperate_item.name = "seperatetag";
|
|
||||||
sperate_item.icon_filename = "seperator.svg";
|
|
||||||
sperate_item.sprite_id = ++item.sprite_id;
|
|
||||||
sperate_item.left.action_callback = [this]() { };
|
|
||||||
sperate_item.visibility_callback = []()->bool { return true; };
|
|
||||||
sperate_item.enabling_callback = []()->bool { return false; };
|
|
||||||
if (!m_main_toolbar.add_item(sperate_item))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5202,16 +5201,6 @@ bool GLCanvas3D::_init_assemble_view_toolbar()
|
||||||
m_assemble_view_toolbar.set_separator_size(10);
|
m_assemble_view_toolbar.set_separator_size(10);
|
||||||
m_assemble_view_toolbar.set_gap_size(4);
|
m_assemble_view_toolbar.set_gap_size(4);
|
||||||
|
|
||||||
GLToolbarItem::Data sperate_item;
|
|
||||||
sperate_item.name = "start_seperator";
|
|
||||||
sperate_item.icon_filename = "seperator.svg";
|
|
||||||
sperate_item.sprite_id = 0;
|
|
||||||
sperate_item.left.action_callback = [this]() {};
|
|
||||||
sperate_item.visibility_callback = []()->bool { return true; };
|
|
||||||
sperate_item.enabling_callback = []()->bool { return false; };
|
|
||||||
if (!m_assemble_view_toolbar.add_item(sperate_item))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
GLToolbarItem::Data item;
|
GLToolbarItem::Data item;
|
||||||
item.name = "assembly_view";
|
item.name = "assembly_view";
|
||||||
item.icon_filename = "toolbar_assemble.svg";
|
item.icon_filename = "toolbar_assemble.svg";
|
||||||
|
@ -5240,6 +5229,45 @@ bool GLCanvas3D::_init_return_toolbar()
|
||||||
return m_return_toolbar.init();
|
return m_return_toolbar.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GLCanvas3D::_init_separator_toolbar()
|
||||||
|
{
|
||||||
|
if (!m_separator_toolbar.is_enabled())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
BackgroundTexture::Metadata background_data;
|
||||||
|
background_data.filename = "toolbar_background.png";
|
||||||
|
background_data.left = 0;
|
||||||
|
background_data.top = 0;
|
||||||
|
background_data.right = 0;
|
||||||
|
background_data.bottom = 0;
|
||||||
|
|
||||||
|
if (!m_separator_toolbar.init(background_data))
|
||||||
|
{
|
||||||
|
// unable to init the toolbar texture, disable it
|
||||||
|
m_separator_toolbar.set_enabled(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_separator_toolbar.set_layout_type(GLToolbar::Layout::Horizontal);
|
||||||
|
//BBS: assemble toolbar is at the top and right, we don't need the rounded-corner effect at the left side and the top side
|
||||||
|
m_separator_toolbar.set_horizontal_orientation(GLToolbar::Layout::HO_Left);
|
||||||
|
m_separator_toolbar.set_vertical_orientation(GLToolbar::Layout::VO_Top);
|
||||||
|
m_separator_toolbar.set_border(5.0f);
|
||||||
|
|
||||||
|
GLToolbarItem::Data sperate_item;
|
||||||
|
sperate_item.name = "start_seperator";
|
||||||
|
sperate_item.icon_filename = "seperator.svg";
|
||||||
|
sperate_item.sprite_id = 0;
|
||||||
|
sperate_item.left.action_callback = [this]() {};
|
||||||
|
sperate_item.visibility_callback = []()->bool { return true; };
|
||||||
|
sperate_item.enabling_callback = []()->bool { return false; };
|
||||||
|
if (!m_separator_toolbar.add_item(sperate_item))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// BBS
|
// BBS
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -5839,6 +5867,7 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale()
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
m_main_toolbar.set_scale(sc);
|
m_main_toolbar.set_scale(sc);
|
||||||
m_assemble_view_toolbar.set_scale(sc);
|
m_assemble_view_toolbar.set_scale(sc);
|
||||||
|
m_separator_toolbar.set_scale(sc);
|
||||||
collapse_toolbar.set_scale(sc);
|
collapse_toolbar.set_scale(sc);
|
||||||
size *= m_retina_helper->get_scale_factor();
|
size *= m_retina_helper->get_scale_factor();
|
||||||
|
|
||||||
|
@ -5848,15 +5877,16 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale()
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
m_main_toolbar.set_icons_size(GLGizmosManager::Default_Icons_Size * scale);
|
m_main_toolbar.set_icons_size(GLGizmosManager::Default_Icons_Size * scale);
|
||||||
m_assemble_view_toolbar.set_icons_size(size);
|
m_assemble_view_toolbar.set_icons_size(size);
|
||||||
|
m_separator_toolbar.set_icons_size(size);
|
||||||
collapse_toolbar.set_icons_size(size);
|
collapse_toolbar.set_icons_size(size);
|
||||||
#endif // ENABLE_RETINA_GL
|
#endif // ENABLE_RETINA_GL
|
||||||
|
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
#if BBS_TOOLBAR_ON_TOP
|
#if BBS_TOOLBAR_ON_TOP
|
||||||
float collapse_toolbar_width = collapse_toolbar.is_enabled() ? collapse_toolbar.get_width() : 0.0f;
|
float collapse_toolbar_width = collapse_toolbar.is_enabled() ? collapse_toolbar.get_width() : GLToolbar::Default_Icons_Size;
|
||||||
|
|
||||||
float top_tb_width = m_main_toolbar.get_width() + m_gizmos.get_scaled_total_width() + m_assemble_view_toolbar.get_width() + collapse_toolbar_width;
|
float top_tb_width = m_main_toolbar.get_width() + m_gizmos.get_scaled_total_width() + m_assemble_view_toolbar.get_width() + m_separator_toolbar.get_width() + collapse_toolbar_width;
|
||||||
int items_cnt = m_main_toolbar.get_visible_items_cnt() + m_gizmos.get_selectable_icons_cnt() + m_assemble_view_toolbar.get_visible_items_cnt() + collapse_toolbar.get_visible_items_cnt();
|
int items_cnt = m_main_toolbar.get_visible_items_cnt() + m_gizmos.get_selectable_icons_cnt() + m_assemble_view_toolbar.get_visible_items_cnt() + m_separator_toolbar.get_visible_items_cnt() + collapse_toolbar.get_visible_items_cnt();
|
||||||
float noitems_width = top_tb_width - size * items_cnt; // width of separators and borders in top toolbars
|
float noitems_width = top_tb_width - size * items_cnt; // width of separators and borders in top toolbars
|
||||||
|
|
||||||
// calculate scale needed for items in all top toolbars
|
// calculate scale needed for items in all top toolbars
|
||||||
|
@ -5912,6 +5942,7 @@ void GLCanvas3D::_render_overlays()
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
m_main_toolbar.set_scale(scale);
|
m_main_toolbar.set_scale(scale);
|
||||||
m_assemble_view_toolbar.set_scale(scale);
|
m_assemble_view_toolbar.set_scale(scale);
|
||||||
|
m_separator_toolbar.set_scale(scale);
|
||||||
wxGetApp().plater()->get_collapse_toolbar().set_scale(scale);
|
wxGetApp().plater()->get_collapse_toolbar().set_scale(scale);
|
||||||
m_gizmos.set_overlay_scale(scale);
|
m_gizmos.set_overlay_scale(scale);
|
||||||
#else
|
#else
|
||||||
|
@ -5924,10 +5955,13 @@ void GLCanvas3D::_render_overlays()
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
m_main_toolbar.set_icons_size(gizmo_size);
|
m_main_toolbar.set_icons_size(gizmo_size);
|
||||||
m_assemble_view_toolbar.set_icons_size(gizmo_size);
|
m_assemble_view_toolbar.set_icons_size(gizmo_size);
|
||||||
|
m_separator_toolbar.set_icons_size(gizmo_size);
|
||||||
wxGetApp().plater()->get_collapse_toolbar().set_icons_size(size);
|
wxGetApp().plater()->get_collapse_toolbar().set_icons_size(size);
|
||||||
m_gizmos.set_overlay_icon_size(gizmo_size);
|
m_gizmos.set_overlay_icon_size(gizmo_size);
|
||||||
#endif // ENABLE_RETINA_GL
|
#endif // ENABLE_RETINA_GL
|
||||||
|
|
||||||
|
_render_separator_toolbar_right();
|
||||||
|
_render_separator_toolbar_left();
|
||||||
_render_main_toolbar();
|
_render_main_toolbar();
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
_render_imgui_select_plate_toolbar();
|
_render_imgui_select_plate_toolbar();
|
||||||
|
@ -6130,8 +6164,9 @@ void GLCanvas3D::_render_main_toolbar()
|
||||||
float collapse_toolbar_width = collapse_toolbar.is_enabled() ? collapse_toolbar.get_width() : 0.0f;
|
float collapse_toolbar_width = collapse_toolbar.is_enabled() ? collapse_toolbar.get_width() : 0.0f;
|
||||||
float gizmo_width = m_gizmos.get_scaled_total_width();
|
float gizmo_width = m_gizmos.get_scaled_total_width();
|
||||||
float assemble_width = m_assemble_view_toolbar.get_width();
|
float assemble_width = m_assemble_view_toolbar.get_width();
|
||||||
|
float separator_width = m_separator_toolbar.get_width();
|
||||||
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
||||||
float left = std::max(-0.5f * cnv_size.get_width(), -0.5f * (m_main_toolbar.get_width() + gizmo_width + assemble_width - collapse_toolbar_width)) * inv_zoom;
|
float left = std::max(-0.5f * cnv_size.get_width(), -0.5f * (m_main_toolbar.get_width() + separator_width + gizmo_width + assemble_width - collapse_toolbar_width)) * inv_zoom;
|
||||||
#else
|
#else
|
||||||
float gizmo_height = m_gizmos.get_scaled_total_height();
|
float gizmo_height = m_gizmos.get_scaled_total_height();
|
||||||
float space_height = GLGizmosManager::Default_Icons_Size * wxGetApp().toolbar_icon_scale();
|
float space_height = GLGizmosManager::Default_Icons_Size * wxGetApp().toolbar_icon_scale();
|
||||||
|
@ -6322,8 +6357,9 @@ void GLCanvas3D::_render_assemble_view_toolbar() const
|
||||||
float collapse_toolbar_width = collapse_toolbar.is_enabled() ? collapse_toolbar.get_width() : 0.0f;
|
float collapse_toolbar_width = collapse_toolbar.is_enabled() ? collapse_toolbar.get_width() : 0.0f;
|
||||||
float gizmo_width = m_gizmos.get_scaled_total_width();
|
float gizmo_width = m_gizmos.get_scaled_total_width();
|
||||||
float assemble_width = m_assemble_view_toolbar.get_width();
|
float assemble_width = m_assemble_view_toolbar.get_width();
|
||||||
|
float separator_width = m_separator_toolbar.get_width();
|
||||||
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
||||||
float main_toolbar_left = std::max(-0.5f * cnv_size.get_width(), -0.5f * (m_main_toolbar.get_width() + gizmo_width + assemble_width - collapse_toolbar_width)) * inv_zoom;
|
float main_toolbar_left = std::max(-0.5f * cnv_size.get_width(), -0.5f * (m_main_toolbar.get_width() + gizmo_width + assemble_width - separator_width - collapse_toolbar_width)) * inv_zoom;
|
||||||
float left = main_toolbar_left + (m_main_toolbar.get_width() + gizmo_width) * inv_zoom;
|
float left = main_toolbar_left + (m_main_toolbar.get_width() + gizmo_width) * inv_zoom;
|
||||||
//float left = 0.5f * (m_main_toolbar.get_width() + gizmo_width - m_assemble_view_toolbar.get_width() + collapse_toolbar_width) * inv_zoom;
|
//float left = 0.5f * (m_main_toolbar.get_width() + gizmo_width - m_assemble_view_toolbar.get_width() + collapse_toolbar_width) * inv_zoom;
|
||||||
#else
|
#else
|
||||||
|
@ -6392,6 +6428,48 @@ void GLCanvas3D::_render_return_toolbar() const
|
||||||
imgui.end();
|
imgui.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::_render_separator_toolbar_right() const
|
||||||
|
{
|
||||||
|
if (!m_separator_toolbar.is_enabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Size cnv_size = get_canvas_size();
|
||||||
|
float inv_zoom = (float)wxGetApp().plater()->get_camera().get_inv_zoom();
|
||||||
|
|
||||||
|
GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar();
|
||||||
|
float collapse_toolbar_width = collapse_toolbar.is_enabled() ? collapse_toolbar.get_width() : 0.0f;
|
||||||
|
float gizmo_width = m_gizmos.get_scaled_total_width();
|
||||||
|
float assemble_width = m_assemble_view_toolbar.get_width();
|
||||||
|
float separator_width = m_separator_toolbar.get_width();
|
||||||
|
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
||||||
|
float main_toolbar_left = std::max(-0.5f * cnv_size.get_width(), -0.5f * (m_main_toolbar.get_width() + gizmo_width + assemble_width - collapse_toolbar_width)) * inv_zoom;
|
||||||
|
float left = main_toolbar_left + (m_main_toolbar.get_width() + gizmo_width) * inv_zoom;
|
||||||
|
|
||||||
|
m_separator_toolbar.set_position(top, left);
|
||||||
|
m_separator_toolbar.render(*this,GLToolbarItem::SeparatorLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::_render_separator_toolbar_left() const
|
||||||
|
{
|
||||||
|
if (!m_separator_toolbar.is_enabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Size cnv_size = get_canvas_size();
|
||||||
|
float inv_zoom = (float)wxGetApp().plater()->get_camera().get_inv_zoom();
|
||||||
|
|
||||||
|
GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar();
|
||||||
|
float collapse_toolbar_width = collapse_toolbar.is_enabled() ? collapse_toolbar.get_width() : 0.0f;
|
||||||
|
float gizmo_width = m_gizmos.get_scaled_total_width();
|
||||||
|
float assemble_width = m_assemble_view_toolbar.get_width();
|
||||||
|
float separator_width = m_separator_toolbar.get_width();
|
||||||
|
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
||||||
|
float main_toolbar_left = std::max(-0.5f * cnv_size.get_width(), -0.5f * (m_main_toolbar.get_width() + gizmo_width + assemble_width + separator_width - collapse_toolbar_width)) * inv_zoom;
|
||||||
|
float left = main_toolbar_left + (m_main_toolbar.get_width()) * inv_zoom;
|
||||||
|
|
||||||
|
m_separator_toolbar.set_position(top, left);
|
||||||
|
m_separator_toolbar.render(*this,GLToolbarItem::SeparatorLine);
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3D::_render_collapse_toolbar() const
|
void GLCanvas3D::_render_collapse_toolbar() const
|
||||||
{
|
{
|
||||||
GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar();
|
GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar();
|
||||||
|
|
|
@ -399,6 +399,7 @@ private:
|
||||||
GLGizmosManager m_gizmos;
|
GLGizmosManager m_gizmos;
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
mutable GLToolbar m_main_toolbar;
|
mutable GLToolbar m_main_toolbar;
|
||||||
|
mutable GLToolbar m_separator_toolbar;
|
||||||
mutable IMToolbar m_sel_plate_toolbar;
|
mutable IMToolbar m_sel_plate_toolbar;
|
||||||
mutable GLToolbar m_assemble_view_toolbar;
|
mutable GLToolbar m_assemble_view_toolbar;
|
||||||
mutable IMReturnToolbar m_return_toolbar;
|
mutable IMReturnToolbar m_return_toolbar;
|
||||||
|
@ -667,6 +668,7 @@ public:
|
||||||
void enable_select_plate_toolbar(bool enable);
|
void enable_select_plate_toolbar(bool enable);
|
||||||
void enable_assemble_view_toolbar(bool enable);
|
void enable_assemble_view_toolbar(bool enable);
|
||||||
void enable_return_toolbar(bool enable);
|
void enable_return_toolbar(bool enable);
|
||||||
|
void enable_separator_toolbar(bool enable);
|
||||||
void enable_dynamic_background(bool enable);
|
void enable_dynamic_background(bool enable);
|
||||||
void enable_labels(bool enable) { m_labels.enable(enable); }
|
void enable_labels(bool enable) { m_labels.enable(enable); }
|
||||||
void enable_slope(bool enable) { m_slope.enable(enable); }
|
void enable_slope(bool enable) { m_slope.enable(enable); }
|
||||||
|
@ -686,6 +688,8 @@ public:
|
||||||
float get_main_toolbar_width() { return m_main_toolbar.get_width();}
|
float get_main_toolbar_width() { return m_main_toolbar.get_width();}
|
||||||
float get_assemble_view_toolbar_width() { return m_assemble_view_toolbar.get_width(); }
|
float get_assemble_view_toolbar_width() { return m_assemble_view_toolbar.get_width(); }
|
||||||
float get_assemble_view_toolbar_height() { return m_assemble_view_toolbar.get_height(); }
|
float get_assemble_view_toolbar_height() { return m_assemble_view_toolbar.get_height(); }
|
||||||
|
float get_separator_toolbar_width() { return m_separator_toolbar.get_width(); }
|
||||||
|
float get_separator_toolbar_height() { return m_separator_toolbar.get_height(); }
|
||||||
float get_collapse_toolbar_width();
|
float get_collapse_toolbar_width();
|
||||||
float get_collapse_toolbar_height();
|
float get_collapse_toolbar_height();
|
||||||
|
|
||||||
|
@ -923,6 +927,7 @@ private:
|
||||||
bool _update_imgui_select_plate_toolbar();
|
bool _update_imgui_select_plate_toolbar();
|
||||||
bool _init_assemble_view_toolbar();
|
bool _init_assemble_view_toolbar();
|
||||||
bool _init_return_toolbar();
|
bool _init_return_toolbar();
|
||||||
|
bool _init_separator_toolbar();
|
||||||
// BBS
|
// BBS
|
||||||
//bool _init_view_toolbar();
|
//bool _init_view_toolbar();
|
||||||
bool _init_collapse_toolbar();
|
bool _init_collapse_toolbar();
|
||||||
|
@ -967,6 +972,8 @@ private:
|
||||||
void _render_imgui_select_plate_toolbar() const;
|
void _render_imgui_select_plate_toolbar() const;
|
||||||
void _render_assemble_view_toolbar() const;
|
void _render_assemble_view_toolbar() const;
|
||||||
void _render_return_toolbar() const;
|
void _render_return_toolbar() const;
|
||||||
|
void _render_separator_toolbar_right() const;
|
||||||
|
void _render_separator_toolbar_left() const;
|
||||||
void _render_collapse_toolbar() const;
|
void _render_collapse_toolbar() const;
|
||||||
// BBS
|
// BBS
|
||||||
//void _render_view_toolbar() const;
|
//void _render_view_toolbar() const;
|
||||||
|
|
|
@ -537,7 +537,7 @@ bool GLToolbar::update_items_state()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLToolbar::render(const GLCanvas3D& parent)
|
void GLToolbar::render(const GLCanvas3D& parent,GLToolbarItem::EType type)
|
||||||
{
|
{
|
||||||
if (!m_enabled || m_items.empty())
|
if (!m_enabled || m_items.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -548,7 +548,7 @@ void GLToolbar::render(const GLCanvas3D& parent)
|
||||||
switch (m_layout.type)
|
switch (m_layout.type)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case Layout::Horizontal: { render_horizontal(parent); break; }
|
case Layout::Horizontal: { render_horizontal(parent,type); break; }
|
||||||
case Layout::Vertical: { render_vertical(parent); break; }
|
case Layout::Vertical: { render_vertical(parent); break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1385,7 +1385,7 @@ void GLToolbar::render_arrow(const GLCanvas3D& parent, GLToolbarItem* highlighte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLToolbar::render_horizontal(const GLCanvas3D& parent)
|
void GLToolbar::render_horizontal(const GLCanvas3D& parent,GLToolbarItem::EType type)
|
||||||
{
|
{
|
||||||
float inv_zoom = (float)wxGetApp().plater()->get_camera().get_inv_zoom();
|
float inv_zoom = (float)wxGetApp().plater()->get_camera().get_inv_zoom();
|
||||||
float factor = inv_zoom * m_layout.scale;
|
float factor = inv_zoom * m_layout.scale;
|
||||||
|
@ -1403,6 +1403,8 @@ void GLToolbar::render_horizontal(const GLCanvas3D& parent)
|
||||||
float left = m_layout.left;
|
float left = m_layout.left;
|
||||||
float top = m_layout.top;
|
float top = m_layout.top;
|
||||||
float right = left + scaled_width;
|
float right = left + scaled_width;
|
||||||
|
if (type == GLToolbarItem::SeparatorLine)
|
||||||
|
right = left + scaled_width * 0.5;
|
||||||
float bottom = top - scaled_height;
|
float bottom = top - scaled_height;
|
||||||
|
|
||||||
render_background(left, top, right, bottom, scaled_border);
|
render_background(left, top, right, bottom, scaled_border);
|
||||||
|
|
|
@ -67,6 +67,7 @@ public:
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
ActionWithText,
|
ActionWithText,
|
||||||
ActionWithTextImage,
|
ActionWithTextImage,
|
||||||
|
SeparatorLine,
|
||||||
Num_Types
|
Num_Types
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -399,7 +400,7 @@ public:
|
||||||
// returns true if any item changed its state
|
// returns true if any item changed its state
|
||||||
bool update_items_state();
|
bool update_items_state();
|
||||||
|
|
||||||
void render(const GLCanvas3D& parent);
|
void render(const GLCanvas3D& parent,GLToolbarItem::EType type = GLToolbarItem::Action);
|
||||||
void render_arrow(const GLCanvas3D& parent, GLToolbarItem* highlighted_item);
|
void render_arrow(const GLCanvas3D& parent, GLToolbarItem* highlighted_item);
|
||||||
|
|
||||||
bool on_mouse(wxMouseEvent& evt, GLCanvas3D& parent);
|
bool on_mouse(wxMouseEvent& evt, GLCanvas3D& parent);
|
||||||
|
@ -428,7 +429,7 @@ private:
|
||||||
int contains_mouse_vertical(const Vec2d& mouse_pos, const GLCanvas3D& parent) const;
|
int contains_mouse_vertical(const Vec2d& mouse_pos, const GLCanvas3D& parent) const;
|
||||||
|
|
||||||
void render_background(float left, float top, float right, float bottom, float border) const;
|
void render_background(float left, float top, float right, float bottom, float border) const;
|
||||||
void render_horizontal(const GLCanvas3D& parent);
|
void render_horizontal(const GLCanvas3D& parent,GLToolbarItem::EType type);
|
||||||
void render_vertical(const GLCanvas3D& parent);
|
void render_vertical(const GLCanvas3D& parent);
|
||||||
|
|
||||||
bool generate_icons_texture();
|
bool generate_icons_texture();
|
||||||
|
|
|
@ -2534,21 +2534,21 @@ float GUI_App::toolbar_icon_scale(const bool is_limited/* = false*/) const
|
||||||
const float icon_sc = m_em_unit * 0.1f;
|
const float icon_sc = m_em_unit * 0.1f;
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
|
|
||||||
|
//return icon_sc;
|
||||||
|
|
||||||
|
const std::string& auto_val = app_config->get("toolkit_size");
|
||||||
|
|
||||||
|
if (auto_val.empty())
|
||||||
return icon_sc;
|
return icon_sc;
|
||||||
|
|
||||||
//const std::string& auto_val = app_config->get("toolkit_size");
|
int int_val = 100;
|
||||||
|
// correct value in respect to toolkit_size
|
||||||
|
int_val = std::min(atoi(auto_val.c_str()), int_val);
|
||||||
|
|
||||||
//if (auto_val.empty())
|
if (is_limited && int_val < 50)
|
||||||
// return icon_sc;
|
int_val = 50;
|
||||||
|
|
||||||
//int int_val = 100;
|
return 0.01f * int_val * icon_sc;
|
||||||
//// correct value in respect to toolkit_size
|
|
||||||
//int_val = std::min(atoi(auto_val.c_str()), int_val);
|
|
||||||
|
|
||||||
//if (is_limited && int_val < 50)
|
|
||||||
// int_val = 50;
|
|
||||||
|
|
||||||
//return 0.01f * int_val * icon_sc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI_App::set_auto_toolbar_icon_scale(float scale) const
|
void GUI_App::set_auto_toolbar_icon_scale(float scale) const
|
||||||
|
|
|
@ -78,6 +78,7 @@ bool View3D::init(wxWindow* parent, Bed3D& bed, Model* model, DynamicPrintConfig
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
m_canvas->enable_select_plate_toolbar(false);
|
m_canvas->enable_select_plate_toolbar(false);
|
||||||
m_canvas->enable_assemble_view_toolbar(true);
|
m_canvas->enable_assemble_view_toolbar(true);
|
||||||
|
m_canvas->enable_separator_toolbar(true);
|
||||||
m_canvas->enable_labels(true);
|
m_canvas->enable_labels(true);
|
||||||
m_canvas->enable_slope(true);
|
m_canvas->enable_slope(true);
|
||||||
|
|
||||||
|
@ -763,6 +764,7 @@ bool AssembleView::init(wxWindow* parent, Bed3D& bed, Model* model, DynamicPrint
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
m_canvas->enable_assemble_view_toolbar(false);
|
m_canvas->enable_assemble_view_toolbar(false);
|
||||||
m_canvas->enable_return_toolbar(true);
|
m_canvas->enable_return_toolbar(true);
|
||||||
|
m_canvas->enable_separator_toolbar(false);
|
||||||
|
|
||||||
// BBS: set volume_selection_mode to Volume
|
// BBS: set volume_selection_mode to Volume
|
||||||
m_canvas->get_selection().set_volume_selection_mode(Selection::Volume);
|
m_canvas->get_selection().set_volume_selection_mode(Selection::Volume);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue