ENABLE_GCODE_VIEWER set as default in:

SysInfoDialog.cpp

Selection hpp/cpp

Preferences.cpp

GUI_Utils.hpp

KBShortcutsDialog.cpp
This commit is contained in:
enricoturri1966 2020-11-18 13:04:34 +01:00
parent faff112ea8
commit 87e1875822
6 changed files with 3 additions and 174 deletions

View File

@ -385,7 +385,6 @@ public:
std::ostream& operator<<(std::ostream &os, const WindowMetrics& metrics);
#if ENABLE_GCODE_VIEWER
inline int hex_digit_to_int(const char c)
{
return
@ -393,7 +392,6 @@ inline int hex_digit_to_int(const char c)
(c >= 'A' && c <= 'F') ? int(c - 'A') + 10 :
(c >= 'a' && c <= 'f') ? int(c - 'a') + 10 : -1;
}
#endif // ENABLE_GCODE_VIEWER
class TaskTimer
{

View File

@ -7,9 +7,7 @@
#include <wx/display.h>
#include "GUI_App.hpp"
#include "wxExtensions.hpp"
#if ENABLE_GCODE_VIEWER
#include "MainFrame.hpp"
#endif // ENABLE_GCODE_VIEWER
#define NOTEBOOK_TOP 1
#define NOTEBOOK_LEFT 2
@ -33,11 +31,7 @@ namespace Slic3r {
namespace GUI {
KBShortcutsDialog::KBShortcutsDialog()
#if ENABLE_GCODE_VIEWER
: DPIDialog((wxWindow*)wxGetApp().mainframe, wxID_ANY, wxString(wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME) + " - " + _L("Keyboard Shortcuts"),
#else
: DPIDialog((wxWindow*)wxGetApp().mainframe, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _L("Keyboard Shortcuts"),
#endif // ENABLE_GCODE_VIEWER
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
@ -97,9 +91,7 @@ void KBShortcutsDialog::fill_shortcuts()
const std::string& ctrl = GUI::shortkey_ctrl_prefix();
const std::string& alt = GUI::shortkey_alt_prefix();
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_editor()) {
#endif // ENABLE_GCODE_VIEWER
Shortcuts commands_shortcuts = {
// File
{ ctrl + "N", L("New project, clear plater") },
@ -204,9 +196,7 @@ void KBShortcutsDialog::fill_shortcuts()
};
m_full_shortcuts.push_back(std::make_pair(_L("Gizmos"), gizmos_shortcuts));
#if ENABLE_GCODE_VIEWER
}
#endif // ENABLE_GCODE_VIEWER
Shortcuts preview_shortcuts = {
{ L("Arrow Up"), L("Upper Layer") },
@ -231,7 +221,6 @@ void KBShortcutsDialog::fill_shortcuts()
m_full_shortcuts.push_back(std::make_pair(_L("Layers Slider"), layers_slider_shortcuts));
#if ENABLE_GCODE_VIEWER
Shortcuts sequential_slider_shortcuts = {
{ L("Arrow Left"), L("Move current slider thumb Left") },
{ L("Arrow Right"), L("Move current slider thumb Right") },
@ -240,7 +229,6 @@ void KBShortcutsDialog::fill_shortcuts()
};
m_full_shortcuts.push_back(std::make_pair(_L("Sequential Slider"), sequential_slider_shortcuts));
#endif // ENABLE_GCODE_VIEWER
}
wxPanel* KBShortcutsDialog::create_header(wxWindow* parent, const wxFont& bold_font)
@ -258,11 +246,7 @@ wxPanel* KBShortcutsDialog::create_header(wxWindow* parent, const wxFont& bold_f
sizer->AddStretchSpacer();
// logo
#if ENABLE_GCODE_VIEWER
m_logo_bmp = ScalableBitmap(this, wxGetApp().is_editor() ? "PrusaSlicer_32px.png" : "PrusaSlicer-gcodeviewer_32px.png", 32);
#else
m_logo_bmp = ScalableBitmap(this, "PrusaSlicer_32px.png", 32);
#endif // ENABLE_GCODE_VIEWER
m_header_bitmap = new wxStaticBitmap(panel, wxID_ANY, m_logo_bmp.bmp());
sizer->Add(m_header_bitmap, 0, wxEXPAND | wxLEFT | wxRIGHT, 10);

View File

@ -40,25 +40,17 @@ void PreferencesDialog::build()
// readonly = > !wxTheApp->have_version_check,
// ));
#if ENABLE_GCODE_VIEWER
bool is_editor = wxGetApp().is_editor();
#endif // ENABLE_GCODE_VIEWER
ConfigOptionDef def;
#if ENABLE_GCODE_VIEWER
Option option(def, "");
if (is_editor) {
#endif // ENABLE_GCODE_VIEWER
def.label = L("Remember output directory");
def.type = coBool;
def.tooltip = L("If this is enabled, Slic3r will prompt the last output directory "
"instead of the one containing the input files.");
def.set_default_value(new ConfigOptionBool{ app_config->has("remember_output_path") ? app_config->get("remember_output_path") == "1" : true });
#if ENABLE_GCODE_VIEWER
option = Option(def, "remember_output_path");
#else
Option option(def, "remember_output_path");
#endif // ENABLE_GCODE_VIEWER
m_optgroup_general->append_single_option_line(option);
def.label = L("Auto-center parts");
@ -134,9 +126,7 @@ void PreferencesDialog::build()
def.set_default_value(new ConfigOptionBool{ app_config->has("single_instance") ? app_config->get("single_instance") == "1" : false });
option = Option(def, "single_instance");
m_optgroup_general->append_single_option_line(option);
#if ENABLE_GCODE_VIEWER
}
#endif // ENABLE_GCODE_VIEWER
#if __APPLE__
def.label = L("Use Retina resolution for the 3D scene");
@ -221,9 +211,7 @@ void PreferencesDialog::build()
}
};
#if ENABLE_GCODE_VIEWER
if (is_editor) {
#endif // ENABLE_GCODE_VIEWER
def.label = L("Show sidebar collapse/expand button");
def.type = coBool;
def.tooltip = L("If enabled, the button for the collapse sidebar will be appeared in top right corner of the 3D Scene");
@ -237,7 +225,6 @@ void PreferencesDialog::build()
def.set_default_value(new ConfigOptionBool{ app_config->get("use_custom_toolbar_size") == "1" });
option = Option(def, "use_custom_toolbar_size");
m_optgroup_gui->append_single_option_line(option);
#if ENABLE_GCODE_VIEWER
}
def.label = L("Sequential slider applied only to top layer");
@ -247,24 +234,17 @@ void PreferencesDialog::build()
def.set_default_value(new ConfigOptionBool{ app_config->get("seq_top_layer_only") == "1" });
option = Option(def, "seq_top_layer_only");
m_optgroup_gui->append_single_option_line(option);
#endif // ENABLE_GCODE_VIEWER
m_optgroup_gui->activate();
#if ENABLE_GCODE_VIEWER
if (is_editor) {
#endif // ENABLE_GCODE_VIEWER
create_icon_size_slider();
m_icon_size_sizer->ShowItems(app_config->get("use_custom_toolbar_size") == "1");
create_settings_mode_widget();
#if ENABLE_GCODE_VIEWER
}
#endif // ENABLE_GCODE_VIEWER
#if ENABLE_GCODE_VIEWER
if (is_editor) {
#endif // ENABLE_GCODE_VIEWER
#if ENABLE_ENVIRONMENT_MAP
m_optgroup_render = std::make_shared<ConfigOptionsGroup>(this, _L("Render"));
m_optgroup_render->label_width = 40;
@ -281,18 +261,14 @@ void PreferencesDialog::build()
m_optgroup_render->activate();
#endif // ENABLE_ENVIRONMENT_MAP
#if ENABLE_GCODE_VIEWER
}
#endif // ENABLE_GCODE_VIEWER
auto sizer = new wxBoxSizer(wxVERTICAL);
sizer->Add(m_optgroup_general->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
sizer->Add(m_optgroup_camera->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
sizer->Add(m_optgroup_gui->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
#if ENABLE_ENVIRONMENT_MAP
#if ENABLE_GCODE_VIEWER
if (m_optgroup_render != nullptr)
#endif // ENABLE_GCODE_VIEWER
sizer->Add(m_optgroup_render->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
#endif // ENABLE_ENVIRONMENT_MAP

View File

@ -16,9 +16,7 @@
#include <GL/glew.h>
#include <boost/algorithm/string/predicate.hpp>
#if ENABLE_GCODE_VIEWER
#include <boost/log/trivial.hpp>
#endif // ENABLE_GCODE_VIEWER
static const float UNIFORM_SCALE_COLOR[4] = { 0.923f, 0.504f, 0.264f, 1.0f };
@ -113,11 +111,6 @@ Selection::Selection()
, m_valid(false)
, m_scale_factor(1.0f)
{
#if !ENABLE_GCODE_VIEWER
m_arrow.reset(new GLArrow);
m_curved_arrow.reset(new GLCurvedArrow(16));
#endif // !ENABLE_GCODE_VIEWER
this->set_bounding_boxes_dirty();
#if ENABLE_RENDER_SELECTION_CENTER
m_quadric = ::gluNewQuadric();
@ -143,20 +136,8 @@ void Selection::set_volumes(GLVolumePtrs* volumes)
// Init shall be called from the OpenGL render function, so that the OpenGL context is initialized!
bool Selection::init()
{
#if ENABLE_GCODE_VIEWER
m_arrow.init_from(straight_arrow(10.0f, 5.0f, 5.0f, 10.0f, 1.0f));
m_curved_arrow.init_from(circular_arrow(16, 10.0f, 5.0f, 10.0f, 5.0f, 1.0f));
#else
if (!m_arrow->init())
return false;
m_arrow->set_scale(5.0 * Vec3d::Ones());
if (!m_curved_arrow->init())
return false;
m_curved_arrow->set_scale(5.0 * Vec3d::Ones());
#endif //ENABLE_GCODE_VIEWER
return true;
}
@ -1962,7 +1943,6 @@ void Selection::render_bounding_box(const BoundingBoxf3& box, float* color) cons
glsafe(::glEnd());
}
#if ENABLE_GCODE_VIEWER
void Selection::render_sidebar_position_hints(const std::string& sidebar_field) const
{
auto set_color = [](Axis axis) {
@ -1984,25 +1964,7 @@ void Selection::render_sidebar_position_hints(const std::string& sidebar_field)
m_arrow.render();
}
}
#else
void Selection::render_sidebar_position_hints(const std::string& sidebar_field) const
{
if (boost::ends_with(sidebar_field, "x"))
{
glsafe(::glRotated(-90.0, 0.0, 0.0, 1.0));
render_sidebar_position_hint(X);
}
else if (boost::ends_with(sidebar_field, "y"))
render_sidebar_position_hint(Y);
else if (boost::ends_with(sidebar_field, "z"))
{
glsafe(::glRotated(90.0, 1.0, 0.0, 0.0));
render_sidebar_position_hint(Z);
}
}
#endif // ENABLE_GCODE_VIEWER
#if ENABLE_GCODE_VIEWER
void Selection::render_sidebar_rotation_hints(const std::string& sidebar_field) const
{
auto set_color = [](Axis axis) {
@ -2030,23 +1992,6 @@ void Selection::render_sidebar_rotation_hints(const std::string& sidebar_field)
render_sidebar_rotation_hint();
}
}
#else
void Selection::render_sidebar_rotation_hints(const std::string & sidebar_field) const
{
if (boost::ends_with(sidebar_field, "x"))
{
glsafe(::glRotated(90.0, 0.0, 1.0, 0.0));
render_sidebar_rotation_hint(X);
}
else if (boost::ends_with(sidebar_field, "y"))
{
glsafe(::glRotated(-90.0, 1.0, 0.0, 0.0));
render_sidebar_rotation_hint(Y);
}
else if (boost::ends_with(sidebar_field, "z"))
render_sidebar_rotation_hint(Z);
}
#endif // ENABLE_GCODE_VIEWER
void Selection::render_sidebar_scale_hints(const std::string& sidebar_field) const
{
@ -2058,38 +2003,27 @@ void Selection::render_sidebar_scale_hints(const std::string& sidebar_field) con
shader->set_uniform("uniform_color", uniform_scale ? UNIFORM_SCALE_COLOR : AXES_COLOR[axis], 4);
glsafe(::glTranslated(0.0, 5.0, 0.0));
#if ENABLE_GCODE_VIEWER
m_arrow.render();
#else
m_arrow->render();
#endif // ENABLE_GCODE_VIEWER
glsafe(::glTranslated(0.0, -10.0, 0.0));
glsafe(::glRotated(180.0, 0.0, 0.0, 1.0));
#if ENABLE_GCODE_VIEWER
m_arrow.render();
#else
m_arrow->render();
#endif // ENABLE_GCODE_VIEWER
};
if (boost::ends_with(sidebar_field, "x") || uniform_scale)
{
if (boost::ends_with(sidebar_field, "x") || uniform_scale) {
glsafe(::glPushMatrix());
glsafe(::glRotated(-90.0, 0.0, 0.0, 1.0));
render_sidebar_scale_hint(X);
glsafe(::glPopMatrix());
}
if (boost::ends_with(sidebar_field, "y") || uniform_scale)
{
if (boost::ends_with(sidebar_field, "y") || uniform_scale) {
glsafe(::glPushMatrix());
render_sidebar_scale_hint(Y);
glsafe(::glPopMatrix());
}
if (boost::ends_with(sidebar_field, "z") || uniform_scale)
{
if (boost::ends_with(sidebar_field, "z") || uniform_scale) {
glsafe(::glPushMatrix());
glsafe(::glRotated(90.0, 1.0, 0.0, 0.0));
render_sidebar_scale_hint(Z);
@ -2169,35 +2103,6 @@ void Selection::render_sidebar_layers_hints(const std::string& sidebar_field) co
glsafe(::glDisable(GL_BLEND));
}
#if !ENABLE_GCODE_VIEWER
void Selection::render_sidebar_position_hint(Axis axis) const
{
m_arrow->set_color(AXES_COLOR[axis], 3);
m_arrow->render();
}
void Selection::render_sidebar_rotation_hint(Axis axis) const
{
m_curved_arrow->set_color(AXES_COLOR[axis], 3);
m_curved_arrow->render();
glsafe(::glRotated(180.0, 0.0, 0.0, 1.0));
m_curved_arrow->render();
}
void Selection::render_sidebar_scale_hint(Axis axis) const
{
m_arrow->set_color(((requires_uniform_scale() || wxGetApp().obj_manipul()->get_uniform_scaling()) ? UNIFORM_SCALE_COLOR : AXES_COLOR[axis]), 3);
glsafe(::glTranslated(0.0, 5.0, 0.0));
m_arrow->render();
glsafe(::glTranslated(0.0, -10.0, 0.0));
glsafe(::glRotated(180.0, 0.0, 0.0, 1.0));
m_arrow->render();
}
#endif // !ENABLE_GCODE_VIEWER
#ifndef NDEBUG
static bool is_rotation_xy_synchronized(const Vec3d &rot_xyz_from, const Vec3d &rot_xyz_to)
{

View File

@ -3,9 +3,7 @@
#include <set>
#include "libslic3r/Geometry.hpp"
#if ENABLE_GCODE_VIEWER
#include "GLModel.hpp"
#endif // ENABLE_GCODE_VIEWER
#if ENABLE_RENDER_SELECTION_CENTER
class GLUquadric;
@ -221,15 +219,8 @@ private:
GLUquadricObj* m_quadric;
#endif // ENABLE_RENDER_SELECTION_CENTER
#if ENABLE_GCODE_VIEWER
GLModel m_arrow;
GLModel m_curved_arrow;
#else
// Arrows are saved through pointers to avoid including 3DScene.hpp.
// It also allows mutability.
std::unique_ptr<GLArrow> m_arrow;
std::unique_ptr<GLCurvedArrow> m_curved_arrow;
#endif // ENABLE_GCODE_VIEWER
mutable float m_scale_factor;
@ -386,11 +377,6 @@ private:
void render_sidebar_rotation_hints(const std::string& sidebar_field) const;
void render_sidebar_scale_hints(const std::string& sidebar_field) const;
void render_sidebar_layers_hints(const std::string& sidebar_field) const;
#if !ENABLE_GCODE_VIEWER
void render_sidebar_position_hint(Axis axis) const;
void render_sidebar_rotation_hint(Axis axis) const;
void render_sidebar_scale_hint(Axis axis) const;
#endif // !ENABLE_GCODE_VIEWER
public:
enum SyncRotationType {

View File

@ -34,17 +34,9 @@ std::string get_main_info(bool format_as_html)
std::string line_end = format_as_html ? "<br>" : "\n";
if (!format_as_html)
#if ENABLE_GCODE_VIEWER
out << b_start << (wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME) << b_end << line_end;
#else
out << b_start << SLIC3R_APP_NAME << b_end << line_end;
#endif // ENABLE_GCODE_VIEWER
out << b_start << "Version: " << b_end << SLIC3R_VERSION << line_end;
#if ENABLE_GCODE_VIEWER
out << b_start << "Build: " << b_end << (wxGetApp().is_editor() ? SLIC3R_BUILD_ID : GCODEVIEWER_BUILD_ID) << line_end;
#else
out << b_start << "Build: " << b_end << SLIC3R_BUILD_ID << line_end;
#endif // ENABLE_GCODE_VIEWER
out << line_end;
out << b_start << "Operating System: " << b_end << wxPlatformInfo::Get().GetOperatingSystemFamilyName() << line_end;
out << b_start << "System Architecture: " << b_end << wxPlatformInfo::Get().GetArchName() << line_end;
@ -86,11 +78,7 @@ std::string get_mem_info(bool format_as_html)
}
SysInfoDialog::SysInfoDialog()
#if ENABLE_GCODE_VIEWER
: DPIDialog((wxWindow*)wxGetApp().mainframe, wxID_ANY, (wxGetApp().is_editor() ? wxString(SLIC3R_APP_NAME) : wxString(GCODEVIEWER_APP_NAME)) + " - " + _L("System Information"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
#else
: DPIDialog((wxWindow*)wxGetApp().mainframe, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _L("System Information"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
#endif // ENABLE_GCODE_VIEWER
{
wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
SetBackgroundColour(bgr_clr);
@ -103,11 +91,7 @@ SysInfoDialog::SysInfoDialog()
main_sizer->Add(hsizer, 1, wxEXPAND | wxALL, 10);
// logo
#if ENABLE_GCODE_VIEWER
m_logo_bmp = ScalableBitmap(this, wxGetApp().is_editor() ? "PrusaSlicer_192px.png" : "PrusaSlicer-gcodeviewer_192px.png", 192);
#else
m_logo_bmp = ScalableBitmap(this, "PrusaSlicer_192px.png", 192);
#endif // ENABLE_GCODE_VIEWER
m_logo = new wxStaticBitmap(this, wxID_ANY, m_logo_bmp.bmp());
hsizer->Add(m_logo, 0, wxALIGN_CENTER_VERTICAL);
@ -116,11 +100,7 @@ SysInfoDialog::SysInfoDialog()
// title
{
#if ENABLE_GCODE_VIEWER
wxStaticText* title = new wxStaticText(this, wxID_ANY, wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME, wxDefaultPosition, wxDefaultSize);
#else
wxStaticText* title = new wxStaticText(this, wxID_ANY, SLIC3R_APP_NAME, wxDefaultPosition, wxDefaultSize);
#endif // ENABLE_GCODE_VIEWER
wxFont title_font = wxGetApp().bold_font();
title_font.SetFamily(wxFONTFAMILY_ROMAN);
title_font.SetPointSize(22);