This commit is contained in:
enricoturri1966 2020-11-18 13:42:54 +01:00
commit badb85650e
15 changed files with 515 additions and 654 deletions

File diff suppressed because it is too large Load diff

View file

@ -794,7 +794,7 @@ bool GUI_App::on_init_inner()
#ifndef __linux__ #ifndef __linux__
wxYield(); wxYield();
#endif #endif
scrn->SetText(_L("Loading configuration...")); scrn->SetText(_L("Loading configuration")+ dots);
} }
preset_bundle = new PresetBundle(); preset_bundle = new PresetBundle();
@ -852,7 +852,7 @@ bool GUI_App::on_init_inner()
// application frame // application frame
if (scrn && is_editor()) if (scrn && is_editor())
scrn->SetText(_L("Preparing settings tabs...")); scrn->SetText(_L("Preparing settings tabs") + dots);
mainframe = new MainFrame(); mainframe = new MainFrame();
// hide settings tabs after first Layout // hide settings tabs after first Layout

View file

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

View file

@ -36,7 +36,7 @@ public:
"SL1 archive files (*.sl1, *.zip)|*.sl1;*.SL1;*.zip;*.ZIP", "SL1 archive files (*.sl1, *.zip)|*.sl1;*.SL1;*.zip;*.ZIP",
wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE | wxFD_OPEN | wxFD_FILE_MUST_EXIST); wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE | wxFD_OPEN | wxFD_FILE_MUST_EXIST);
szfilepck->Add(new wxStaticText(this, wxID_ANY, _(L("Import file: "))), 0, wxALIGN_CENTER); szfilepck->Add(new wxStaticText(this, wxID_ANY, _L("Import file") + ": "), 0, wxALIGN_CENTER);
szfilepck->Add(m_filepicker, 1); szfilepck->Add(m_filepicker, 1);
szvert->Add(szfilepck, 0, wxALL | wxEXPAND, 5); szvert->Add(szfilepck, 0, wxALL | wxEXPAND, 5);
@ -53,7 +53,7 @@ public:
inp_choices.size(), inp_choices.data(), wxCB_READONLY | wxCB_DROPDOWN); inp_choices.size(), inp_choices.data(), wxCB_READONLY | wxCB_DROPDOWN);
szchoices->Add(m_import_dropdown); szchoices->Add(m_import_dropdown);
szchoices->Add(new wxStaticText(this, wxID_ANY, _(L("Quality: "))), 0, wxALIGN_CENTER | wxALL, 5); szchoices->Add(new wxStaticText(this, wxID_ANY, _L("Quality") + ": "), 0, wxALIGN_CENTER | wxALL, 5);
static const std::vector<wxString> qual_choices = { static const std::vector<wxString> qual_choices = {
_(L("Accurate")), _(L("Accurate")),

View file

@ -7,9 +7,7 @@
#include <wx/display.h> #include <wx/display.h>
#include "GUI_App.hpp" #include "GUI_App.hpp"
#include "wxExtensions.hpp" #include "wxExtensions.hpp"
#if ENABLE_GCODE_VIEWER
#include "MainFrame.hpp" #include "MainFrame.hpp"
#endif // ENABLE_GCODE_VIEWER
#define NOTEBOOK_TOP 1 #define NOTEBOOK_TOP 1
#define NOTEBOOK_LEFT 2 #define NOTEBOOK_LEFT 2
@ -33,11 +31,7 @@ namespace Slic3r {
namespace GUI { namespace GUI {
KBShortcutsDialog::KBShortcutsDialog() 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"), : 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) wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{ {
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); 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& ctrl = GUI::shortkey_ctrl_prefix();
const std::string& alt = GUI::shortkey_alt_prefix(); const std::string& alt = GUI::shortkey_alt_prefix();
#if ENABLE_GCODE_VIEWER
if (wxGetApp().is_editor()) { if (wxGetApp().is_editor()) {
#endif // ENABLE_GCODE_VIEWER
Shortcuts commands_shortcuts = { Shortcuts commands_shortcuts = {
// File // File
{ ctrl + "N", L("New project, clear plater") }, { 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)); m_full_shortcuts.push_back(std::make_pair(_L("Gizmos"), gizmos_shortcuts));
#if ENABLE_GCODE_VIEWER
} }
#endif // ENABLE_GCODE_VIEWER
Shortcuts preview_shortcuts = { Shortcuts preview_shortcuts = {
{ L("Arrow Up"), L("Upper Layer") }, { 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)); m_full_shortcuts.push_back(std::make_pair(_L("Layers Slider"), layers_slider_shortcuts));
#if ENABLE_GCODE_VIEWER
Shortcuts sequential_slider_shortcuts = { Shortcuts sequential_slider_shortcuts = {
{ L("Arrow Left"), L("Move current slider thumb Left") }, { L("Arrow Left"), L("Move current slider thumb Left") },
{ L("Arrow Right"), L("Move current slider thumb Right") }, { 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)); 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) 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(); sizer->AddStretchSpacer();
// logo // logo
#if ENABLE_GCODE_VIEWER
m_logo_bmp = ScalableBitmap(this, wxGetApp().is_editor() ? "PrusaSlicer_32px.png" : "PrusaSlicer-gcodeviewer_32px.png", 32); 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()); m_header_bitmap = new wxStaticBitmap(panel, wxID_ANY, m_logo_bmp.bmp());
sizer->Add(m_header_bitmap, 0, wxEXPAND | wxLEFT | wxRIGHT, 10); sizer->Add(m_header_bitmap, 0, wxEXPAND | wxLEFT | wxRIGHT, 10);

View file

@ -162,8 +162,8 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
#endif // ENABLE_GCODE_VIEWER #endif // ENABLE_GCODE_VIEWER
m_statusbar->embed(this); m_statusbar->embed(this);
m_statusbar->set_status_text(_L("Version") + " " + m_statusbar->set_status_text(_L("Version") + " " +
SLIC3R_VERSION + SLIC3R_VERSION + " - " +
_L(" - Remember to check for updates at https://github.com/prusa3d/PrusaSlicer/releases")); _L("Remember to check for updates at https://github.com/prusa3d/PrusaSlicer/releases"));
// initialize tabpanel and menubar // initialize tabpanel and menubar
init_tabpanel(); init_tabpanel();
@ -1582,7 +1582,7 @@ void MainFrame::quick_slice(const int qs)
m_progress_dialog->Destroy(); m_progress_dialog->Destroy();
m_progress_dialog = nullptr; m_progress_dialog = nullptr;
auto message = input_file_basename + _L(" was successfully sliced."); auto message = format(_L("%1% was successfully sliced."), input_file_basename);
// wxTheApp->notify(message); // wxTheApp->notify(message);
wxMessageDialog(this, message, _L("Slicing Done!"), wxOK | wxICON_INFORMATION).ShowModal(); wxMessageDialog(this, message, _L("Slicing Done!"), wxOK | wxICON_INFORMATION).ShowModal();
// }; // };

View file

@ -90,7 +90,7 @@ void OG_CustomCtrl::init_ctrl_lines()
height = m_bmp_blinking_sz.GetHeight() + m_v_gap; height = m_bmp_blinking_sz.GetHeight() + m_v_gap;
ctrl_lines.emplace_back(CtrlLine(height, this, line, true)); ctrl_lines.emplace_back(CtrlLine(height, this, line, true));
} }
else if (opt_group->label_width != 0 && !line.label.IsEmpty()) else if (opt_group->label_width != 0 && (!line.label.IsEmpty() || option_set.front().opt.gui_type == "legend") )
{ {
wxSize label_sz = GetTextExtent(line.label); wxSize label_sz = GetTextExtent(line.label);
height = label_sz.y * (label_sz.GetWidth() > int(opt_group->label_width * m_em_unit) ? 2 : 1) + m_v_gap; height = label_sz.y * (label_sz.GetWidth() > int(opt_group->label_width * m_em_unit) ? 2 : 1) + m_v_gap;
@ -135,7 +135,7 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
} }
wxString label = line.label; wxString label = line.label;
if (opt_group->label_width != 0 && !label.IsEmpty()) if (opt_group->label_width != 0)
h_pos += opt_group->label_width * m_em_unit + m_h_gap; h_pos += opt_group->label_width * m_em_unit + m_h_gap;
int blinking_button_width = m_bmp_blinking_sz.GetWidth() + m_h_gap; int blinking_button_width = m_bmp_blinking_sz.GetWidth() + m_h_gap;
@ -177,10 +177,13 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
GetTextExtent(label, &label_w, &label_h, 0, 0, &m_font); GetTextExtent(label, &label_w, &label_h, 0, 0, &m_font);
h_pos += label_w + 1 + m_h_gap; h_pos += label_w + 1 + m_h_gap;
} }
h_pos += 3 * blinking_button_width; h_pos += (opt.opt.gui_type == "legend" ? 1 : 3) * blinking_button_width;
if (field == field_in) if (field == field_in)
break; break;
if (opt.opt.gui_type == "legend")
h_pos += 2 * blinking_button_width;
h_pos += field->getWindow()->GetSize().x; h_pos += field->getWindow()->GetSize().x;
if (option_set.size() == 1 && option_set.front().opt.full_width) if (option_set.size() == 1 && option_set.front().opt.full_width)
@ -556,7 +559,8 @@ wxCoord OG_CustomCtrl::CtrlLine::draw_mode_bmp(wxDC& dc, wxCoord v_pos)
wxBitmap bmp = create_scaled_bitmap(bmp_name, ctrl, wxOSX ? 10 : 12); wxBitmap bmp = create_scaled_bitmap(bmp_name, ctrl, wxOSX ? 10 : 12);
wxCoord y_draw = v_pos + lround((height - get_bitmap_size(bmp).GetHeight()) / 2); wxCoord y_draw = v_pos + lround((height - get_bitmap_size(bmp).GetHeight()) / 2);
dc.DrawBitmap(bmp, 0, y_draw); if (og_line.get_options().front().opt.gui_type != "legend")
dc.DrawBitmap(bmp, 0, y_draw);
return get_bitmap_size(bmp).GetWidth() + ctrl->m_h_gap; return get_bitmap_size(bmp).GetWidth() + ctrl->m_h_gap;
} }

