ENABLE_GCODE_VIEWER_AS_STATE -> Removed tabs from gcode viewer state

This commit is contained in:
enricoturri1966 2020-06-19 15:32:44 +02:00
parent 653efca5b4
commit eb215fe994
4 changed files with 57 additions and 4 deletions

View file

@ -60,7 +60,7 @@
// Enable G-Code viewer
#define ENABLE_GCODE_VIEWER (1 && ENABLE_2_3_0_ALPHA1)
#define ENABLE_GCODE_VIEWER_STATISTICS (0 && ENABLE_GCODE_VIEWER)
#define ENABLE_GCODE_VIEWER_SHADERS_EDITOR (1 && ENABLE_GCODE_VIEWER)
#define ENABLE_GCODE_VIEWER_SHADERS_EDITOR (0 && ENABLE_GCODE_VIEWER)
#define ENABLE_GCODE_VIEWER_AS_STATE (1 && ENABLE_GCODE_VIEWER)

View file

@ -694,7 +694,11 @@ void Bed3D::render_default(bool bottom) const
{
// draw background
glsafe(::glDepthMask(GL_FALSE));
#if ENABLE_LAYOUT_NO_RESTART
glsafe(::glColor4fv(m_model_color.data()));
#else
glsafe(::glColor4f(0.35f, 0.35f, 0.35f, 0.4f));
#endif // ENABLE_LAYOUT_NO_RESTART
glsafe(::glNormal3d(0.0f, 0.0f, 1.0f));
glsafe(::glVertexPointer(3, GL_FLOAT, m_triangles.get_vertex_data_size(), (GLvoid*)m_triangles.get_vertices_data()));
glsafe(::glDrawArrays(GL_TRIANGLES, 0, (GLsizei)triangles_vcount));
@ -702,11 +706,23 @@ void Bed3D::render_default(bool bottom) const
}
// draw grid
#if ENABLE_LAYOUT_NO_RESTART
glsafe(::glLineWidth(1.5f * m_scale_factor));
#else
glsafe(::glLineWidth(3.0f * m_scale_factor));
#endif // ENABLE_LAYOUT_NO_RESTART
if (has_model && !bottom)
#if ENABLE_LAYOUT_NO_RESTART
glsafe(::glColor4f(0.9f, 0.9f, 0.9f, 1.0f));
#else
glsafe(::glColor4f(0.75f, 0.75f, 0.75f, 1.0f));
#endif // ENABLE_LAYOUT_NO_RESTART
else
#if ENABLE_LAYOUT_NO_RESTART
glsafe(::glColor4f(0.9f, 0.9f, 0.9f, 0.6f));
#else
glsafe(::glColor4f(0.2f, 0.2f, 0.2f, 0.4f));
#endif //ENABLE_LAYOUT_NO_RESTART
glsafe(::glVertexPointer(3, GL_FLOAT, m_triangles.get_vertex_data_size(), (GLvoid*)m_gridlines.get_vertices_data()));
glsafe(::glDrawArrays(GL_LINES, 0, (GLsizei)m_gridlines.get_vertices_count()));

View file

@ -323,9 +323,16 @@ void MainFrame::update_layout()
Layout();
};
#if ENABLE_GCODE_VIEWER_AS_STATE
ESettingsLayout layout = (m_mode == EMode::GCodeViewer) ? ESettingsLayout::GCodeViewer :
(wxGetApp().app_config->get("old_settings_layout_mode") == "1" ? ESettingsLayout::Old :
wxGetApp().app_config->get("new_settings_layout_mode") == "1" ? ESettingsLayout::New :
wxGetApp().app_config->get("dlg_settings_layout_mode") == "1" ? ESettingsLayout::Dlg : ESettingsLayout::Old);
#else
ESettingsLayout layout = wxGetApp().app_config->get("old_settings_layout_mode") == "1" ? ESettingsLayout::Old :
wxGetApp().app_config->get("new_settings_layout_mode") == "1" ? ESettingsLayout::New :
wxGetApp().app_config->get("dlg_settings_layout_mode") == "1" ? ESettingsLayout::Dlg : ESettingsLayout::Old;
#endif // ENABLE_GCODE_VIEWER_AS_STATE
if (m_layout == layout)
return;
@ -377,6 +384,14 @@ void MainFrame::update_layout()
m_plater->Show();
break;
}
#if ENABLE_GCODE_VIEWER_AS_STATE
case ESettingsLayout::GCodeViewer:
{
GetSizer()->Add(m_plater, 1, wxEXPAND);
m_plater->Show();
break;
}
#endif // ENABLE_GCODE_VIEWER_AS_STATE
}
//#ifdef __APPLE__
@ -1090,7 +1105,8 @@ void MainFrame::init_menubar()
#if ENABLE_GCODE_VIEWER_AS_STATE
fileMenu->AppendSeparator();
append_menu_item(fileMenu, wxID_ANY, _L("&G-code preview"), _L("Switch to G-code preview mode"),
[this](wxCommandEvent&) { set_mode(EMode::GCodeViewer); });
[this](wxCommandEvent&) { set_mode(EMode::GCodeViewer); }, "", nullptr,
[this]() { return m_plater != nullptr && m_plater->printer_technology() != ptSLA; }, this);
#endif // ENABLE_GCODE_VIEWER_AS_STATE
fileMenu->AppendSeparator();
append_menu_item(fileMenu, wxID_EXIT, _L("&Quit"), wxString::Format(_L("Quit %s"), SLIC3R_APP_NAME),
@ -1381,16 +1397,30 @@ void MainFrame::init_gcodeviewer_menubar()
void MainFrame::set_mode(EMode mode)
{
if (m_mode == mode)
return;
wxBusyCursor busy;
m_mode = mode;
switch (m_mode)
{
default:
case EMode::Editor:
{
#if ENABLE_LAYOUT_NO_RESTART
update_layout();
select_tab(0);
#endif // ENABLE_LAYOUT_NO_RESTART
m_plater->reset();
m_plater->Freeze();
// reinitialize undo/redo stack
m_plater->clear_undo_redo_stack_main();
m_plater->take_snapshot(_L("New Project"));
// switch view
m_plater->select_view_3D("3D");
m_plater->select_view("iso");
@ -1421,6 +1451,10 @@ void MainFrame::set_mode(EMode mode)
}
case EMode::GCodeViewer:
{
#if ENABLE_LAYOUT_NO_RESTART
update_layout();
#endif // ENABLE_LAYOUT_NO_RESTART
m_plater->reset();
m_plater->reset_last_loaded_gcode();

View file

@ -138,6 +138,9 @@ class MainFrame : public DPIFrame
Old,
New,
Dlg,
#if ENABLE_GCODE_VIEWER_AS_STATE
GCodeViewer
#endif // ENABLE_GCODE_VIEWER_AS_STATE
};
ESettingsLayout m_layout{ ESettingsLayout::Unknown };