New layout:
1. PreferencesDialog: When "Cancel" is selected, don't close the PreferencesDialog, just revert layout mode selection 2. For the tooltip of "Switch to Settings" added information about shortcuts 3. Shortcuts for the switching between tabs work from Settings Dialog now 4. Fixed the collapse button show after preference's change
This commit is contained in:
parent
43be7a51aa
commit
181203c2c7
@ -4422,6 +4422,16 @@ void GLCanvas3D::msw_rescale()
|
||||
m_warning_texture.msw_rescale(*this);
|
||||
}
|
||||
|
||||
void GLCanvas3D::update_tooltip_for_settings_item_in_main_toolbar()
|
||||
{
|
||||
std::string new_tooltip = _u8L("Switch to Settings") +
|
||||
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") +
|
||||
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "3] - " + (m_process->current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) +
|
||||
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ;
|
||||
|
||||
m_main_toolbar.set_tooltip(get_main_toolbar_item_id("settings"), new_tooltip);
|
||||
}
|
||||
|
||||
bool GLCanvas3D::has_toolpaths_to_export() const
|
||||
{
|
||||
return m_volumes.has_toolpaths_to_export();
|
||||
@ -5067,7 +5077,9 @@ bool GLCanvas3D::_init_main_toolbar()
|
||||
|
||||
item.name = "settings";
|
||||
item.icon_filename = "cog.svg";
|
||||
item.tooltip = _utf8(L("Switch to Settings"));
|
||||
item.tooltip = _u8L("Switch to Settings") + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") +
|
||||
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "3] - " + (m_process->current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) +
|
||||
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ;
|
||||
item.sprite_id = 10;
|
||||
item.enabling_callback = GLToolbarItem::Default_Enabling_Callback;
|
||||
item.visibility_callback = [this]() { return wxGetApp().app_config->get("old_settings_layout_mode") != "1"; };
|
||||
@ -5239,7 +5251,7 @@ bool GLCanvas3D::_init_view_toolbar()
|
||||
|
||||
bool GLCanvas3D::_init_collapse_toolbar()
|
||||
{
|
||||
if (!m_collapse_toolbar.is_enabled())
|
||||
if (!m_collapse_toolbar.is_enabled() && m_collapse_toolbar.get_items_count() > 0)
|
||||
return true;
|
||||
|
||||
BackgroundTexture::Metadata background_data;
|
||||
|
@ -724,6 +724,7 @@ public:
|
||||
int get_main_toolbar_item_id(const std::string& name) const { return m_main_toolbar.get_item_id(name); }
|
||||
void force_main_toolbar_left_action(int item_id) { m_main_toolbar.force_left_action(item_id, *this); }
|
||||
void force_main_toolbar_right_action(int item_id) { m_main_toolbar.force_right_action(item_id, *this); }
|
||||
void update_tooltip_for_settings_item_in_main_toolbar();
|
||||
|
||||
bool has_toolpaths_to_export() const;
|
||||
void export_toolpaths_to_obj(const char* filename) const;
|
||||
|
@ -302,7 +302,7 @@ void MainFrame::init_tabpanel()
|
||||
m_last_selected_tab = m_layout == slDlg ? 0 : 1;
|
||||
|
||||
if (m_layout == slDlg) {
|
||||
m_settings_dialog = new SettingsDialog();
|
||||
m_settings_dialog = new SettingsDialog(this);
|
||||
m_tabpanel = m_settings_dialog->get_tabpanel();
|
||||
}
|
||||
else {
|
||||
@ -1260,8 +1260,11 @@ void MainFrame::load_config(const DynamicPrintConfig& config)
|
||||
void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
|
||||
{
|
||||
if (m_layout == slDlg) {
|
||||
if (tab==0)
|
||||
if (tab==0) {
|
||||
if (m_settings_dialog->IsShown())
|
||||
this->SetFocus();
|
||||
return;
|
||||
}
|
||||
// Show/Activate Settings Dialog
|
||||
if (m_settings_dialog->IsShown())
|
||||
m_settings_dialog->SetFocus();
|
||||
@ -1385,8 +1388,9 @@ std::string MainFrame::get_dir_name(const wxString &full_name) const
|
||||
// SettingsDialog
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
SettingsDialog::SettingsDialog()
|
||||
: DPIDialog(nullptr, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _L("Settings"))
|
||||
SettingsDialog::SettingsDialog(MainFrame* mainframe)
|
||||
: DPIDialog(nullptr, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _L("Settings")),
|
||||
m_main_frame(mainframe)
|
||||
{
|
||||
this->SetFont(wxGetApp().normal_font());
|
||||
|
||||
@ -1411,6 +1415,18 @@ SettingsDialog::SettingsDialog()
|
||||
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; }
|
||||
default:break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// initialize layout
|
||||
auto sizer = new wxBoxSizer(wxVERTICAL);
|
||||
sizer->Add(m_tabpanel, 1, wxEXPAND);
|
||||
|
@ -50,8 +50,9 @@ struct PresetTab {
|
||||
class SettingsDialog : public DPIDialog
|
||||
{
|
||||
wxNotebook* m_tabpanel { nullptr };
|
||||
MainFrame* m_main_frame {nullptr };
|
||||
public:
|
||||
SettingsDialog();
|
||||
SettingsDialog(MainFrame* mainframe);
|
||||
~SettingsDialog() {}
|
||||
wxNotebook* get_tabpanel() { return m_tabpanel; }
|
||||
|
||||
|
@ -1640,6 +1640,7 @@ struct Plater::priv
|
||||
|
||||
void reset_all_gizmos();
|
||||
void update_ui_from_settings();
|
||||
void update_main_toolbar_tooltips();
|
||||
std::shared_ptr<ProgressStatusBar> statusbar();
|
||||
std::string get_config(const std::string &key) const;
|
||||
BoundingBoxf bed_shape_bb() const;
|
||||
@ -2041,7 +2042,11 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
|
||||
|
||||
// collapse sidebar according to saved value
|
||||
sidebar->collapse(wxGetApp().app_config->get("collapsed_sidebar") == "1");
|
||||
bool is_collapsed = wxGetApp().app_config->get("collapsed_sidebar") == "1";
|
||||
sidebar->collapse(is_collapsed);
|
||||
// Update an enable of the collapse_toolbar: if sidebar is collapsed, then collapse_toolbar should be visible
|
||||
if (is_collapsed)
|
||||
wxGetApp().app_config->set("show_collapse_button", "1");
|
||||
}
|
||||
|
||||
Plater::priv::~priv()
|
||||
@ -2116,6 +2121,13 @@ void Plater::priv::update_ui_from_settings()
|
||||
preview->get_canvas3d()->update_ui_from_settings();
|
||||
}
|
||||
|
||||
// Called after the print technology was changed.
|
||||
// Update the tooltips for "Switch to Settings" button in maintoolbar
|
||||
void Plater::priv::update_main_toolbar_tooltips()
|
||||
{
|
||||
view3D->get_canvas3d()->update_tooltip_for_settings_item_in_main_toolbar();
|
||||
}
|
||||
|
||||
std::shared_ptr<ProgressStatusBar> Plater::priv::statusbar()
|
||||
{
|
||||
return main_frame->m_statusbar;
|
||||
@ -5278,6 +5290,8 @@ void Plater::set_printer_technology(PrinterTechnology printer_technology)
|
||||
|
||||
if (wxGetApp().mainframe)
|
||||
wxGetApp().mainframe->update_menubar();
|
||||
|
||||
p->update_main_toolbar_tooltips();
|
||||
}
|
||||
|
||||
void Plater::changed_object(int obj_idx)
|
||||
|
@ -188,11 +188,12 @@ void PreferencesDialog::accept()
|
||||
warning_catcher(this, wxString::Format(_(L("You need to restart %s to make the changes effective.")), SLIC3R_APP_NAME));
|
||||
}
|
||||
|
||||
auto app_config = get_app_config();
|
||||
|
||||
bool settings_layout_changed = m_values.find("old_settings_layout_mode") != m_values.end() ||
|
||||
m_values.find("new_settings_layout_mode") != m_values.end() ||
|
||||
m_values.find("dlg_settings_layout_mode") != m_values.end();
|
||||
|
||||
bool canceled = false;
|
||||
if (settings_layout_changed) {
|
||||
// the dialog needs to be destroyed before the call to recreate_gui()
|
||||
// or sometimes the application crashes into wxDialogBase() destructor
|
||||
@ -205,24 +206,23 @@ void PreferencesDialog::accept()
|
||||
wxICON_QUESTION | wxOK | wxCANCEL);
|
||||
|
||||
if (dialog.ShowModal() == wxID_CANCEL)
|
||||
canceled = true;
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
auto app_config = get_app_config();
|
||||
for (std::map<std::string, std::string>::iterator it = m_values.begin(); it != m_values.end(); ++it)
|
||||
{
|
||||
if (canceled && (it->first == "old_settings_layout_mode" ||
|
||||
it->first == "new_settings_layout_mode" ||
|
||||
it->first == "dlg_settings_layout_mode" ))
|
||||
continue;
|
||||
app_config->set(it->first, it->second);
|
||||
}
|
||||
|
||||
app_config->save();
|
||||
|
||||
EndModal(wxID_OK);
|
||||
|
||||
if (settings_layout_changed && !canceled)
|
||||
if (settings_layout_changed)
|
||||
// recreate application, if settings layout was changed
|
||||
wxGetApp().recreate_GUI();
|
||||
else
|
||||
@ -323,12 +323,12 @@ void PreferencesDialog::create_settings_mode_widget()
|
||||
|
||||
wxWindow* parent = m_optgroup_gui->ctrl_parent();
|
||||
|
||||
wxRadioBox* box = new wxRadioBox(parent, wxID_ANY, _L("Settings layout mode"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(choices), choices,
|
||||
m_layout_mode_box = new wxRadioBox(parent, wxID_ANY, _L("Settings layout mode"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(choices), choices,
|
||||
3, wxRA_SPECIFY_ROWS);
|
||||
box->SetFont(wxGetApp().normal_font());
|
||||
box->SetSelection(selection);
|
||||
m_layout_mode_box->SetFont(wxGetApp().normal_font());
|
||||
m_layout_mode_box->SetSelection(selection);
|
||||
|
||||
box->Bind(wxEVT_RADIOBOX, [this](wxCommandEvent& e) {
|
||||
m_layout_mode_box->Bind(wxEVT_RADIOBOX, [this](wxCommandEvent& e) {
|
||||
int selection = e.GetSelection();
|
||||
|
||||
m_values["old_settings_layout_mode"] = boost::any_cast<bool>(selection == 0) ? "1" : "0";
|
||||
@ -337,7 +337,7 @@ void PreferencesDialog::create_settings_mode_widget()
|
||||
});
|
||||
|
||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(box, 1, wxALIGN_CENTER_VERTICAL);
|
||||
sizer->Add(m_layout_mode_box, 1, wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
m_optgroup_gui->sizer->Add(sizer, 0, wxEXPAND);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ class PreferencesDialog : public DPIDialog
|
||||
std::shared_ptr<ConfigOptionsGroup> m_optgroup_camera;
|
||||
std::shared_ptr<ConfigOptionsGroup> m_optgroup_gui;
|
||||
wxSizer* m_icon_size_sizer;
|
||||
wxRadioBox* m_layout_mode_box;
|
||||
bool isOSX {false};
|
||||
public:
|
||||
PreferencesDialog(wxWindow* parent);
|
||||
|
Loading…
Reference in New Issue
Block a user