View file

@ -106,11 +106,20 @@ OptionsGroup::OptionsGroup( wxWindow* _parent, const wxString& title,
bool is_tab_opt /* = false */, bool is_tab_opt /* = false */,
column_t extra_clmn /* = nullptr */) : column_t extra_clmn /* = nullptr */) :
m_parent(_parent), title(title), m_parent(_parent), title(title),
m_show_modified_btns(is_tab_opt), m_use_custom_ctrl(is_tab_opt),
staticbox(title!=""), extra_column(extra_clmn) staticbox(title!=""), extra_column(extra_clmn)
{ {
} }
bool OptionsGroup::is_legend_line()
{
if (m_lines.size() == 1) {
const std::vector<Option>& option_set = m_lines.front().get_options();
return !option_set.empty() && option_set.front().opt.gui_type == "legend";
}
return false;
}
void OptionsGroup::show_field(const t_config_option_key& opt_key, bool show/* = true*/) void OptionsGroup::show_field(const t_config_option_key& opt_key, bool show/* = true*/)
{ {
Field* field = get_field(opt_key); Field* field = get_field(opt_key);
@ -196,16 +205,20 @@ void OptionsGroup::activate_line(Line& line)
} }
} }
if (!custom_ctrl && m_show_modified_btns) {
custom_ctrl = new OG_CustomCtrl((wxWindow*)this->stb, this);
sizer->Add(custom_ctrl, 0, wxEXPAND | wxALL, wxOSX || !staticbox ? 0 : 5);
}
auto option_set = line.get_options(); auto option_set = line.get_options();
bool is_legend_line = option_set.front().opt.gui_type == "legend";
if (!custom_ctrl && m_use_custom_ctrl) {
custom_ctrl = new OG_CustomCtrl(is_legend_line ? this->parent() : (wxWindow*)this->stb, this);
if (is_legend_line)
sizer->Add(custom_ctrl, 0, wxEXPAND | wxLEFT, wxOSX ? 0 : 10);
else
sizer->Add(custom_ctrl, 0, wxEXPAND | wxALL, wxOSX || !staticbox ? 0 : 5);
}
// Set sidetext width for a better alignment of options in line // Set sidetext width for a better alignment of options in line
// "m_show_modified_btns==true" means that options groups are in tabs // "m_show_modified_btns==true" means that options groups are in tabs
if (option_set.size() > 1 && m_show_modified_btns) { if (option_set.size() > 1 && m_use_custom_ctrl) {
sidetext_width = Field::def_width_thinner(); sidetext_width = Field::def_width_thinner();
} }
@ -231,7 +244,7 @@ void OptionsGroup::activate_line(Line& line)
m_use_custom_ctrl_as_parent = true; m_use_custom_ctrl_as_parent = true;
// if we have an extra column, build it // if we have an extra column, build it
if (extra_column && !m_show_modified_btns) if (extra_column)
{ {
m_extra_column_item_ptrs.push_back(extra_column(this->ctrl_parent(), line)); m_extra_column_item_ptrs.push_back(extra_column(this->ctrl_parent(), line));
grid_sizer->Add(m_extra_column_item_ptrs.back(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 3); grid_sizer->Add(m_extra_column_item_ptrs.back(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 3);
@ -511,7 +524,7 @@ Option ConfigOptionsGroup::get_option(const std::string& opt_key, int opt_index
std::pair<std::string, int> pair(opt_key, opt_index); std::pair<std::string, int> pair(opt_key, opt_index);
m_opt_map.emplace(opt_id, pair); m_opt_map.emplace(opt_id, pair);
if (m_show_modified_btns) // fill group and category values just fro options from Settings Tab if (m_use_custom_ctrl) // fill group and category values just for options from Settings Tab
wxGetApp().sidebar().get_searcher().add_key(opt_id, title, this->config_category()); wxGetApp().sidebar().get_searcher().add_key(opt_id, title, this->config_category());
return Option(*m_config->def()->get(opt_key), opt_id); return Option(*m_config->def()->get(opt_key), opt_id);

View file

@ -129,7 +129,7 @@ public:
#endif /* __WXGTK__ */ #endif /* __WXGTK__ */
wxWindow* ctrl_parent() const { wxWindow* ctrl_parent() const {
return this->stb ? (this->custom_ctrl && m_use_custom_ctrl_as_parent ? (wxWindow*)this->custom_ctrl : (wxWindow*)this->stb) : this->parent(); return this->custom_ctrl && m_use_custom_ctrl_as_parent ? (wxWindow*)this->custom_ctrl : (this->stb ? (wxWindow*)this->stb : this->parent());
} }
void append_line(const Line& line); void append_line(const Line& line);
@ -173,10 +173,6 @@ public:
inline void disable() { for (auto& field : m_fields) field.second->disable(); } inline void disable() { for (auto& field : m_fields) field.second->disable(); }
void set_grid_vgap(int gap) { m_grid_sizer->SetVGap(gap); } void set_grid_vgap(int gap) { m_grid_sizer->SetVGap(gap); }
void set_show_modified_btns_val(bool show) {
m_show_modified_btns = show;
}
void clear_fields_except_of(const std::vector<std::string> left_fields); void clear_fields_except_of(const std::vector<std::string> left_fields);
void hide_labels() { label_width = 0; } void hide_labels() { label_width = 0; }
@ -187,6 +183,7 @@ public:
wxGridSizer* get_grid_sizer() { return m_grid_sizer; } wxGridSizer* get_grid_sizer() { return m_grid_sizer; }
const std::vector<Line>& get_lines() { return m_lines; } const std::vector<Line>& get_lines() { return m_lines; }
bool is_legend_line();
protected: protected:
std::map<t_config_option_key, Option> m_options; std::map<t_config_option_key, Option> m_options;
@ -203,7 +200,7 @@ protected:
bool m_disabled {false}; bool m_disabled {false};
wxGridSizer* m_grid_sizer {nullptr}; wxGridSizer* m_grid_sizer {nullptr};
// "true" if option is created in preset tabs // "true" if option is created in preset tabs
bool m_show_modified_btns{ false }; bool m_use_custom_ctrl{ false };
// "true" if control should be created on custom_ctrl // "true" if control should be created on custom_ctrl
bool m_use_custom_ctrl_as_parent { false }; bool m_use_custom_ctrl_as_parent { false };

View file

@ -745,9 +745,9 @@ Sidebar::Sidebar(Plater *parent)
(*btn)->Hide(); (*btn)->Hide();
}; };
init_scalable_btn(&p->btn_send_gcode , "export_gcode", _L("Send to printer ") + GUI::shortkey_ctrl_prefix() + "Shift+G"); init_scalable_btn(&p->btn_send_gcode , "export_gcode", _L("Send to printer") + " " +GUI::shortkey_ctrl_prefix() + "Shift+G");
// init_scalable_btn(&p->btn_eject_device, "eject_sd" , _L("Remove device ") + GUI::shortkey_ctrl_prefix() + "T"); // init_scalable_btn(&p->btn_eject_device, "eject_sd" , _L("Remove device ") + GUI::shortkey_ctrl_prefix() + "T");
init_scalable_btn(&p->btn_export_gcode_removable, "export_to_sd", _L("Export to SD card / Flash drive ") + GUI::shortkey_ctrl_prefix() + "U"); init_scalable_btn(&p->btn_export_gcode_removable, "export_to_sd", _L("Export to SD card / Flash drive") + " " + GUI::shortkey_ctrl_prefix() + "U");
// regular buttons "Slice now" and "Export G-code" // regular buttons "Slice now" and "Export G-code"

View file

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

View file

@ -16,9 +16,7 @@
#include <GL/glew.h> #include <GL/glew.h>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#if ENABLE_GCODE_VIEWER
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
#endif // ENABLE_GCODE_VIEWER
static const float UNIFORM_SCALE_COLOR[4] = { 0.923f, 0.504f, 0.264f, 1.0f }; 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_valid(false)
, m_scale_factor(1.0f) , 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(); this->set_bounding_boxes_dirty();
#if ENABLE_RENDER_SELECTION_CENTER #if ENABLE_RENDER_SELECTION_CENTER
m_quadric = ::gluNewQuadric(); 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! // Init shall be called from the OpenGL render function, so that the OpenGL context is initialized!
bool Selection::init() bool Selection::init()
{ {
#if ENABLE_GCODE_VIEWER
m_arrow.init_from(straight_arrow(10.0f, 5.0f, 5.0f, 10.0f, 1.0f)); 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)); 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; return true;
} }
@ -1962,7 +1943,6 @@ void Selection::render_bounding_box(const BoundingBoxf3& box, float* color) cons
glsafe(::glEnd()); glsafe(::glEnd());
} }
#if ENABLE_GCODE_VIEWER
void Selection::render_sidebar_position_hints(const std::string& sidebar_field) const void Selection::render_sidebar_position_hints(const std::string& sidebar_field) const
{ {
auto set_color = [](Axis axis) { auto set_color = [](Axis axis) {
@ -1984,25 +1964,7 @@ void Selection::render_sidebar_position_hints(const std::string& sidebar_field)
m_arrow.render(); 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 void Selection::render_sidebar_rotation_hints(const std::string& sidebar_field) const
{ {
auto set_color = [](Axis axis) { auto set_color = [](Axis axis) {
@ -2030,23 +1992,6 @@ void Selection::render_sidebar_rotation_hints(const std::string& sidebar_field)
render_sidebar_rotation_hint(); 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 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); shader->set_uniform("uniform_color", uniform_scale ? UNIFORM_SCALE_COLOR : AXES_COLOR[axis], 4);
glsafe(::glTranslated(0.0, 5.0, 0.0)); glsafe(::glTranslated(0.0, 5.0, 0.0));
#if ENABLE_GCODE_VIEWER
m_arrow.render(); m_arrow.render();
#else
m_arrow->render();
#endif // ENABLE_GCODE_VIEWER
glsafe(::glTranslated(0.0, -10.0, 0.0)); glsafe(::glTranslated(0.0, -10.0, 0.0));
glsafe(::glRotated(180.0, 0.0, 0.0, 1.0)); glsafe(::glRotated(180.0, 0.0, 0.0, 1.0));
#if ENABLE_GCODE_VIEWER
m_arrow.render(); 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(::glPushMatrix());
glsafe(::glRotated(-90.0, 0.0, 0.0, 1.0)); glsafe(::glRotated(-90.0, 0.0, 0.0, 1.0));
render_sidebar_scale_hint(X); render_sidebar_scale_hint(X);
glsafe(::glPopMatrix()); glsafe(::glPopMatrix());
} }
if (boost::ends_with(sidebar_field, "y") || uniform_scale) if (boost::ends_with(sidebar_field, "y") || uniform_scale) {
{
glsafe(::glPushMatrix()); glsafe(::glPushMatrix());
render_sidebar_scale_hint(Y); render_sidebar_scale_hint(Y);
glsafe(::glPopMatrix()); glsafe(::glPopMatrix());
} }
if (boost::ends_with(sidebar_field, "z") || uniform_scale) if (boost::ends_with(sidebar_field, "z") || uniform_scale) {
{
glsafe(::glPushMatrix()); glsafe(::glPushMatrix());
glsafe(::glRotated(90.0, 1.0, 0.0, 0.0)); glsafe(::glRotated(90.0, 1.0, 0.0, 0.0));
render_sidebar_scale_hint(Z); 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)); 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 #ifndef NDEBUG
static bool is_rotation_xy_synchronized(const Vec3d &rot_xyz_from, const Vec3d &rot_xyz_to) 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 <set>
#include "libslic3r/Geometry.hpp" #include "libslic3r/Geometry.hpp"
#if ENABLE_GCODE_VIEWER
#include "GLModel.hpp" #include "GLModel.hpp"
#endif // ENABLE_GCODE_VIEWER
#if ENABLE_RENDER_SELECTION_CENTER #if ENABLE_RENDER_SELECTION_CENTER
class GLUquadric; class GLUquadric;
@ -221,15 +219,8 @@ private:
GLUquadricObj* m_quadric; GLUquadricObj* m_quadric;
#endif // ENABLE_RENDER_SELECTION_CENTER #endif // ENABLE_RENDER_SELECTION_CENTER
#if ENABLE_GCODE_VIEWER
GLModel m_arrow; GLModel m_arrow;
GLModel m_curved_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; mutable float m_scale_factor;
@ -386,11 +377,6 @@ private:
void render_sidebar_rotation_hints(const std::string& sidebar_field) const; 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_scale_hints(const std::string& sidebar_field) const;
void render_sidebar_layers_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: public:
enum SyncRotationType { 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"; std::string line_end = format_as_html ? "<br>" : "\n";
if (!format_as_html) if (!format_as_html)
#if ENABLE_GCODE_VIEWER
out << b_start << (wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME) << b_end << line_end; 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; 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; 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 << line_end;
out << b_start << "Operating System: " << b_end << wxPlatformInfo::Get().GetOperatingSystemFamilyName() << 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; 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() 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) : 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); wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
SetBackgroundColour(bgr_clr); SetBackgroundColour(bgr_clr);
@ -103,11 +91,7 @@ SysInfoDialog::SysInfoDialog()
main_sizer->Add(hsizer, 1, wxEXPAND | wxALL, 10); main_sizer->Add(hsizer, 1, wxEXPAND | wxALL, 10);
// logo // logo
#if ENABLE_GCODE_VIEWER
m_logo_bmp = ScalableBitmap(this, wxGetApp().is_editor() ? "PrusaSlicer_192px.png" : "PrusaSlicer-gcodeviewer_192px.png", 192); 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()); m_logo = new wxStaticBitmap(this, wxID_ANY, m_logo_bmp.bmp());
hsizer->Add(m_logo, 0, wxALIGN_CENTER_VERTICAL); hsizer->Add(m_logo, 0, wxALIGN_CENTER_VERTICAL);
@ -116,11 +100,7 @@ SysInfoDialog::SysInfoDialog()
// title // title
{ {
#if ENABLE_GCODE_VIEWER
wxStaticText* title = new wxStaticText(this, wxID_ANY, wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME, wxDefaultPosition, wxDefaultSize); 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(); wxFont title_font = wxGetApp().bold_font();
title_font.SetFamily(wxFONTFAMILY_ROMAN); title_font.SetFamily(wxFONTFAMILY_ROMAN);
title_font.SetPointSize(22); title_font.SetPointSize(22);

View file

@ -2372,13 +2372,11 @@ PageShp TabPrinter::build_kinematics_page()
if (m_use_silent_mode) { if (m_use_silent_mode) {
// Legend for OptionsGroups // Legend for OptionsGroups
auto optgroup = page->new_optgroup(""); auto optgroup = page->new_optgroup("");
optgroup->set_show_modified_btns_val(false);
optgroup->label_width = 23;// 230;
auto line = Line{ "", "" }; auto line = Line{ "", "" };
ConfigOptionDef def; ConfigOptionDef def;
def.type = coString; def.type = coString;
def.width = 15; def.width = Field::def_width();
def.gui_type = "legend"; def.gui_type = "legend";
def.mode = comAdvanced; def.mode = comAdvanced;
def.tooltip = L("Values in this column are for Normal mode"); def.tooltip = L("Values in this column are for Normal mode");
@ -3783,7 +3781,7 @@ void Page::activate(ConfigOptionMode mode, std::function<void()> throw_if_cancel
for (auto group : m_optgroups) { for (auto group : m_optgroups) {
if (!group->activate(throw_if_canceled)) if (!group->activate(throw_if_canceled))
continue; continue;
m_vsizer->Add(group->sizer, 0, wxEXPAND | wxALL, 10); m_vsizer->Add(group->sizer, 0, wxEXPAND | (group->is_legend_line() ? (wxLEFT|wxTOP) : wxALL), 10);
group->update_visibility(mode); group->update_visibility(mode);
group->reload_config(); group->reload_config();
throw_if_canceled(); throw_if_canceled();