Add main preference to keep the gui in expert mode.

So the simple/advanced mode change only setting choices.
This commit is contained in:
supermerill 2020-06-11 20:15:39 +02:00
parent bbbb4d9396
commit 6e616a7610
6 changed files with 40 additions and 29 deletions

View File

@ -91,6 +91,9 @@ void AppConfig::set_defaults()
if (get("use_perspective_camera").empty())
set("use_perspective_camera", "1");
if (get("objects_always_expert").empty())
set("objects_always_expert", "1");
if (get("use_free_camera").empty())
set("use_free_camera", "0");

View File

@ -4692,7 +4692,7 @@ bool GLCanvas3D::_init_main_toolbar()
item.tooltip = _utf8(L("Add instance")) + " [+]";
item.sprite_id = 6;
item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLTOOLBAR_MORE)); };
item.visibility_callback = []()->bool { return wxGetApp().get_mode() != comSimple; };
item.visibility_callback = []()->bool { return wxGetApp().get_mode() != comSimple || wxGetApp().app_config->get("objects_always_expert") == "1"; };
item.enabling_callback = []()->bool { return wxGetApp().plater()->can_increase_instances(); };
if (!m_main_toolbar.add_item(item))
@ -4703,7 +4703,7 @@ bool GLCanvas3D::_init_main_toolbar()
item.tooltip = _utf8(L("Remove instance")) + " [-]";
item.sprite_id = 7;
item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLTOOLBAR_FEWER)); };
item.visibility_callback = []()->bool { return wxGetApp().get_mode() != comSimple; };
item.visibility_callback = []()->bool { return wxGetApp().get_mode() != comSimple || wxGetApp().app_config->get("objects_always_expert") == "1"; };
item.enabling_callback = []()->bool { return wxGetApp().plater()->can_decrease_instances(); };
if (!m_main_toolbar.add_item(item))
return false;
@ -4716,7 +4716,7 @@ bool GLCanvas3D::_init_main_toolbar()
item.tooltip = _utf8(L("Split to objects"));
item.sprite_id = 8;
item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLTOOLBAR_SPLIT_OBJECTS)); };
item.visibility_callback = GLToolbarItem::Default_Visibility_Callback;
item.visibility_callback = []()->bool { return wxGetApp().get_mode() != comSimple; };
item.enabling_callback = []()->bool { return wxGetApp().plater()->can_split_to_objects(); };
if (!m_main_toolbar.add_item(item))
return false;

View File

