ENABLE_GCODE_VIEWER_AS_STATE -> Removed tabs from gcode viewer state
This commit is contained in:
parent
653efca5b4
commit
eb215fe994
4 changed files with 57 additions and 4 deletions
|
@ -60,7 +60,7 @@
|
||||||
// Enable G-Code viewer
|
// Enable G-Code viewer
|
||||||
#define ENABLE_GCODE_VIEWER (1 && ENABLE_2_3_0_ALPHA1)
|
#define ENABLE_GCODE_VIEWER (1 && ENABLE_2_3_0_ALPHA1)
|
||||||
#define ENABLE_GCODE_VIEWER_STATISTICS (0 && ENABLE_GCODE_VIEWER)
|
#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)
|
#define ENABLE_GCODE_VIEWER_AS_STATE (1 && ENABLE_GCODE_VIEWER)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -694,7 +694,11 @@ void Bed3D::render_default(bool bottom) const
|
||||||
{
|
{
|
||||||
// draw background
|
// draw background
|
||||||
glsafe(::glDepthMask(GL_FALSE));
|
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));
|
glsafe(::glColor4f(0.35f, 0.35f, 0.35f, 0.4f));
|
||||||
|
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||||
glsafe(::glNormal3d(0.0f, 0.0f, 1.0f));
|
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(::glVertexPointer(3, GL_FLOAT, m_triangles.get_vertex_data_size(), (GLvoid*)m_triangles.get_vertices_data()));
|
||||||
glsafe(::glDrawArrays(GL_TRIANGLES, 0, (GLsizei)triangles_vcount));
|
glsafe(::glDrawArrays(GL_TRIANGLES, 0, (GLsizei)triangles_vcount));
|
||||||
|
@ -702,11 +706,23 @@ void Bed3D::render_default(bool bottom) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw grid
|
// draw grid
|
||||||
|
#if ENABLE_LAYOUT_NO_RESTART
|
||||||
|
glsafe(::glLineWidth(1.5f * m_scale_factor));
|
||||||
|
#else
|
||||||
glsafe(::glLineWidth(3.0f * m_scale_factor));
|
glsafe(::glLineWidth(3.0f * m_scale_factor));
|
||||||
|
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||||
if (has_model && !bottom)
|
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));
|
glsafe(::glColor4f(0.75f, 0.75f, 0.75f, 1.0f));
|
||||||
|
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||||
else
|
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));
|
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(::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()));
|
glsafe(::glDrawArrays(GL_LINES, 0, (GLsizei)m_gridlines.get_vertices_count()));
|
||||||
|
|
||||||
|
|
|
@ -323,9 +323,16 @@ void MainFrame::update_layout()
|
||||||
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 :
|
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("new_settings_layout_mode") == "1" ? ESettingsLayout::New :
|
||||||
wxGetApp().app_config->get("dlg_settings_layout_mode") == "1" ? ESettingsLayout::Dlg : ESettingsLayout::Old;
|
wxGetApp().app_config->get("dlg_settings_layout_mode") == "1" ? ESettingsLayout::Dlg : ESettingsLayout::Old;
|
||||||
|
#endif // ENABLE_GCODE_VIEWER_AS_STATE
|
||||||
|
|
||||||
if (m_layout == layout)
|
if (m_layout == layout)
|
||||||
return;
|
return;
|
||||||
|
@ -377,6 +384,14 @@ void MainFrame::update_layout()
|
||||||
m_plater->Show();
|
m_plater->Show();
|
||||||
break;
|
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__
|
//#ifdef __APPLE__
|
||||||
|
@ -1082,15 +1097,16 @@ void MainFrame::init_menubar()
|
||||||
#endif
|
#endif
|
||||||
m_menu_item_reslice_now = append_menu_item(fileMenu, wxID_ANY, _L("(Re)Slice No&w") + "\tCtrl+R", _L("Start new slicing process"),
|
m_menu_item_reslice_now = append_menu_item(fileMenu, wxID_ANY, _L("(Re)Slice No&w") + "\tCtrl+R", _L("Start new slicing process"),
|
||||||
[this](wxCommandEvent&) { reslice_now(); }, "re_slice", nullptr,
|
[this](wxCommandEvent&) { reslice_now(); }, "re_slice", nullptr,
|
||||||
[this](){return m_plater != nullptr && can_reslice(); }, this);
|
[this]() { return m_plater != nullptr && can_reslice(); }, this);
|
||||||
fileMenu->AppendSeparator();
|
fileMenu->AppendSeparator();
|
||||||
append_menu_item(fileMenu, wxID_ANY, _L("&Repair STL file") + dots, _L("Automatically repair an STL file"),
|
append_menu_item(fileMenu, wxID_ANY, _L("&Repair STL file") + dots, _L("Automatically repair an STL file"),
|
||||||
[this](wxCommandEvent&) { repair_stl(); }, "wrench", nullptr,
|
[this](wxCommandEvent&) { repair_stl(); }, "wrench", nullptr,
|
||||||
[this]() {return true; }, this);
|
[this]() { return true; }, this);
|
||||||
#if ENABLE_GCODE_VIEWER_AS_STATE
|
#if ENABLE_GCODE_VIEWER_AS_STATE
|
||||||
fileMenu->AppendSeparator();
|
fileMenu->AppendSeparator();
|
||||||
append_menu_item(fileMenu, wxID_ANY, _L("&G-code preview"), _L("Switch to G-code preview mode"),
|
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
|
#endif // ENABLE_GCODE_VIEWER_AS_STATE
|
||||||
fileMenu->AppendSeparator();
|
fileMenu->AppendSeparator();
|
||||||
append_menu_item(fileMenu, wxID_EXIT, _L("&Quit"), wxString::Format(_L("Quit %s"), SLIC3R_APP_NAME),
|
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)
|
void MainFrame::set_mode(EMode mode)
|
||||||
{
|
{
|
||||||
|
if (m_mode == mode)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxBusyCursor busy;
|
||||||
|
|
||||||
m_mode = mode;
|
m_mode = mode;
|
||||||
switch (m_mode)
|
switch (m_mode)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case EMode::Editor:
|
case EMode::Editor:
|
||||||
{
|
{
|
||||||
|
#if ENABLE_LAYOUT_NO_RESTART
|
||||||
|
update_layout();
|
||||||
|
select_tab(0);
|
||||||
|
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||||
|
|
||||||
m_plater->reset();
|
m_plater->reset();
|
||||||
|
|
||||||
m_plater->Freeze();
|
m_plater->Freeze();
|
||||||
|
|
||||||
|
// reinitialize undo/redo stack
|
||||||
|
m_plater->clear_undo_redo_stack_main();
|
||||||
|
m_plater->take_snapshot(_L("New Project"));
|
||||||
|
|
||||||
// switch view
|
// switch view
|
||||||
m_plater->select_view_3D("3D");
|
m_plater->select_view_3D("3D");
|
||||||
m_plater->select_view("iso");
|
m_plater->select_view("iso");
|
||||||
|
@ -1421,6 +1451,10 @@ void MainFrame::set_mode(EMode mode)
|
||||||
}
|
}
|
||||||
case EMode::GCodeViewer:
|
case EMode::GCodeViewer:
|
||||||
{
|
{
|
||||||
|
#if ENABLE_LAYOUT_NO_RESTART
|
||||||
|
update_layout();
|
||||||
|
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||||
|
|
||||||
m_plater->reset();
|
m_plater->reset();
|
||||||
m_plater->reset_last_loaded_gcode();
|
m_plater->reset_last_loaded_gcode();
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,9 @@ class MainFrame : public DPIFrame
|
||||||
Old,
|
Old,
|
||||||
New,
|
New,
|
||||||
Dlg,
|
Dlg,
|
||||||
|
#if ENABLE_GCODE_VIEWER_AS_STATE
|
||||||
|
GCodeViewer
|
||||||
|
#endif // ENABLE_GCODE_VIEWER_AS_STATE
|
||||||
};
|
};
|
||||||
|
|
||||||
ESettingsLayout m_layout{ ESettingsLayout::Unknown };
|
ESettingsLayout m_layout{ ESettingsLayout::Unknown };
|
||||||
|
|
Loading…
Reference in a new issue