Fixed conflicts after merge with master
This commit is contained in:
commit
0eb6ba96d6
27
resources/icons/ironing.svg
Normal file
27
resources/icons/ironing.svg
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 24.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
|
||||
<g id="ironing">
|
||||
<g>
|
||||
<path fill="#ED6B21" d="M14,9.42H2c-0.39,0-0.71-0.32-0.71-0.71C1.29,7.08,2.07,4,5,4h8c0.33,0,0.61,0.22,0.69,0.54l1,4
|
||||
c0.05,0.21,0,0.44-0.13,0.61C14.42,9.32,14.22,9.42,14,9.42z M2.77,8h10.32l-0.65-2.58H5C3.39,5.42,2.91,7.03,2.77,8z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#ED6B21" d="M13,5.42c-0.39,0-0.71-0.32-0.71-0.71v-1c0-1.18-0.99-1.29-1.3-1.29H6c-0.39,0-0.71-0.32-0.71-0.71
|
||||
S5.61,1,6,1h5c1.05,0,2.61,0.68,2.7,2.52c0,0.03,0,0.06,0,0.08v1.1C13.71,5.1,13.39,5.42,13,5.42z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#808080" d="M14.65,15H1.35C1.16,15,1,14.84,1,14.65s0.16-0.35,0.35-0.35h13.29c0.2,0,0.35,0.16,0.35,0.35
|
||||
S14.84,15,14.65,15z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#808080" d="M14.65,13H1.35C1.16,13,1,12.84,1,12.65s0.16-0.35,0.35-0.35h13.29c0.2,0,0.35,0.16,0.35,0.35
|
||||
S14.84,13,14.65,13z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#808080" d="M14.65,11H1.35C1.16,11,1,10.84,1,10.65s0.16-0.35,0.35-0.35h13.29c0.2,0,0.35,0.16,0.35,0.35
|
||||
S14.84,11,14.65,11z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
@ -54,9 +54,6 @@
|
||||
// Enable built-in DPI changed event handler of wxWidgets 3.1.3
|
||||
#define ENABLE_WX_3_1_3_DPI_CHANGED_EVENT (1 && ENABLE_2_3_0_ALPHA1)
|
||||
|
||||
// Enable changing application layout without the need to restart
|
||||
#define ENABLE_LAYOUT_NO_RESTART (1 && ENABLE_2_3_0_ALPHA1)
|
||||
|
||||
// Enable G-Code viewer
|
||||
#define ENABLE_GCODE_VIEWER (1 && ENABLE_2_3_0_ALPHA1)
|
||||
#define ENABLE_GCODE_VIEWER_STATISTICS (0 && ENABLE_GCODE_VIEWER)
|
||||
|
@ -710,23 +710,11 @@ 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()));
|
||||
|
||||
|
@ -1075,34 +1075,21 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
|
||||
break;
|
||||
case ConfigMenuPreferences:
|
||||
{
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
bool app_layout_changed = false;
|
||||
#else
|
||||
bool recreate_app = false;
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
{
|
||||
// the dialog needs to be destroyed before the call to recreate_GUI()
|
||||
// or sometimes the application crashes into wxDialogBase() destructor
|
||||
// so we put it into an inner scope
|
||||
PreferencesDialog dlg(mainframe);
|
||||
dlg.ShowModal();
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
app_layout_changed = dlg.settings_layout_changed();
|
||||
#else
|
||||
recreate_app = dlg.settings_layout_changed();
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
}
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
if (app_layout_changed) {
|
||||
mainframe->GetSizer()->Hide((size_t)0);
|
||||
mainframe->update_layout();
|
||||
mainframe->select_tab(0);
|
||||
mainframe->GetSizer()->Show((size_t)0);
|
||||
}
|
||||
#else
|
||||
if (recreate_app)
|
||||
recreate_GUI(_L("Changing of the settings layout") + dots);
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
break;
|
||||
}
|
||||
case ConfigMenuLanguage:
|
||||
|
@ -94,7 +94,7 @@ ObjectList::ObjectList(wxWindow* parent) :
|
||||
// ptFFF
|
||||
CATEGORY_ICON[L("Layers and Perimeters")] = create_scaled_bitmap("layers");
|
||||
CATEGORY_ICON[L("Infill")] = create_scaled_bitmap("infill");
|
||||
CATEGORY_ICON[L("Ironing")] = create_scaled_bitmap("infill"); // FIXME when the ironing icon is available
|
||||
CATEGORY_ICON[L("Ironing")] = create_scaled_bitmap("ironing");
|
||||
CATEGORY_ICON[L("Support material")] = create_scaled_bitmap("support");
|
||||
CATEGORY_ICON[L("Speed")] = create_scaled_bitmap("time");
|
||||
CATEGORY_ICON[L("Extruders")] = create_scaled_bitmap("funnel");
|
||||
@ -645,7 +645,7 @@ void ObjectList::msw_rescale_icons()
|
||||
// ptFFF
|
||||
CATEGORY_ICON[L("Layers and Perimeters")] = create_scaled_bitmap("layers");
|
||||
CATEGORY_ICON[L("Infill")] = create_scaled_bitmap("infill");
|
||||
CATEGORY_ICON[L("Ironing")] = create_scaled_bitmap("infill"); // FIXME when the ironing icon is available
|
||||
CATEGORY_ICON[L("Ironing")] = create_scaled_bitmap("ironing");
|
||||
CATEGORY_ICON[L("Support material")] = create_scaled_bitmap("support");
|
||||
CATEGORY_ICON[L("Speed")] = create_scaled_bitmap("time");
|
||||
CATEGORY_ICON[L("Extruders")] = create_scaled_bitmap("funnel");
|
||||
|
@ -110,13 +110,8 @@ public:
|
||||
if (!m_can_rescale)
|
||||
return;
|
||||
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
if (m_force_rescale || is_new_scale_factor())
|
||||
rescale(wxRect());
|
||||
#else
|
||||
if (is_new_scale_factor())
|
||||
rescale(wxRect());
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
});
|
||||
#else
|
||||
this->Bind(EVT_DPI_CHANGED_SLICER, [this](const DpiChangedEvent& evt) {
|
||||
@ -127,13 +122,8 @@ public:
|
||||
if (!m_can_rescale)
|
||||
return;
|
||||
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
if (m_force_rescale || is_new_scale_factor())
|
||||
rescale(evt.rect);
|
||||
#else
|
||||
if (is_new_scale_factor())
|
||||
rescale(evt.rect);
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
});
|
||||
#endif // wxVERSION_EQUAL_OR_GREATER_THAN
|
||||
|
||||
@ -175,9 +165,7 @@ public:
|
||||
int em_unit() const { return m_em_unit; }
|
||||
// int font_size() const { return m_font_size; }
|
||||
const wxFont& normal_font() const { return m_normal_font; }
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
void enable_force_rescale() { m_force_rescale = true; }
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
protected:
|
||||
virtual void on_dpi_changed(const wxRect &suggested_rect) = 0;
|
||||
@ -191,9 +179,7 @@ private:
|
||||
wxFont m_normal_font;
|
||||
float m_prev_scale_factor;
|
||||
bool m_can_rescale{ true };
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
bool m_force_rescale{ false };
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
int m_new_font_point_size;
|
||||
|
||||
@ -233,17 +219,17 @@ private:
|
||||
{
|
||||
this->Freeze();
|
||||
|
||||
#if ENABLE_LAYOUT_NO_RESTART && wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
|
||||
#if wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
|
||||
if (m_force_rescale) {
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
#endif // wxVERSION_EQUAL_OR_GREATER_THAN
|
||||
// rescale fonts of all controls
|
||||
scale_controls_fonts(this, m_new_font_point_size);
|
||||
// rescale current window font
|
||||
scale_win_font(this, m_new_font_point_size);
|
||||
#if ENABLE_LAYOUT_NO_RESTART && wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
|
||||
#if wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
|
||||
m_force_rescale = false;
|
||||
}
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
#endif // wxVERSION_EQUAL_OR_GREATER_THAN
|
||||
|
||||
// set normal application font as a current window font
|
||||
m_normal_font = this->GetFont();
|
||||
|
@ -42,7 +42,6 @@
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
enum class ERescaleTarget
|
||||
{
|
||||
Mainframe,
|
||||
@ -71,15 +70,12 @@ static void rescale_dialog_after_dpi_change(MainFrame& mainframe, SettingsDialog
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
MainFrame::MainFrame() :
|
||||
DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, "mainframe"),
|
||||
m_printhost_queue_dlg(new PrintHostQueueDialog(this))
|
||||
, m_recent_projects(9)
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
, m_settings_dialog(this)
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
{
|
||||
// Fonts were created by the DPIFrame constructor for the monitor, on which the window opened.
|
||||
wxGetApp().update_fonts(this);
|
||||
@ -142,43 +138,15 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
|
||||
|
||||
m_loaded = true;
|
||||
|
||||
#if !ENABLE_LAYOUT_NO_RESTART
|
||||
#ifdef __APPLE__
|
||||
// Using SetMinSize() on Mac messes up the window position in some cases
|
||||
// cf. https://groups.google.com/forum/#!topic/wx-users/yUKPBBfXWO0
|
||||
// So, if we haven't possibility to set MinSize() for the MainFrame,
|
||||
// set the MinSize() as a half of regular for the m_plater and m_tabpanel, when settings layout is in slNew mode
|
||||
// Otherwise, MainFrame will be maximized by height
|
||||
if (slNew) {
|
||||
wxSize size = wxGetApp().get_min_size();
|
||||
size.SetHeight(int(0.5*size.GetHeight()));
|
||||
m_plater->SetMinSize(size);
|
||||
m_tabpanel->SetMinSize(size);
|
||||
}
|
||||
#endif
|
||||
#endif // !ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
// initialize layout
|
||||
m_main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
||||
sizer->Add(m_main_sizer, 1, wxEXPAND);
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
SetSizer(sizer);
|
||||
// initialize layout from config
|
||||
update_layout();
|
||||
sizer->SetSizeHints(this);
|
||||
Fit();
|
||||
#else
|
||||
if (m_plater && m_layout != slOld)
|
||||
sizer->Add(m_plater, 1, wxEXPAND);
|
||||
|
||||
if (m_tabpanel && m_layout != slDlg)
|
||||
sizer->Add(m_tabpanel, 1, wxEXPAND);
|
||||
|
||||
sizer->SetSizeHints(this);
|
||||
SetSizer(sizer);
|
||||
Fit();
|
||||
#endif // !ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
const wxSize min_size = wxGetApp().get_min_size(); //wxSize(76*wxGetApp().em_unit(), 49*wxGetApp().em_unit());
|
||||
#ifdef __APPLE__
|
||||
@ -270,12 +238,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
|
||||
});
|
||||
|
||||
wxGetApp().persist_window_geometry(this, true);
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
wxGetApp().persist_window_geometry(&m_settings_dialog, true);
|
||||
#else
|
||||
if (m_settings_dialog != nullptr)
|
||||
wxGetApp().persist_window_geometry(m_settings_dialog, true);
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
update_ui_from_settings(); // FIXME (?)
|
||||
|
||||
@ -287,7 +250,6 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
void MainFrame::update_layout()
|
||||
{
|
||||
auto restore_to_creation = [this]() {
|
||||
@ -421,7 +383,6 @@ void MainFrame::update_layout()
|
||||
Layout();
|
||||
Thaw();
|
||||
}
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
// Called when closing the application and when switching the application language.
|
||||
void MainFrame::shutdown()
|
||||
@ -470,20 +431,9 @@ void MainFrame::shutdown()
|
||||
// In addition, there were some crashes due to the Paint events sent to already destructed windows.
|
||||
this->Show(false);
|
||||
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
if (m_settings_dialog.IsShown())
|
||||
// call Close() to trigger call to lambda defined into GUI_App::persist_window_geometry()
|
||||
m_settings_dialog.Close();
|
||||
#else
|
||||
if (m_settings_dialog != nullptr)
|
||||
{
|
||||
if (m_settings_dialog->IsShown())
|
||||
// call Close() to trigger call to lambda defined into GUI_App::persist_window_geometry()
|
||||
m_settings_dialog->Close();
|
||||
|
||||
m_settings_dialog->Destroy();
|
||||
}
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
if (m_plater != nullptr) {
|
||||
#if ENABLE_GCODE_VIEWER_AS_STATE
|
||||
@ -549,7 +499,6 @@ void MainFrame::update_title()
|
||||
|
||||
void MainFrame::init_tabpanel()
|
||||
{
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
// wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on Windows 10
|
||||
// with multiple high resolution displays connected.
|
||||
m_tabpanel = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
||||
@ -558,27 +507,6 @@ void MainFrame::init_tabpanel()
|
||||
#endif
|
||||
m_tabpanel->Hide();
|
||||
m_settings_dialog.set_tabpanel(m_tabpanel);
|
||||
#else
|
||||
m_layout = wxGetApp().app_config->get("old_settings_layout_mode") == "1" ? slOld :
|
||||
wxGetApp().app_config->get("new_settings_layout_mode") == "1" ? slNew :
|
||||
wxGetApp().app_config->get("dlg_settings_layout_mode") == "1" ? slDlg : slOld;
|
||||
|
||||
// From the very beginning the Print settings should be selected
|
||||
m_last_selected_tab = m_layout == slDlg ? 0 : 1;
|
||||
|
||||
if (m_layout == slDlg) {
|
||||
m_settings_dialog = new SettingsDialog(this);
|
||||
m_tabpanel = m_settings_dialog->get_tabpanel();
|
||||
}
|
||||
else {
|
||||
// wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on Windows 10
|
||||
// with multiple high resolution displays connected.
|
||||
m_tabpanel = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
||||
#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
|
||||
m_tabpanel->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
#endif
|
||||
}
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
m_tabpanel->Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, [this](wxEvent&) {
|
||||
wxWindow* panel = m_tabpanel->GetCurrentPage();
|
||||
@ -599,20 +527,9 @@ void MainFrame::init_tabpanel()
|
||||
select_tab(0); // select Plater
|
||||
});
|
||||
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
m_plater = new Plater(this, this);
|
||||
m_plater->Hide();
|
||||
#else
|
||||
if (m_layout == slOld) {
|
||||
m_plater = new Plater(m_tabpanel, this);
|
||||
m_tabpanel->AddPage(m_plater, _L("Plater"));
|
||||
}
|
||||
else {
|
||||
m_plater = new Plater(this, this);
|
||||
if (m_layout == slNew)
|
||||
m_tabpanel->AddPage(new wxPanel(m_tabpanel), _L("Plater")); // empty panel just for Plater tab
|
||||
}
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
wxGetApp().plater_ = m_plater;
|
||||
|
||||
wxGetApp().obj_list()->create_popup_menus();
|
||||
@ -754,7 +671,6 @@ bool MainFrame::can_slice() const
|
||||
|
||||
bool MainFrame::can_change_view() const
|
||||
{
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
switch (m_layout)
|
||||
{
|
||||
default: { return false; }
|
||||
@ -765,15 +681,6 @@ bool MainFrame::can_change_view() const
|
||||
return page_id != wxNOT_FOUND && dynamic_cast<const Slic3r::GUI::Plater*>(m_tabpanel->GetPage((size_t)page_id)) != nullptr;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (m_layout == slNew)
|
||||
return m_plater->IsShown();
|
||||
if (m_layout == slDlg)
|
||||
return true;
|
||||
// slOld layout mode
|
||||
int page_id = m_tabpanel->GetSelection();
|
||||
return page_id != wxNOT_FOUND && dynamic_cast<const Slic3r::GUI::Plater*>(m_tabpanel->GetPage((size_t)page_id)) != nullptr;
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
}
|
||||
|
||||
bool MainFrame::can_select() const
|
||||
@ -819,11 +726,7 @@ void MainFrame::on_dpi_changed(const wxRect& suggested_rect)
|
||||
wxGetApp().plater()->msw_rescale();
|
||||
|
||||
// update Tabs
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
if (m_layout != ESettingsLayout::Dlg) // Do not update tabs if the Settings are in the separated dialog
|
||||
#else
|
||||
if (m_layout != slDlg) // Update tabs later, from the SettingsDialog, when the Settings are in the separated dialog
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
for (auto tab : wxGetApp().tabs_list)
|
||||
tab->msw_rescale();
|
||||
|
||||
@ -852,10 +755,8 @@ void MainFrame::on_dpi_changed(const wxRect& suggested_rect)
|
||||
|
||||
this->Maximize(is_maximized);
|
||||
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
if (m_layout == ESettingsLayout::Dlg)
|
||||
rescale_dialog_after_dpi_change(*this, m_settings_dialog, ERescaleTarget::SettingsDialog);
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
}
|
||||
|
||||
void MainFrame::on_sys_color_changed()
|
||||
@ -1427,10 +1328,8 @@ void MainFrame::set_mode(EMode 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->reset_gcode_toolpaths();
|
||||
@ -1471,9 +1370,7 @@ 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();
|
||||
@ -1850,25 +1747,15 @@ void MainFrame::load_config(const DynamicPrintConfig& config)
|
||||
void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
|
||||
{
|
||||
bool tabpanel_was_hidden = false;
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
if (m_layout == ESettingsLayout::Dlg) {
|
||||
#else
|
||||
if (m_layout == slDlg) {
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
if (tab==0) {
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
if (m_settings_dialog.IsShown())
|
||||
this->SetFocus();
|
||||
#else
|
||||
if (m_settings_dialog->IsShown())
|
||||
this->SetFocus();
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
// plater should be focused for correct navigation inside search window
|
||||
if (m_plater->canvas3D()->is_search_pressed())
|
||||
m_plater->SetFocus();
|
||||
return;
|
||||
}
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
// Show/Activate Settings Dialog
|
||||
#ifdef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
|
||||
if (m_settings_dialog.IsShown())
|
||||
@ -1885,28 +1772,11 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
|
||||
m_settings_dialog.Show();
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
// Show/Activate Settings Dialog
|
||||
if (m_settings_dialog->IsShown())
|
||||
#ifdef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
|
||||
m_settings_dialog->Hide();
|
||||
#else
|
||||
m_settings_dialog->SetFocus();
|
||||
else
|
||||
#endif
|
||||
m_settings_dialog->Show();
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
}
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
else if (m_layout == ESettingsLayout::New) {
|
||||
m_main_sizer->Show(m_plater, tab == 0);
|
||||
tabpanel_was_hidden = !m_main_sizer->IsShown(m_tabpanel);
|
||||
m_main_sizer->Show(m_tabpanel, tab != 0);
|
||||
#else
|
||||
else if (m_layout == slNew) {
|
||||
m_plater->Show(tab == 0);
|
||||
m_tabpanel->Show(tab != 0);
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
// plater should be focused for correct navigation inside search window
|
||||
if (tab == 0 && m_plater->canvas3D()->is_search_pressed())
|
||||
@ -1923,11 +1793,7 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
|
||||
tab->update_changed_tree_ui();
|
||||
|
||||
// when tab == -1, it means we should show the last selected tab
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
m_tabpanel->SetSelection(tab == (size_t)(-1) ? m_last_selected_tab : (m_layout == ESettingsLayout::Dlg && tab != 0) ? tab - 1 : tab);
|
||||
#else
|
||||
m_tabpanel->SetSelection(tab == (size_t)(-1) ? m_last_selected_tab : (m_layout == slDlg && tab != 0) ? tab-1 : tab);
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
}
|
||||
|
||||
// Set a camera direction, zoom to all objects.
|
||||
@ -2056,34 +1922,6 @@ SettingsDialog::SettingsDialog(MainFrame* mainframe)
|
||||
SetIcon(wxIcon(var("PrusaSlicer_128px.png"), wxBITMAP_TYPE_PNG));
|
||||
#endif // _WIN32
|
||||
|
||||
#if !ENABLE_LAYOUT_NO_RESTART
|
||||
// wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on Windows 10
|
||||
// with multiple high resolution displays connected.
|
||||
m_tabpanel = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxGetApp().get_min_size(), wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
||||
#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
|
||||
m_tabpanel->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
#endif
|
||||
|
||||
m_tabpanel->Bind(wxEVT_KEY_UP, [this](wxKeyEvent& evt) {
|
||||
if ((evt.GetModifiers() & wxMOD_CONTROL) != 0) {
|
||||
switch (evt.GetKeyCode()) {
|
||||
case '1': { m_main_frame->select_tab(0); break; }
|
||||
case '2': { m_main_frame->select_tab(1); break; }
|
||||
case '3': { m_main_frame->select_tab(2); break; }
|
||||
case '4': { m_main_frame->select_tab(3); break; }
|
||||
#ifdef __APPLE__
|
||||
case 'f':
|
||||
#else /* __APPLE__ */
|
||||
case WXK_CONTROL_F:
|
||||
#endif /* __APPLE__ */
|
||||
case 'F': { m_main_frame->plater()->search(false); break; }
|
||||
default:break;
|
||||
}
|
||||
}
|
||||
});
|
||||
#endif // !ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
this->Bind(wxEVT_SHOW, [this](wxShowEvent& evt) {
|
||||
|
||||
auto key_up_handker = [this](wxKeyEvent& evt) {
|
||||
@ -2113,13 +1951,9 @@ SettingsDialog::SettingsDialog(MainFrame* mainframe)
|
||||
m_tabpanel->Unbind(wxEVT_KEY_UP, key_up_handker);
|
||||
}
|
||||
});
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
// initialize layout
|
||||
auto sizer = new wxBoxSizer(wxVERTICAL);
|
||||
#if !ENABLE_LAYOUT_NO_RESTART
|
||||
sizer->Add(m_tabpanel, 1, wxEXPAND);
|
||||
#endif // !ENABLE_LAYOUT_NO_RESTART
|
||||
sizer->SetSizeHints(this);
|
||||
SetSizer(sizer);
|
||||
Fit();
|
||||
|
@ -55,11 +55,7 @@ class SettingsDialog : public DPIDialog
|
||||
public:
|
||||
SettingsDialog(MainFrame* mainframe);
|
||||
~SettingsDialog() {}
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
void set_tabpanel(wxNotebook* tabpanel) { m_tabpanel = tabpanel; }
|
||||
#else
|
||||
wxNotebook* get_tabpanel() { return m_tabpanel; }
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
protected:
|
||||
void on_dpi_changed(const wxRect& suggested_rect) override;
|
||||
@ -132,7 +128,6 @@ class MainFrame : public DPIFrame
|
||||
|
||||
wxFileHistory m_recent_projects;
|
||||
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
enum class ESettingsLayout
|
||||
{
|
||||
Unknown,
|
||||
@ -145,13 +140,6 @@ class MainFrame : public DPIFrame
|
||||
};
|
||||
|
||||
ESettingsLayout m_layout{ ESettingsLayout::Unknown };
|
||||
#else
|
||||
enum SettingsLayout {
|
||||
slOld = 0,
|
||||
slNew,
|
||||
slDlg,
|
||||
} m_layout;
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
#if ENABLE_GCODE_VIEWER_AS_STATE
|
||||
public:
|
||||
@ -173,9 +161,7 @@ public:
|
||||
MainFrame();
|
||||
~MainFrame() = default;
|
||||
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
void update_layout();
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
// Called when closing the application and when switching the application language.
|
||||
void shutdown();
|
||||
@ -227,12 +213,8 @@ public:
|
||||
|
||||
Plater* m_plater { nullptr };
|
||||
wxNotebook* m_tabpanel { nullptr };
|
||||
#if ENABLE_LAYOUT_NO_RESTART
|
||||
SettingsDialog m_settings_dialog;
|
||||
wxWindow* m_plater_page{ nullptr };
|
||||
#else
|
||||
SettingsDialog* m_settings_dialog { nullptr };
|
||||
#endif // ENABLE_LAYOUT_NO_RESTART
|
||||
wxProgressDialog* m_progress_dialog { nullptr };
|
||||
std::shared_ptr<ProgressStatusBar> m_statusbar;
|
||||
|
||||
|
@ -234,30 +234,6 @@ void PreferencesDialog::accept()
|
||||
}
|
||||
}
|
||||
|
||||
#if !ENABLE_LAYOUT_NO_RESTART
|
||||
if (m_settings_layout_changed) {
|
||||
// the dialog needs to be destroyed before the call to recreate_gui()
|
||||
// or sometimes the application crashes into wxDialogBase() destructor
|
||||
// so we put it into an inner scope
|
||||
wxMessageDialog dialog(nullptr,
|
||||
_L("Switching the settings layout mode will trigger application restart.\n"
|
||||
"You will lose content of the plater.") + "\n\n" +
|
||||
_L("Do you want to proceed?"),
|
||||
wxString(SLIC3R_APP_NAME) + " - " + _L("Switching the settings layout mode"),
|
||||
wxICON_QUESTION | wxOK | wxCANCEL);
|
||||
|
||||
if (dialog.ShowModal() == wxID_CANCEL)
|
||||
{
|
||||
int selection = app_config->get("old_settings_layout_mode") == "1" ? 0 :
|
||||
app_config->get("new_settings_layout_mode") == "1" ? 1 :
|
||||
app_config->get("dlg_settings_layout_mode") == "1" ? 2 : 0;
|
||||
|
||||
m_layout_mode_box->SetSelection(selection);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // !ENABLE_LAYOUT_NO_RESTART
|
||||
|
||||
for (std::map<std::string, std::string>::iterator it = m_values.begin(); it != m_values.end(); ++it)
|
||||
app_config->set(it->first, it->second);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user