@ -1436,7 +1436,7 @@ void ObjectList::show_settings(const wxDataViewItem settings_item)
wxMenu* ObjectList::append_submenu_add_generic(wxMenu* menu, const ModelVolumeType type) {
auto sub_menu = new wxMenu;
if (wxGetApp().get_mode() == comExpert && type != ModelVolumeType::INVALID) {
if ( (wxGetApp().get_mode() == comExpert || wxGetApp().app_config->get("objects_always_expert") == "1") && type != ModelVolumeType::INVALID) {
append_menu_item(sub_menu, wxID_ANY, _(L("Load")) + " " + dots, "",
[this, type](wxCommandEvent&) { load_subobject(type); }, "", menu);
sub_menu->AppendSeparator();
@ -1466,13 +1466,13 @@ void ObjectList::append_menu_items_add_volume(wxMenu* menu)
wxWindow* parent = wxGetApp().plater();
if (mode == comAdvanced) {
if (mode == comAdvanced && wxGetApp().app_config->get("objects_always_expert") != "1") {
append_menu_item(menu, wxID_ANY, _(ADD_VOLUME_MENU_ITEMS[int(ModelVolumeType::MODEL_PART)].first), "",
[this](wxCommandEvent&) { load_subobject(ModelVolumeType::MODEL_PART); },
ADD_VOLUME_MENU_ITEMS[int(ModelVolumeType::MODEL_PART)].second, nullptr,
[this]() { return is_instance_or_object_selected(); }, parent);
}
if (mode == comSimple) {
if (mode == comSimple && wxGetApp().app_config->get("objects_always_expert") != "1") {
append_menu_item(menu, wxID_ANY, _(ADD_VOLUME_MENU_ITEMS[int(ModelVolumeType::SUPPORT_ENFORCER)].first), "",
[this](wxCommandEvent&) { load_generic_subobject(L("Box"), ModelVolumeType::SUPPORT_ENFORCER); },
ADD_VOLUME_MENU_ITEMS[int(ModelVolumeType::SUPPORT_ENFORCER)].second, nullptr,
@ -1485,7 +1485,7 @@ void ObjectList::append_menu_items_add_volume(wxMenu* menu)
return;
}
for (size_t type = (mode == comExpert ? 0 : 1) ; type < ADD_VOLUME_MENU_ITEMS.size(); type++)
for (size_t type = (mode == comExpert || wxGetApp().app_config->get("objects_always_expert") == "1" ? 0 : 1) ; type < ADD_VOLUME_MENU_ITEMS.size(); type++)
{
auto& item = ADD_VOLUME_MENU_ITEMS[type];
@ -1565,7 +1565,7 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
return nullptr;
const ConfigOptionMode mode = wxGetApp().get_mode();
if (mode == comSimple)
if (mode == comSimple && wxGetApp().app_config->get("objects_always_expert") != "1")
return nullptr;
// Create new items for settings popupmenu
@ -1583,7 +1583,7 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
(item_type == itUndef && selection.is_single_full_object());
create_freq_settings_popupmenu(menu, is_object_settings);
if (mode == comAdvanced)
if (mode == comAdvanced && wxGetApp().app_config->get("objects_always_expert") != "1")
return nullptr;
menu->SetSecondSeparator();

View File

@ -420,7 +420,7 @@ void ObjectManipulation::Show(const bool show)
// Show all lines of the panel. Some of these lines will be hidden in the lines below.
m_og->Show(show);
if (show && wxGetApp().get_mode() != comSimple) {
if (show && wxGetApp().get_mode() != comSimple && wxGetApp().app_config->get("objects_always_expert") != "1") {
// Show the label and the name of the STL in simple mode only.
// Label "Name: "
m_main_grid_sizer->Show(size_t(0), false);
@ -431,7 +431,8 @@ void ObjectManipulation::Show(const bool show)
if (show) {
// Show the "World Coordinates" / "Local Coordintes" Combo in Advanced / Expert mode only.
bool show_world_local_combo = wxGetApp().plater()->canvas3D()->get_selection().is_single_full_instance() && wxGetApp().get_mode() != comSimple;
bool show_world_local_combo = wxGetApp().plater()->canvas3D()->get_selection().is_single_full_instance()
&& (wxGetApp().get_mode() != comSimple || wxGetApp().app_config->get("objects_always_expert") == "1");
m_word_local_combo->Show(show_world_local_combo);
m_empty_str->Show(!show_world_local_combo);
}
@ -458,7 +459,7 @@ void ObjectManipulation::update_settings_value(const Selection& selection)
m_new_rotate_label_string = L("Rotation");
m_new_scale_label_string = L("Scale factors");
if (wxGetApp().get_mode() == comSimple)
if (wxGetApp().get_mode() == comSimple && wxGetApp().app_config->get("objects_always_expert") != "1")
m_world_coordinates = true;
ObjectList* obj_list = wxGetApp().obj_list();

View File

@ -1044,7 +1044,7 @@ void Sidebar::update_mode_sizer() const
void Sidebar::update_reslice_btn_tooltip() const
{
wxString tooltip = wxString("Slice") + " [" + GUI::shortkey_ctrl_prefix() + "R]";
if (m_mode != comSimple)
if (m_mode != comSimple || wxGetApp().app_config->get("objects_always_expert") == "1")
tooltip += wxString("\n") + _(L("Hold Shift to Slice & Export G-code"));
p->btn_reslice->SetToolTip(tooltip);
}
@ -1133,7 +1133,7 @@ void Sidebar::update_objects_list_extruder_column(size_t extruders_count)
void Sidebar::show_info_sizer()
{
if (!p->plater->is_single_full_object_selection() ||
m_mode < comExpert ||
(m_mode < comExpert && wxGetApp().app_config->get("objects_always_expert") != "1") ||
p->plater->model().objects.empty()) {
p->object_info->Show(false);
return;
@ -1378,7 +1378,7 @@ void Sidebar::update_mode()
wxWindowUpdateLocker noUpdates(this);
p->object_list->get_sizer()->Show(m_mode > comSimple);
p->object_list->get_sizer()->Show(m_mode > comSimple || wxGetApp().app_config->get("objects_always_expert") == "1");
p->object_list->unselect_objects();
p->object_list->update_selections();
@ -2458,7 +2458,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
}
}
}
else if ((wxGetApp().get_mode() == comSimple) && (type_3mf || type_any_amf) && model_has_advanced_features(model)) {
else if ((wxGetApp().get_mode() == comSimple && wxGetApp().app_config->get("objects_always_expert") == "0") && (type_3mf || type_any_amf) && model_has_advanced_features(model)) {
wxMessageDialog msg_dlg(q, _(L("This file cannot be loaded in a simple mode. Do you want to switch to an advanced mode?"))+"\n",
_(L("Detected advanced data")), wxICON_WARNING | wxYES | wxNO);
if (msg_dlg.ShowModal() == wxID_YES)
@ -3220,7 +3220,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
sidebar->set_btn_label(ActionButtonType::abExport, _(label_btn_export));
sidebar->set_btn_label(ActionButtonType::abSendGCode, _(label_btn_send));
const wxString slice_string = background_process.running() && wxGetApp().get_mode() == comSimple ?
const wxString slice_string = background_process.running() && wxGetApp().get_mode() == comSimple && wxGetApp().app_config->get("objects_always_expert") != "1" ?
_(L("Slicing")) + dots : _(L("Slice now"));
sidebar->set_btn_label(ActionButtonType::abReslice, slice_string);
@ -3799,11 +3799,11 @@ void Plater::priv::on_process_completed(wxCommandEvent &evt)
if (canceled) {
if (wxGetApp().get_mode() == comSimple)
if (wxGetApp().get_mode() == comSimple && wxGetApp().app_config->get("objects_always_expert") != "1")
sidebar->set_btn_label(ActionButtonType::abReslice, "Slice now");
show_action_buttons(true);
}
else if (this->writing_to_removable_device || wxGetApp().get_mode() == comSimple)
else if (this->writing_to_removable_device || (wxGetApp().get_mode() == comSimple && wxGetApp().app_config->get("objects_always_expert") != "1"))
show_action_buttons(false);
this->writing_to_removable_device = false;
}
@ -3887,7 +3887,7 @@ void Plater::priv::on_right_click(RBtnEvent& evt)
* Suppress to show those items for a Simple mode
*/
const MenuIdentifier id = printer_technology == ptSLA ? miObjectSLA : miObjectFFF;
if (wxGetApp().get_mode() == comSimple) {
if (wxGetApp().get_mode() == comSimple && wxGetApp().app_config->get("objects_always_expert") != "1") {
if (menu->FindItem(_(L("Add instance"))) != wxNOT_FOUND)
{
/* Detach an items from the menu, but don't delete them
@ -4120,7 +4120,7 @@ bool Plater::priv::complit_init_object_menu()
[this](wxCommandEvent&) { split_volume(); }, "split_parts_SMALL", &object_menu, [this]() { return can_split(); }, q);
append_submenu(&object_menu, split_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object")), "",
[this]() { return can_split() && wxGetApp().get_mode() > comSimple; }, q);
[this]() { return can_split() && wxGetApp().get_mode() > comSimple || wxGetApp().app_config->get("objects_always_expert") == "1"; }, q);
object_menu.AppendSeparator();
// Layers Editing for object
@ -4611,7 +4611,7 @@ void Plater::priv::update_after_undo_redo(const UndoRedo::Snapshot& snapshot, bo
wxGetApp().obj_list()->update_after_undo_redo();
if (wxGetApp().get_mode() == comSimple && model_has_advanced_features(this->model)) {
if (wxGetApp().get_mode() == comSimple && model_has_advanced_features(this->model) && wxGetApp().app_config->get("objects_always_expert") != "1") {
// If the user jumped to a snapshot that require user interface with advanced features, switch to the advanced mode without asking.
// There is a little risk of surprising the user, as he already must have had the advanced or expert mode active for such a snapshot to be taken.
Slic3r::GUI::wxGetApp().save_mode(comAdvanced);
@ -5200,7 +5200,7 @@ void Plater::reslice()
if (p->background_process.running())
{
if (wxGetApp().get_mode() == comSimple)
if (wxGetApp().get_mode() == comSimple && wxGetApp().app_config->get("objects_always_expert") != "1")
p->sidebar->set_btn_label(ActionButtonType::abReslice, _(L("Slicing")) + dots);
else
{

View File

@ -100,6 +100,13 @@ void PreferencesDialog::build()
option = Option (def,"show_incompatible_presets");
m_optgroup_general->append_single_option_line(option);
def.label = L("Main GUI always in expert mode");
def.type = coBool;
def.tooltip = L("If enabled, the gui will be in expert mode even if the simple or advanced mode is selected (but not the setting tabs).");
def.set_default_value(new ConfigOptionBool{ app_config->get("objects_always_expert") == "1" });
option = Option(def, "objects_always_expert");
m_optgroup_general->append_single_option_line(option);
m_optgroup_paths = std::make_shared<ConfigOptionsGroup>(this, _(L("General")));
m_optgroup_paths->title_width = 10;
m_optgroup_paths->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
@ -129,12 +136,12 @@ void PreferencesDialog::build()
m_values[opt_key] = boost::any_cast<bool>(value) ? "1" : "0";
};
def.label = L("Use perspective camera");
def.type = coBool;
def.tooltip = L("If enabled, use perspective camera. If not enabled, use orthographic camera.");
def.set_default_value(new ConfigOptionBool{ app_config->get("use_perspective_camera") == "1" });
option = Option(def, "use_perspective_camera");
m_optgroup_camera->append_single_option_line(option);
def.label = L("Use perspective camera");
def.type = coBool;
def.tooltip = L("If enabled, use perspective camera. If not enabled, use orthographic camera.");
def.set_default_value(new ConfigOptionBool{ app_config->get("use_perspective_camera") == "1" });
option = Option(def, "use_perspective_camera");
m_optgroup_camera->append_single_option_line(option);
def.label = L("Use free camera");
def.type = coBool;