Merge branch 'master' into fs_emboss_temp

This commit is contained in:
Filip Sykala - NTB T15p 2023-02-14 20:27:52 +01:00
commit 55d8d153fc
52 changed files with 265 additions and 233 deletions

View File

@ -11075,7 +11075,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""

View File

@ -11845,7 +11845,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""
"L'actualització de la configuració fa que es perdi la modificació de la "

View File

@ -2392,7 +2392,7 @@ msgstr "Zálohy konfigurace"
#: src/slic3r/Utils/PresetUpdater.cpp:777
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""
"Aktualizace konfigurace způsobí ztrátu změn v přednastaveních.\n"

View File

@ -2392,7 +2392,7 @@ msgstr "Konfigurations-Momentaufnahmen"
#: src/slic3r/Utils/PresetUpdater.cpp:777
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""
"Bei einer Konfigurationsaktualisierung gehen voreingestellte Änderungen "

View File

@ -11084,7 +11084,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""

View File

@ -2372,7 +2372,7 @@ msgstr "Instantáneas de la Configuración"
#: src/slic3r/Utils/PresetUpdater.cpp:777
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""
"La actualización de la configuración hace que se pierda la modificación de "

View File

@ -2399,7 +2399,7 @@ msgstr "Instantanés de Configuration capturés"
#: src/slic3r/Utils/PresetUpdater.cpp:777
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""
"Les mises à jour de configuration entraînent une perte de modification des "

View File

@ -11832,7 +11832,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""
"A Konfigurációs frissítések hatására az előre beállított módosítások "

View File

@ -2379,7 +2379,7 @@ msgstr "Istantanee di Configurazione"
#: src/slic3r/Utils/PresetUpdater.cpp:777
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""
"Gli aggiornamenti di configurazione causano la perdita della modifica del "

View File

@ -2338,7 +2338,7 @@ msgstr "設定のスナップショット"
#: src/slic3r/Utils/PresetUpdater.cpp:777
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""
"構成のアップデートをすると、プリセットの変更が失われます。\n"

View File

@ -11257,7 +11257,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""

View File

@ -11398,7 +11398,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""

View File

@ -11398,7 +11398,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""

View File

@ -11774,7 +11774,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""
"Configuratie-updates veroorzaken een verlies van preset-aanpassingen.\n"

View File

@ -2403,7 +2403,7 @@ msgstr "Zrzuty konfiguracji"
#: src/slic3r/Utils/PresetUpdater.cpp:777
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""
"Aktualizacja konfiguracji spowoduje utratę zmian w zestawach ustawień.\n"

View File

@ -11769,7 +11769,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""
"Atualizações de configuração causam perda de modificação predefinida.\n"

View File

@ -11854,7 +11854,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""
"Обновление конфигурации приводит к потере изменённых профилей.\n"

View File

@ -11233,7 +11233,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""

View File

@ -11543,7 +11543,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""

View File

@ -11363,7 +11363,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""
"配置更新会导致预设修改丢失。\n"

View File

@ -11083,7 +11083,7 @@ msgstr ""
#: src/slic3r/Utils/PresetUpdater.cpp:1171
msgid ""
"Configuration Updates causes a lost of preset modification.\n"
"Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary."
msgstr ""

View File

@ -230,6 +230,8 @@ namespace Slic3r {
std::string tcr_rotated_gcode = post_process_wipe_tower_moves(tcr, wipe_tower_offset, wipe_tower_rotation);
gcode += gcodegen.writer().unlift(); // Make sure there is no z-hop (in most cases, there isn't).
double current_z = gcodegen.writer().get_position().z();
if (z == -1.) // in case no specific z was provided, print at current_z pos
z = current_z;

View File

@ -1352,11 +1352,11 @@ void ModelVolume::apply_tolerance()
vol->set_offset(pos);
*/
// make a "hole" wider
sf[X] *= 1. + double(cut_info.radius_tolerance);
sf[Y] *= 1. + double(cut_info.radius_tolerance);
sf[X] += double(cut_info.radius_tolerance);
sf[Y] += double(cut_info.radius_tolerance);
// make a "hole" dipper
sf[Z] *= 1. + double(cut_info.height_tolerance);
sf[Z] += double(cut_info.height_tolerance);
set_scaling_factor(sf);
}

View File

@ -2786,7 +2786,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionBool(true));
def = this->add("support_tree_angle", coFloat);
def->label = L("Tree Support Maximum Branch Angle");
def->label = L("Maximum Branch Angle");
def->category = L("Support material");
def->tooltip = L("The maximum angle of the branches, when the branches have to avoid the model. "
"Use a lower angle to make them more vertical and more stable. Use a higher angle to be able to have more reach.");
@ -2797,7 +2797,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloat(40));
def = this->add("support_tree_angle_slow", coFloat);
def->label = L("Tree Support Preferred Branch Angle");
def->label = L("Preferred Branch Angle");
def->category = L("Support material");
def->tooltip = L("The preferred angle of the branches, when they do not have to avoid the model. "
"Use a lower angle to make them more vertical and more stable. Use a higher angle for branches to merge faster.");
@ -2808,18 +2808,18 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloat(25));
def = this->add("support_tree_tip_diameter", coFloat);
def->label = L("Tree Support Tip Diameter");
def->label = L("Tip Diameter");
def->category = L("Support material");
def->tooltip = L("The diameter of the top of the tip of the branches of tree support.");
def->tooltip = L("The diameter of the top of the tip of the branches of organic support.");
def->sidetext = L("mm");
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.8));
def = this->add("support_tree_branch_diameter", coFloat);
def->label = L("Tree Support Branch Diameter");
def->label = L("Branch Diameter");
def->category = L("Support material");
def->tooltip = L("The diameter of the thinnest branches of tree support. Thicker branches are more sturdy. "
def->tooltip = L("The diameter of the thinnest branches of organic support. Thicker branches are more sturdy. "
"Branches towards the base will be thicker than this.");
def->sidetext = L("mm");
def->min = 0;
@ -2827,11 +2827,11 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloat(2));
def = this->add("support_tree_branch_diameter_angle", coFloat);
def->label = L("Tree Support Branch Diameter Angle");
def->label = L("Branch Diameter Angle");
def->category = L("Support material");
def->tooltip = L("The angle of the branches' diameter as they gradually become thicker towards the bottom. "
"An angle of 0 will cause the branches to have uniform thickness over their length. "
"A bit of an angle can increase stability of the tree support.");
"A bit of an angle can increase stability of the organic support.");
def->sidetext = L("°");
def->min = 0;
def->max = 15;
@ -2839,7 +2839,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloat(5));
def = this->add("support_tree_top_rate", coPercent);
def->label = L("Tree Support Branch Density");
def->label = L("Branch Density");
def->category = L("Support material");
def->tooltip = L("Adjusts the density of the support structure used to generate the tips of the branches. "
"A higher value results in better overhangs, but the supports are harder to remove. "

View File

@ -824,7 +824,7 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
#if ENABLE_ENVIRONMENT_MAP
unsigned int environment_texture_id = GUI::wxGetApp().plater()->get_environment_texture_id();
bool use_environment_texture = environment_texture_id > 0 && GUI::wxGetApp().app_config->get("use_environment_map") == "1";
bool use_environment_texture = environment_texture_id > 0 && GUI::wxGetApp().app_config->get_bool("use_environment_map");
shader->set_uniform("use_environment_tex", use_environment_texture);
if (use_environment_texture)
glsafe(::glBindTexture(GL_TEXTURE_2D, environment_texture_id));
@ -869,7 +869,7 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
shader->stop_using();
if (edges_shader != nullptr) {
edges_shader->start_using();
if (m_show_non_manifold_edges && GUI::wxGetApp().app_config->get("non_manifold_edges") == "1") {
if (m_show_non_manifold_edges && GUI::wxGetApp().app_config->get_bool("non_manifold_edges")) {
for (GLVolumeWithIdAndZ& volume : to_render) {
volume.first->render_non_manifold_edges();
}

View File

@ -283,7 +283,7 @@ void Camera::debug_render() const
imgui.begin(std::string("Camera statistics"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
std::string type = get_type_as_string();
if (wxGetApp().plater()->get_mouse3d_controller().connected() || (wxGetApp().app_config->get("use_free_camera") == "1"))
if (wxGetApp().plater()->get_mouse3d_controller().connected() || (wxGetApp().app_config->get_bool("use_free_camera")))
type += "/free";
else
type += "/constrained";

View File

@ -292,6 +292,13 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
toggle_field("support_material_bottom_contact_distance", have_support_material && ! have_support_soluble);
toggle_field("support_material_closing_radius", have_support_material && support_material_style == smsSnug);
const bool has_organic_supports = support_material_style == smsOrganic &&
(config->opt_bool("support_material") ||
config->opt_int("support_material_enforce_layers") > 0);
for (const std::string& key : { "support_tree_angle", "support_tree_angle_slow", "support_tree_branch_diameter",
"support_tree_branch_diameter_angle", "support_tree_tip_diameter", "support_tree_top_rate" })
toggle_field(key, has_organic_supports);
for (auto el : { "support_material_bottom_interface_layers", "support_material_interface_spacing", "support_material_interface_extruder",
"support_material_interface_speed", "support_material_interface_contact_loops" })
toggle_field(el, have_support_material && have_support_interface);

View File

@ -1298,7 +1298,7 @@ PageUpdate::PageUpdate(ConfigWizard *parent)
append_spacer(VERTICAL_SPACING);
auto *box_presets = new wxCheckBox(this, wxID_ANY, _L("Update built-in Presets automatically"));
box_presets->SetValue(app_config->get("preset_update") == "1");
box_presets->SetValue(app_config->get_bool("preset_update"));
append(box_presets);
append_text(wxString::Format(_L(
"If enabled, %s downloads updates of built-in system presets in the background."
@ -1416,7 +1416,7 @@ PageDownloader::PageDownloader(ConfigWizard* parent)
auto* box_allow_downloads = new wxCheckBox(this, wxID_ANY, _L("Allow build-in downloader"));
// TODO: Do we want it like this? The downloader is allowed for very first time the wizard is run.
bool box_allow_value = (app_config->has("downloader_url_registered") ? app_config->get("downloader_url_registered") == "1" : true);
bool box_allow_value = (app_config->has("downloader_url_registered") ? app_config->get_bool("downloader_url_registered") : true);
box_allow_downloads->SetValue(box_allow_value);
append(box_allow_downloads);
@ -1517,7 +1517,7 @@ void DownloaderUtils::Worker::deregister()
bool DownloaderUtils::Worker::on_finish() {
AppConfig* app_config = wxGetApp().app_config;
bool ac_value = app_config->get("downloader_url_registered") == "1";
bool ac_value = app_config->get_bool("downloader_url_registered");
BOOST_LOG_TRIVIAL(debug) << "PageDownloader::on_finish_downloader ac_value " << ac_value << " downloader_checked " << downloader_checked;
if (ac_value && downloader_checked) {
// already registered but we need to do it again
@ -1546,7 +1546,7 @@ PageReloadFromDisk::PageReloadFromDisk(ConfigWizard* parent)
, full_pathnames(false)
{
auto* box_pathnames = new wxCheckBox(this, wxID_ANY, _L("Export full pathnames of models and parts sources into 3mf and amf files"));
box_pathnames->SetValue(wxGetApp().app_config->get("export_sources_full_pathnames") == "1");
box_pathnames->SetValue(wxGetApp().app_config->get_bool("export_sources_full_pathnames"));
append(box_pathnames);
append_text(_L(
"If enabled, allows the Reload from disk command to automatically find and load the files when invoked.\n"
@ -1595,7 +1595,7 @@ PageMode::PageMode(ConfigWizard *parent)
append_text("\n" + _L("The size of the object can be specified in inches"));
check_inch = new wxCheckBox(this, wxID_ANY, _L("Use inches"));
check_inch->SetValue(wxGetApp().app_config->get("use_inches") == "1");
check_inch->SetValue(wxGetApp().app_config->get_bool("use_inches"));
append(check_inch);
on_activate();

View File

@ -2373,7 +2373,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
statistics->models_instances_size = 0;
#endif // ENABLE_GCODE_VIEWER_STATISTICS
const bool top_layer_only = get_app_config()->get("seq_top_layer_only") == "1";
const bool top_layer_only = get_app_config()->get_bool("seq_top_layer_only");
SequentialView::Endpoints global_endpoints = { m_moves_count , 0 };
SequentialView::Endpoints top_layer_endpoints = global_endpoints;
@ -3221,7 +3221,7 @@ void GCodeViewer::render_legend(float& legend_height)
const float icon_size = ImGui::GetTextLineHeight();
const float percent_bar_size = 2.0f * ImGui::GetTextLineHeight();
bool imperial_units = wxGetApp().app_config->get("use_inches") == "1";
bool imperial_units = wxGetApp().app_config->get_bool("use_inches");
auto append_item = [icon_size, percent_bar_size, &imgui, imperial_units](EItemType type, const ColorRGBA& color, const std::string& label,
bool visible = true, const std::string& time = "", float percent = 0.0f, float max_percent = 0.0f, const std::array<float, 4>& offsets = { 0.0f, 0.0f, 0.0f, 0.0f },

View File

@ -2308,7 +2308,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
#endif /* __APPLE__ */
{
#ifdef _WIN32
if (wxGetApp().app_config->get("use_legacy_3DConnexion") == "1") {
if (wxGetApp().app_config->get_bool("use_legacy_3DConnexion")) {
#endif //_WIN32
#ifdef __APPLE__
// On OSX use Cmd+Shift+M to "Show/Hide 3Dconnexion devices settings dialog"
@ -2783,7 +2783,7 @@ void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt)
return;
// Calculate the zoom delta and apply it to the current zoom factor
double direction_factor = (wxGetApp().app_config->get("reverse_mouse_wheel_zoom") == "1") ? -1.0 : 1.0;
double direction_factor = wxGetApp().app_config->get_bool("reverse_mouse_wheel_zoom") ? -1.0 : 1.0;
_update_camera_zoom(direction_factor * (double)evt.GetWheelRotation() / (double)evt.GetWheelDelta());
}
@ -3212,7 +3212,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
if (!m_moving) {
if ((any_gizmo_active || evt.CmdDown() || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) {
const Vec3d rot = (Vec3d(pos.x(), pos.y(), 0.0) - m_mouse.drag.start_position_3D) * (PI * TRACKBALLSIZE / 180.0);
if (wxGetApp().app_config->get("use_free_camera") == "1")
if (wxGetApp().app_config->get_bool("use_free_camera"))
// Virtual track ball (similar to the 3DConnexion mouse).
wxGetApp().plater()->get_camera().rotate_local_around_target(Vec3d(rot.y(), rot.x(), 0.0));
else {
@ -3238,7 +3238,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
const Vec3d cur_pos = _mouse_to_3d(pos, &z);
const Vec3d orig = _mouse_to_3d(m_mouse.drag.start_position_2D, &z);
Camera& camera = wxGetApp().plater()->get_camera();
if (wxGetApp().app_config->get("use_free_camera") != "1")
if (!wxGetApp().app_config->get_bool("use_free_camera"))
// Forces camera right vector to be parallel to XY plane in case it has been misaligned using the 3D mouse free rotation.
// It is cheaper to call this function right away instead of testing wxGetApp().plater()->get_mouse3d_controller().connected(),
// which checks an atomics (flushes CPU caches).
@ -3806,7 +3806,7 @@ void GLCanvas3D::update_ui_from_settings()
// Update OpenGL scaling on OSX after the user toggled the "use_retina_opengl" settings in Preferences dialog.
const float orig_scaling = m_retina_helper->get_scale_factor();
const bool use_retina = wxGetApp().app_config->get("use_retina_opengl") == "1";
const bool use_retina = wxGetApp().app_config->get_bool("use_retina_opengl");
BOOST_LOG_TRIVIAL(debug) << "GLCanvas3D: Use Retina OpenGL: " << use_retina;
m_retina_helper->set_use_retina(use_retina);
const float new_scaling = m_retina_helper->get_scale_factor();
@ -3821,7 +3821,7 @@ void GLCanvas3D::update_ui_from_settings()
#endif // ENABLE_RETINA_GL
if (wxGetApp().is_editor())
wxGetApp().plater()->enable_collapse_toolbar(wxGetApp().app_config->get("show_collapse_button") == "1");
wxGetApp().plater()->enable_collapse_toolbar(wxGetApp().app_config->get_bool("show_collapse_button"));
}
GLCanvas3D::WipeTowerInfo GLCanvas3D::get_wipe_tower_info() const
@ -4725,8 +4725,8 @@ bool GLCanvas3D::_init_main_toolbar()
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ;
item.sprite_id = 10;
item.enabling_callback = GLToolbarItem::Default_Enabling_Callback;
item.visibility_callback = []() { return (wxGetApp().app_config->get("new_settings_layout_mode") == "1" ||
wxGetApp().app_config->get("dlg_settings_layout_mode") == "1"); };
item.visibility_callback = []() { return wxGetApp().app_config->get_bool("new_settings_layout_mode") ||
wxGetApp().app_config->get_bool("dlg_settings_layout_mode"); };
item.left.action_callback = []() { wxGetApp().mainframe->select_tab(); };
if (!m_main_toolbar.add_item(item))
return false;

View File

@ -1203,7 +1203,7 @@ bool GUI_App::on_init_inner()
// Now this position is equal to the mainframe position
wxPoint splashscreen_pos = wxDefaultPosition;
bool default_splashscreen_pos = true;
if (app_config->has("window_mainframe") && app_config->get("restore_win_position") == "1") {
if (app_config->has("window_mainframe") && app_config->get_bool("restore_win_position")) {
auto metrics = WindowMetrics::deserialize(app_config->get("window_mainframe"));
default_splashscreen_pos = metrics == boost::none;
if (!default_splashscreen_pos)
@ -1237,7 +1237,7 @@ bool GUI_App::on_init_inner()
if (! older_data_dir_path.empty()) {
preset_bundle->import_newer_configs(older_data_dir_path);
app_config->save();
//app_config->save(); // It looks like redundant call of save. ysFIXME delete after testing
}
if (is_editor()) {
@ -1413,7 +1413,6 @@ bool GUI_App::on_init_inner()
app_config->set("restore_win_position", "0");
else if (answer == wxID_NO)
app_config->set("restore_win_position", "1");
app_config->save();
}
return true;
@ -2889,7 +2888,7 @@ void GUI_App::MacOpenFiles(const wxArrayString &fileNames)
void GUI_App::MacOpenURL(const wxString& url)
{
if (app_config && app_config->get("downloader_url_registered") != "1")
if (app_config && !app_config->get_bool("downloader_url_registered"))
{
BOOST_LOG_TRIVIAL(error) << "Recieved command to open URL, but it is not allowed in app configuration. URL: " << url;
return;
@ -3167,6 +3166,9 @@ void GUI_App::window_pos_save(wxTopLevelWindow* window, const std::string &name)
WindowMetrics metrics = WindowMetrics::from_window(window);
app_config->set(config_key, metrics.serialize());
// save changed app_config here, before all action related to a close of application is processed
if (app_config->dirty())
app_config->save();
}
void GUI_App::window_pos_restore(wxTopLevelWindow* window, const std::string &name, bool default_maximized)
@ -3187,7 +3189,7 @@ void GUI_App::window_pos_restore(wxTopLevelWindow* window, const std::string &na
const wxRect& rect = metrics->get_rect();
if (app_config->get("restore_win_position") == "1") {
if (app_config->get_bool("restore_win_position")) {
// workaround for crash related to the positioning of the window on secondary monitor
app_config->set("restore_win_position", (boost::format("crashed_at_%1%_pos") % name).str());
app_config->save();
@ -3242,7 +3244,7 @@ bool GUI_App::config_wizard_startup()
return true;
}
#ifndef __APPLE__
else if (is_editor() && m_last_app_conf_lower_version && app_config->get("downloader_url_registered") == "1") {
else if (is_editor() && m_last_app_conf_lower_version && app_config->get_bool("downloader_url_registered")) {
show_downloader_registration_dialog();
return true;
}
@ -3302,11 +3304,11 @@ bool GUI_App::open_browser_with_warning_dialog(const wxString& url, wxWindow* pa
}
}
if (launch)
launch = app_config->get(option_key) != "1";
launch = !app_config->get_bool(option_key);
}
// warning dialog doesn't containe a "Remember my choice" checkbox
// and will be shown only when "Suppress to open hyperlink in browser" is ON.
else if (app_config->get(option_key) == "1") {
else if (app_config->get_bool(option_key)) {
MessageDialog dialog(parent, _L("Open hyperlink in default browser?"), _L("PrusaSlicer: Open hyperlink"), wxICON_QUESTION | wxYES_NO);
launch = dialog.ShowModal() == wxID_YES;
}

View File

@ -1218,9 +1218,15 @@ wxMenu* MenuFactory::multi_selection_menu()
append_menu_item_merge_to_multipart_object(menu);
if (extruders_count() > 1)
append_menu_item_change_extruder(menu);
if (list_model()->GetItemType(sels[0]) != itVolume)
if (list_model()->GetItemType(sels[0]) != itVolume) {
append_menu_item_printable(menu);
if (wxGetApp().get_mode() != comSimple)
append_menu_item(menu, wxID_ANY, _L("Set number of instances") + dots, _L("Change the number of instances of the selected objects"),
[](wxCommandEvent&) { plater()->set_number_of_copies(); }, "number_of_copies", nullptr,
[]() { return plater()->can_increase_instances(); }, m_parent);
}
return menu;
}

View File

@ -49,7 +49,7 @@ int GUI_Run(GUI_InitParams &params)
GUI::GUI_App* gui = new GUI::GUI_App(params.start_as_gcodeviewer ? GUI::GUI_App::EAppMode::GCodeViewer : GUI::GUI_App::EAppMode::Editor);
if (gui->get_app_mode() != GUI::GUI_App::EAppMode::GCodeViewer) {
// G-code viewer is currently not performing instance check, a new G-code viewer is started every time.
bool gui_single_instance_setting = gui->app_config->get("single_instance") == "1";
bool gui_single_instance_setting = gui->app_config->get_bool("single_instance");
if (Slic3r::instance_check(params.argc, params.argv, gui_single_instance_setting)) {
//TODO: do we have delete gui and other stuff?
return -1;

View File

@ -1250,7 +1250,7 @@ bool ObjectList::can_drop(const wxDataViewItem& item) const
if (dragged_item_v_type == item_v_type && dragged_item_v_type != ModelVolumeType::MODEL_PART)
return true;
if ((wxGetApp().app_config->get("order_volumes") == "1" && dragged_item_v_type != item_v_type) || // we can't reorder volumes outside of types
if ((wxGetApp().app_config->get_bool("order_volumes") && dragged_item_v_type != item_v_type) || // we can't reorder volumes outside of types
item_v_type >= ModelVolumeType::SUPPORT_BLOCKER) // support blockers/enforcers can't change its place
return false;
@ -1855,7 +1855,7 @@ void ObjectList::load_mesh_object(
new_object->add_instance(); // each object should have at list one instance
ModelVolume* new_volume = new_object->add_volume(mesh);
new_object->sort_volumes(wxGetApp().app_config->get("order_volumes") == "1");
new_object->sort_volumes(wxGetApp().app_config->get_bool("order_volumes"));
new_volume->name = name;
if (text_config)
new_volume->text_configuration = *text_config;
@ -2327,7 +2327,7 @@ void ObjectList::merge(bool to_multipart_object)
const Vec3d vol_offset = volume_offset_correction* new_volume->get_offset();
new_volume->set_offset(vol_offset);
}
new_object->sort_volumes(wxGetApp().app_config->get("order_volumes") == "1");
new_object->sort_volumes(wxGetApp().app_config->get_bool("order_volumes"));
// merge settings
auto new_opt_keys = config.keys();
@ -4896,7 +4896,7 @@ void ObjectList::set_extruder_for_selected_items(const int extruder) const
wxDataViewItemArray ObjectList::reorder_volumes_and_get_selection(size_t obj_idx, std::function<bool(const ModelVolume*)> add_to_selection/* = nullptr*/)
{
(*m_objects)[obj_idx]->sort_volumes(wxGetApp().app_config->get("order_volumes") == "1");
(*m_objects)[obj_idx]->sort_volumes(wxGetApp().app_config->get_bool("order_volumes"));
wxDataViewItemArray items = add_volumes_to_object_in_list(obj_idx, std::move(add_to_selection));
@ -4907,7 +4907,7 @@ wxDataViewItemArray ObjectList::reorder_volumes_and_get_selection(size_t obj_idx
void ObjectList::apply_volumes_order()
{
if (wxGetApp().app_config->get("order_volumes") != "1" || !m_objects)
if (!wxGetApp().app_config->get_bool("order_volumes") || !m_objects)
return;
for (size_t obj_idx = 0; obj_idx < m_objects->size(); obj_idx++)

View File

@ -118,8 +118,8 @@ static const wxString axes_color_back[] = { "#f5dcdc", "#dcf5dc", "#dcdcf5" };
ObjectManipulation::ObjectManipulation(wxWindow* parent) :
OG_Settings(parent, true)
{
m_imperial_units = wxGetApp().app_config->get("use_inches") == "1";
m_use_colors = wxGetApp().app_config->get("color_mapinulation_panel") == "1";
m_imperial_units = wxGetApp().app_config->get_bool("use_inches");
m_use_colors = wxGetApp().app_config->get_bool("color_mapinulation_panel");
m_manifold_warning_bmp = ScalableBitmap(parent, "exclamation");
@ -642,8 +642,8 @@ void ObjectManipulation::DisableUnuniformScale()
void ObjectManipulation::update_ui_from_settings()
{
if (m_imperial_units != (wxGetApp().app_config->get("use_inches") == "1")) {
m_imperial_units = wxGetApp().app_config->get("use_inches") == "1";
if (m_imperial_units != wxGetApp().app_config->get_bool("use_inches")) {
m_imperial_units = wxGetApp().app_config->get_bool("use_inches");
auto update_unit_text = [](const wxString& new_unit_text, wxStaticText* widget) {
widget->SetLabel(new_unit_text);
@ -667,8 +667,8 @@ void ObjectManipulation::update_ui_from_settings()
}
m_check_inch->SetValue(m_imperial_units);
if (m_use_colors != (wxGetApp().app_config->get("color_mapinulation_panel") == "1")) {
m_use_colors = wxGetApp().app_config->get("color_mapinulation_panel") == "1";
if (m_use_colors != wxGetApp().app_config->get_bool("color_mapinulation_panel")) {
m_use_colors = wxGetApp().app_config->get_bool("color_mapinulation_panel");
// update colors for edit-boxes
int axis_id = 0;
for (ManipulationEditor* editor : m_editors) {

View File

@ -537,7 +537,7 @@ void Preview::update_layers_slider(const std::vector<double>& layers_z, bool kee
// Suggest the auto color change, if model looks like sign
if (!color_change_already_exists &&
wxGetApp().app_config->get("allow_auto_color_change") == "1" &&
wxGetApp().app_config->get_bool("allow_auto_color_change") &&
m_layers_slider->IsNewPrint())
{
const Print& print = wxGetApp().plater()->fff_print();

View File

@ -165,7 +165,7 @@ bool check_dark_mode() {
#ifdef _WIN32
void update_dark_ui(wxWindow* window)
{
bool is_dark = wxGetApp().app_config->get("dark_color_mode") == "1";// ? true : check_dark_mode();// #ysDarkMSW - Allow it when we deside to support the sustem colors for application
bool is_dark = wxGetApp().app_config->get_bool("dark_color_mode");// ? true : check_dark_mode();// #ysDarkMSW - Allow it when we deside to support the sustem colors for application
window->SetBackgroundColour(is_dark ? wxColour(43, 43, 43) : wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
window->SetForegroundColour(is_dark ? wxColour(250, 250, 250) : wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
}

View File

@ -501,42 +501,42 @@ bool GLGizmoCut3D::render_double_input(const std::string& label, double& value_i
bool GLGizmoCut3D::render_slider_double_input(const std::string& label, float& value_in, float& tolerance_in)
{
ImGui::AlignTextToFramePadding();
m_imgui->text(label);
ImGui::SameLine(m_label_width);
ImGui::PushItemWidth(m_control_width * 0.85f);
float value = value_in;
if (m_imperial_units)
value *= float(ObjectManipulation::mm_to_in);
float old_val = value;
constexpr float UndefMinVal = -0.1f;
const float f_mm_to_in = static_cast<float>(ObjectManipulation::mm_to_in);
auto render_slider = [this, UndefMinVal, f_mm_to_in]
(const std::string& label, float& val, float def_val, float max_val, const wxString& tooltip) {
float min_val = val < 0.f ? UndefMinVal : def_val;
float value = val;
if (m_imperial_units) {
min_val *= f_mm_to_in;
value *= f_mm_to_in;
}
const float old_val = value;
const std::string format = val < 0.f ? UndefLabel : (m_imperial_units ? "%.4f " + _u8L("in") : "%.2f " + _u8L("mm"));
m_imgui->slider_float(label.c_str(), &value, min_val, max_val, format.c_str(), 1.f, true, tooltip);
val = value * (m_imperial_units ? static_cast<float>(ObjectManipulation::in_to_mm) : 1.f);
return !is_approx(old_val, value);
};
const BoundingBoxf3 bbox = bounding_box();
float mean_size = float((bbox.size().x() + bbox.size().y() + bbox.size().z()) / 9.0);
float min_size = value_in < 0.f ? UndefMinVal : 1.f;
if (m_imperial_units) {
mean_size *= float(ObjectManipulation::mm_to_in);
min_size *= float(ObjectManipulation::mm_to_in);
}
std::string format = value_in < 0.f ? UndefLabel :
m_imperial_units ? "%.4f " + _u8L("in") : "%.2f " + _u8L("mm");
const float mean_size = float((bbox.size().x() + bbox.size().y() + bbox.size().z()) / 9.0) * (m_imperial_units ? f_mm_to_in : 1.f);
m_imgui->slider_float(("##" + label).c_str(), &value, min_size, mean_size, format.c_str());
value_in = value * float(m_imperial_units ? ObjectManipulation::in_to_mm : 1.0);
ImGuiWrapper::text(label);
ImGui::SameLine(m_label_width + m_control_width + 3);
ImGui::PushItemWidth(m_control_width * 0.3f);
ImGui::SameLine(m_label_width);
ImGui::PushItemWidth(m_control_width * 0.7f);
float old_tolerance, tolerance = old_tolerance = tolerance_in * 100.f;
std::string format_t = tolerance_in < 0.f ? UndefLabel : "%.f %%";
float min_tolerance = tolerance_in < 0.f ? UndefMinVal : 0.f;
const bool is_value_changed = render_slider("##" + label, value_in, 1.f, mean_size, _L("Value"));
ImGui::SameLine();
ImGui::PushItemWidth(m_control_width * 0.45f);
m_imgui->slider_float(("##tolerance_" + label).c_str(), &tolerance, min_tolerance, 20.f, format_t.c_str(), 1.f, true, _L("Tolerance"));
tolerance_in = tolerance * 0.01f;
const bool is_tolerance_changed = render_slider("##tolerance_" + label, tolerance_in, 0.f, 0.5f * mean_size, _L("Tolerance"));
return !is_approx(old_val, value) || !is_approx(old_tolerance, tolerance);
return is_value_changed || is_tolerance_changed;
}
void GLGizmoCut3D::render_move_center_input(int axis)
@ -1597,7 +1597,7 @@ void GLGizmoCut3D::render_connectors_input_window(CutConnectors &connectors)
if (m_connector_size > 0)
connectors[idx].radius = 0.5f * m_connector_size;
if (m_connector_size_tolerance >= 0)
connectors[idx].radius_tolerance = m_connector_size_tolerance;
connectors[idx].radius_tolerance = 0.5f * m_connector_size_tolerance;
});
ImGui::Separator();
@ -1757,7 +1757,7 @@ void GLGizmoCut3D::validate_connector_settings()
void GLGizmoCut3D::init_input_window_data(CutConnectors &connectors)
{
m_imperial_units = wxGetApp().app_config->get("use_inches") == "1";
m_imperial_units = wxGetApp().app_config->get_bool("use_inches");
m_label_width = m_imgui->get_font_size() * 6.f;
m_control_width = m_imgui->get_font_size() * 9.f;
@ -1809,7 +1809,7 @@ void GLGizmoCut3D::init_input_window_data(CutConnectors &connectors)
m_connector_depth_ratio = depth_ratio;
m_connector_depth_ratio_tolerance = depth_ratio_tolerance;
m_connector_size = 2.f * radius;
m_connector_size_tolerance = radius_tolerance;
m_connector_size_tolerance = 2.f * radius_tolerance;
m_connector_type = type;
m_connector_style = size_t(style);
m_connector_shape_id = size_t(shape);
@ -2260,7 +2260,7 @@ bool GLGizmoCut3D::add_connector(CutConnectors& connectors, const Vec2d& mouse_p
connectors.emplace_back(pos, m_rotation_m,
m_connector_size * 0.5f, m_connector_depth_ratio,
m_connector_size_tolerance, m_connector_depth_ratio_tolerance,
m_connector_size_tolerance * 0.5f, m_connector_depth_ratio_tolerance,
CutConnectorAttributes( CutConnectorType(m_connector_type),
CutConnectorStyle(m_connector_style),
CutConnectorShape(m_connector_shape_id)));

View File

@ -3242,7 +3242,7 @@ void GLGizmoEmboss::draw_style_edit() {
process();
}
bool use_inch = wxGetApp().app_config->get("use_inches") == "1";
bool use_inch = wxGetApp().app_config->get_bool("use_inches");
draw_height(use_inch);
draw_depth(use_inch);
@ -3599,7 +3599,7 @@ void GLGizmoEmboss::draw_advanced()
&stored_style->prop.distance : nullptr;
m_imgui->disabled_begin(!allowe_surface_distance);
bool use_inch = wxGetApp().app_config->get("use_inches") == "1";
bool use_inch = wxGetApp().app_config->get_bool("use_inches");
const std::string undo_move_tooltip = _u8L("Undo translation");
const wxString move_tooltip = _L("Distance center of text from model surface");
bool is_moved = false;

View File

@ -1205,7 +1205,7 @@ void GLGizmoMeasure::render_dimensioning()
ss_to_ndc_matrix * Geometry::translation_transform(v2ss_3) * q12ss);
m_dimensioning.triangle.render();
const bool use_inches = wxGetApp().app_config->get("use_inches") == "1";
const bool use_inches = wxGetApp().app_config->get_bool("use_inches");
const double curr_value = use_inches ? ObjectManipulation::mm_to_in * distance : distance;
const std::string curr_value_str = format_double(curr_value);
const std::string units = use_inches ? _u8L("in") : _u8L("mm");
@ -1973,7 +1973,7 @@ void GLGizmoMeasure::on_render_input_window(float x, float y, float bottom_limit
ImGui::EndTable();
}
const bool use_inches = wxGetApp().app_config->get("use_inches") == "1";
const bool use_inches = wxGetApp().app_config->get_bool("use_inches");
const std::string units = use_inches ? " " + _u8L("in") : " " + _u8L("mm");
ImGui::Separator();

View File

@ -883,7 +883,7 @@ void NotificationManager::HintNotification::render_close_button(ImGuiWrapper& im
//render_right_arrow_button(imgui, win_size_x, win_size_y, win_pos_x, win_pos_y);
render_logo(imgui, win_size_x, win_size_y, win_pos_x, win_pos_y);
render_preferences_button(imgui, win_pos_x, win_pos_y);
if (!m_documentation_link.empty() && wxGetApp().app_config->get("suppress_hyperlinks") != "1")
if (!m_documentation_link.empty() && !wxGetApp().app_config->get_bool("suppress_hyperlinks"))
{
render_documentation_button(imgui, win_size_x, win_size_y, win_pos_x, win_pos_y);
}

View File

@ -272,7 +272,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
update_ui_from_settings(); // FIXME (?)
if (m_plater != nullptr) {
m_plater->get_collapse_toolbar().set_enabled(wxGetApp().app_config->get("show_collapse_button") == "1");
m_plater->get_collapse_toolbar().set_enabled(wxGetApp().app_config->get_bool("show_collapse_button"));
m_plater->show_action_buttons(true);
preferences_dialog = new PreferencesDialog(this);
@ -442,9 +442,9 @@ void MainFrame::update_layout()
};
ESettingsLayout layout = wxGetApp().is_gcode_viewer() ? ESettingsLayout::GCodeViewer :
(wxGetApp().app_config->get("old_settings_layout_mode") == "1" ? ESettingsLayout::Old :
wxGetApp().app_config->get("new_settings_layout_mode") == "1" ? ( wxGetApp().tabs_as_menu() ? ESettingsLayout::Old : ESettingsLayout::New) :
wxGetApp().app_config->get("dlg_settings_layout_mode") == "1" ? ESettingsLayout::Dlg : ESettingsLayout::Old);
(wxGetApp().app_config->get_bool("old_settings_layout_mode") ? ESettingsLayout::Old :
wxGetApp().app_config->get_bool("new_settings_layout_mode") ? ( wxGetApp().tabs_as_menu() ? ESettingsLayout::Old : ESettingsLayout::New) :
wxGetApp().app_config->get_bool("dlg_settings_layout_mode") ? ESettingsLayout::Dlg : ESettingsLayout::Old);
if (m_layout == layout)
return;
@ -1001,7 +1001,7 @@ bool MainFrame::can_eject() const
bool MainFrame::can_slice() const
{
bool bg_proc = wxGetApp().app_config->get("background_processing") == "1";
bool bg_proc = wxGetApp().app_config->get_bool("background_processing");
return (m_plater != nullptr) ? !m_plater->model().objects.empty() && !bg_proc : false;
}
@ -1497,7 +1497,7 @@ void MainFrame::init_menubar_as_editor()
windowMenu->AppendSeparator();
append_menu_item(windowMenu, wxID_ANY, _L("Open New Instance") + "\tCtrl+Shift+I", _L("Open a new PrusaSlicer instance"),
[](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, [this]() {return m_plater != nullptr && wxGetApp().app_config->get("single_instance") != "1"; }, this);
[](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, [this]() {return m_plater != nullptr && !wxGetApp().app_config->get_bool("single_instance"); }, this);
windowMenu->AppendSeparator();
append_menu_item(windowMenu, wxID_ANY, _L("Compare Presets")/* + "\tCtrl+F"*/, _L("Compare presets"),
@ -2202,7 +2202,7 @@ void MainFrame::technology_changed()
// Update the UI based on the current preferences.
void MainFrame::update_ui_from_settings()
{
// const bool bp_on = wxGetApp().app_config->get("background_processing") == "1";
// const bool bp_on = wxGetApp().app_config->get_bool("background_processing");
// m_menu_item_reslice_now->Enable(!bp_on);
// m_plater->sidebar().show_reslice(!bp_on);
// m_plater->sidebar().show_export(bp_on);

View File

@ -246,7 +246,7 @@ void OG_CustomCtrl::OnMotion(wxMouseEvent& event)
wxString language = wxGetApp().app_config->get("translation_language");
bool suppress_hyperlinks = get_app_config()->get("suppress_hyperlinks") == "1";
const bool suppress_hyperlinks = get_app_config()->get_bool("suppress_hyperlinks");
for (CtrlLine& line : ctrl_lines) {
line.is_focused = is_point_in_rect(pos, line.rect_label);
@ -567,7 +567,7 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos)
Field* field = ctrl->opt_group->get_field(og_line.get_options().front().opt_id);
bool suppress_hyperlinks = get_app_config()->get("suppress_hyperlinks") == "1";
const bool suppress_hyperlinks = get_app_config()->get_bool("suppress_hyperlinks");
if (draw_just_act_buttons) {
if (field)
draw_act_bmps(dc, wxPoint(0, v_pos), field->undo_to_sys_bitmap(), field->undo_bitmap(), field->blink());

View File

@ -1052,7 +1052,7 @@ void ogStaticText::SetPathEnd(const std::string& link)
event.Skip();
} );
Bind(wxEVT_ENTER_WINDOW, [this, link](wxMouseEvent& event) {
SetToolTip(OptionsGroup::get_url(get_app_config()->get("suppress_hyperlinks") != "1" ? link : std::string()));
SetToolTip(OptionsGroup::get_url(!get_app_config()->get_bool("suppress_hyperlinks") ? link : std::string()));
FocusText(true);
event.Skip();
});
@ -1061,7 +1061,7 @@ void ogStaticText::SetPathEnd(const std::string& link)
void ogStaticText::FocusText(bool focus)
{
if (get_app_config()->get("suppress_hyperlinks") == "1")
if (get_app_config()->get_bool("suppress_hyperlinks"))
return;
SetFont(focus ? Slic3r::GUI::wxGetApp().link_font() :

View File

@ -1292,7 +1292,7 @@ void Sidebar::show_info_sizer()
int inst_idx = selection.get_instance_idx();
assert(inst_idx >= 0);
bool imperial_units = wxGetApp().app_config->get("use_inches") == "1";
bool imperial_units = wxGetApp().app_config->get_bool("use_inches");
double koef = imperial_units ? ObjectManipulation::mm_to_in : 1.0f;
ModelVolume* vol = nullptr;
@ -1388,7 +1388,7 @@ void Sidebar::update_sliced_info_sizer()
const PrintStatistics& ps = p->plater->fff_print().print_statistics();
const bool is_wipe_tower = ps.total_wipe_tower_filament > 0;
bool imperial_units = wxGetApp().app_config->get("use_inches") == "1";
bool imperial_units = wxGetApp().app_config->get_bool("use_inches");
double koef = imperial_units ? ObjectManipulation::in_to_mm : 1000.0;
wxString new_label = imperial_units ? _L("Used Filament (in)") : _L("Used Filament (m)");
@ -1814,7 +1814,7 @@ struct Plater::priv
void update_ui_from_settings();
void update_main_toolbar_tooltips();
// std::shared_ptr<ProgressStatusBar> statusbar();
std::string get_config(const std::string &key) const;
bool get_config_bool(const std::string &key) const;
std::vector<size_t> load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config, bool used_inches = false);
std::vector<size_t> load_model_objects(const ModelObjectPtrs& model_objects, bool allow_negative_z = false, bool call_selection_changed = true);
@ -1860,7 +1860,7 @@ struct Plater::priv
void process_validation_warning(const std::string& warning) const;
bool background_processing_enabled() const { return this->get_config("background_processing") == "1"; }
bool background_processing_enabled() const { return this->get_config_bool("background_processing"); }
void update_print_volume_state();
void schedule_background_process();
// Update background processing thread from the current config and Model.
@ -1941,7 +1941,7 @@ struct Plater::priv
bool can_delete() const;
bool can_delete_all() const;
bool can_increase_instances() const;
bool can_decrease_instances() const;
bool can_decrease_instances(int obj_idx = -1) const;
bool can_split_to_objects() const;
bool can_split_to_volumes() const;
bool can_arrange() const;
@ -2179,7 +2179,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
// updates camera type from .ini file
camera.enable_update_config_on_type_change(true);
camera.set_type(get_config("use_perspective_camera"));
camera.set_type(wxGetApp().app_config->get("use_perspective_camera"));
// Load the 3DConnexion device database.
mouse3d_controller.load_config(*wxGetApp().app_config);
@ -2266,7 +2266,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
// collapse sidebar according to saved value
if (wxGetApp().is_editor()) {
bool is_collapsed = wxGetApp().app_config->get("collapsed_sidebar") == "1";
bool is_collapsed = get_config_bool("collapsed_sidebar");
sidebar->collapse(is_collapsed);
}
}
@ -2283,7 +2283,7 @@ void Plater::priv::update(unsigned int flags)
{
// the following line, when enabled, causes flickering on NVIDIA graphics cards
// wxWindowUpdateLocker freeze_guard(q);
if (get_config("autocenter") == "1")
if (get_config_bool("autocenter"))
model.center_instances_around_point(this->bed.build_volume().bed_center());
unsigned int update_status = 0;
@ -2299,7 +2299,7 @@ void Plater::priv::update(unsigned int flags)
else
this->schedule_background_process();
if (get_config("autocenter") == "1" && this->sidebar->obj_manipul()->IsShown())
if (get_config_bool("autocenter") && this->sidebar->obj_manipul()->IsShown())
this->sidebar->obj_manipul()->UpdateAndShow(true);
}
@ -2314,7 +2314,7 @@ void Plater::priv::select_view(const std::string& direction)
void Plater::priv::apply_free_camera_correction(bool apply/* = true*/)
{
camera.set_type(wxGetApp().app_config->get("use_perspective_camera"));
if (apply && wxGetApp().app_config->get("use_free_camera") != "1")
if (apply && !wxGetApp().app_config->get_bool("use_free_camera"))
camera.recover_from_free_camera();
}
@ -2382,9 +2382,9 @@ void Plater::priv::update_main_toolbar_tooltips()
// return main_frame->m_statusbar;
//}
std::string Plater::priv::get_config(const std::string &key) const
bool Plater::priv::get_config_bool(const std::string &key) const
{
return wxGetApp().app_config->get(key);
return wxGetApp().app_config->get_bool(key);
}
// After loading of the presets from project, check if they are visible.
@ -2761,7 +2761,7 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs& mode
#endif /* AUTOPLACEMENT_ON_LOAD */
for (ModelObject *model_object : model_objects) {
auto *object = model.add_object(*model_object);
object->sort_volumes(wxGetApp().app_config->get("order_volumes") == "1");
object->sort_volumes(get_config_bool("order_volumes"));
std::string object_name = object->name.empty() ? fs::path(object->input_file).filename().string() : object->name;
obj_idxs.push_back(obj_count++);
@ -3575,7 +3575,7 @@ bool Plater::priv::replace_volume_with_stl(int object_idx, int volume_idx, const
old_model_object->delete_volume(old_model_object->volumes.size() - 1);
if (!sinking)
old_model_object->ensure_on_bed();
old_model_object->sort_volumes(wxGetApp().app_config->get("order_volumes") == "1");
old_model_object->sort_volumes(get_config_bool("order_volumes"));
// if object has just one volume, rename object too
if (old_model_object->volumes.size() == 1)
@ -3941,7 +3941,7 @@ void Plater::priv::reload_from_disk()
old_model_object->delete_volume(old_model_object->volumes.size() - 1);
if (!sinking)
old_model_object->ensure_on_bed();
old_model_object->sort_volumes(wxGetApp().app_config->get("order_volumes") == "1");
old_model_object->sort_volumes(get_config_bool("order_volumes"));
sla::reproject_points_and_holes(old_model_object);
@ -4021,7 +4021,7 @@ void Plater::priv::reload_from_disk()
old_model_object->delete_volume(old_model_object->volumes.size() - 1);
if (!sinking)
old_model_object->ensure_on_bed();
old_model_object->sort_volumes(wxGetApp().app_config->get("order_volumes") == "1");
old_model_object->sort_volumes(get_config_bool("order_volumes"));
sla::reproject_points_and_holes(old_model_object);
}
@ -4275,7 +4275,7 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
if ((evt.status.flags & PrintBase::SlicingStatus::UPDATE_PRINT_STEP_WARNINGS) &&
static_cast<PrintStep>(evt.status.warning_step) == psAlertWhenSupportsNeeded &&
get_app_config()->get("alert_when_supports_needed") != "1") {
!get_app_config()->get_bool("alert_when_supports_needed")) {
// This alerts are from psAlertWhenSupportsNeeded and the respective app settings is not Enabled, so discard the alerts.
} else if (evt.status.flags &
(PrintBase::SlicingStatus::UPDATE_PRINT_STEP_WARNINGS | PrintBase::SlicingStatus::UPDATE_PRINT_OBJECT_STEP_WARNINGS)) {
@ -5004,18 +5004,18 @@ bool Plater::priv::can_increase_instances() const
// Prevent strobo effect during editing emboss parameters.
if (q->canvas3D()->get_gizmos_manager().get_current_type() == GLGizmosManager::Emboss) return false;
const int obj_idx = get_selected_object_idx();
return (0 <= obj_idx) && (obj_idx < (int)model.objects.size()) &&
!sidebar->obj_list()->has_selected_cut_object();
const auto obj_idxs = get_selection().get_object_idxs();
return !obj_idxs.empty() && !sidebar->obj_list()->has_selected_cut_object();
}
bool Plater::priv::can_decrease_instances() const
bool Plater::priv::can_decrease_instances(int obj_idx /*= -1*/) const
{
if (!m_worker.is_idle()
|| q->canvas3D()->get_gizmos_manager().is_in_editing_mode())
return false;
const int obj_idx = get_selected_object_idx();
if (obj_idx < 0)
obj_idx = get_selected_object_idx();
return (0 <= obj_idx) && (obj_idx < (int)model.objects.size()) &&
(model.objects[obj_idx]->instances.size() > 1) &&
!sidebar->obj_list()->has_selected_cut_object();
@ -5054,7 +5054,7 @@ void Plater::priv::show_action_buttons(const bool ready_to_slice_) const
const bool send_gcode_shown = print_host_opt != nullptr && !print_host_opt->value.empty();
// when a background processing is ON, export_btn and/or send_btn are showing
if (wxGetApp().app_config->get("background_processing") == "1")
if (get_config_bool("background_processing"))
{
RemovableDriveManager::RemovableDrivesStatus removable_media_status = wxGetApp().removable_drive_manager()->status();
if (sidebar->show_reslice(false) |
@ -5143,7 +5143,7 @@ void Plater::priv::take_snapshot(const std::string& snapshot_name, const UndoRed
}
const GLGizmosManager& gizmos = view3D->get_canvas3d()->get_gizmos_manager();
if (snapshot_type == UndoRedo::SnapshotType::ProjectSeparator && wxGetApp().app_config->get("clear_undo_redo_stack_on_new_project") == "1")
if (snapshot_type == UndoRedo::SnapshotType::ProjectSeparator && get_config_bool("clear_undo_redo_stack_on_new_project"))
this->undo_redo_stack().clear();
this->undo_redo_stack().take_snapshot(snapshot_name, model, view3D->get_canvas3d()->get_selection(), gizmos, snapshot_data);
if (snapshot_type == UndoRedo::SnapshotType::LeavingGizmoWithAction) {
@ -5650,7 +5650,7 @@ LoadProjectsDialog::LoadProjectsDialog(const std::vector<fs::path>& paths)
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
bool contains_projects = !paths.empty();
bool instances_allowed = wxGetApp().app_config->get("single_instance") != "1";
bool instances_allowed = !wxGetApp().app_config->get_bool("single_instance");
if (contains_projects)
main_sizer->Add(new wxStaticText(this, wxID_ANY,
get_wraped_wxString(_L("There are several files being loaded, including Project files.") + "\n" + _L("Select an action to apply to all files."))), 0, wxEXPAND | wxALL, 10);
@ -5895,7 +5895,7 @@ bool Plater::preview_zip_archive(const boost::filesystem::path& archive_path)
return true;
}
// 1 model (or more and other instances are not allowed), 0 projects - open geometry
if (project_paths.empty() && (non_project_paths.size() == 1 || wxGetApp().app_config->get("single_instance") == "1"))
if (project_paths.empty() && (non_project_paths.size() == 1 || wxGetApp().app_config->get_bool("single_instance")))
{
load_files(non_project_paths, true, false);
boost::system::error_code ec;
@ -6036,7 +6036,7 @@ ProjectDropDialog::ProjectDropDialog(const std::string& filename)
{
SetFont(wxGetApp().normal_font());
bool single_instance_only = wxGetApp().app_config->get("single_instance") == "1";
bool single_instance_only = wxGetApp().app_config->get_bool("single_instance");
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
wxArrayString choices;
choices.reserve(4);
@ -6144,7 +6144,7 @@ bool Plater::load_files(const wxArrayString& filenames, bool delete_after_load/*
(boost::algorithm::iends_with(filename, ".amf") && !boost::algorithm::iends_with(filename, ".zip.amf")))
load_type = ProjectDropDialog::LoadType::LoadGeometry;
else {
if (wxGetApp().app_config->get("show_drop_project_dialog") == "1") {
if (wxGetApp().app_config->get_bool("show_drop_project_dialog")) {
ProjectDropDialog dlg(filename);
if (dlg.ShowModal() == wxID_OK) {
int choice = dlg.get_action();
@ -6273,13 +6273,14 @@ void Plater::remove_selected()
p->view3D->delete_selected();
}
void Plater::increase_instances(size_t num)
void Plater::increase_instances(size_t num, int obj_idx/* = -1*/)
{
if (! can_increase_instances()) { return; }
Plater::TakeSnapshot snapshot(this, _L("Increase Instances"));
int obj_idx = p->get_selected_object_idx();
if (obj_idx < 0)
obj_idx = p->get_selected_object_idx();
ModelObject* model_object = p->model.objects[obj_idx];
ModelInstance* model_instance = model_object->instances.back();
@ -6294,7 +6295,7 @@ void Plater::increase_instances(size_t num)
// p->print.get_object(obj_idx)->add_copy(Slic3r::to_2d(offset_vec));
}
if (p->get_config("autocenter") == "1")
if (p->get_config_bool("autocenter"))
arrange();
p->update();
@ -6307,13 +6308,14 @@ void Plater::increase_instances(size_t num)
this->p->schedule_background_process();
}
void Plater::decrease_instances(size_t num)
void Plater::decrease_instances(size_t num, int obj_idx/* = -1*/)
{
if (! can_decrease_instances()) { return; }
if (! can_decrease_instances(obj_idx)) { return; }
Plater::TakeSnapshot snapshot(this, _L("Decrease Instances"));
int obj_idx = p->get_selected_object_idx();
if (obj_idx < 0)
obj_idx = p->get_selected_object_idx();
ModelObject* model_object = p->model.objects[obj_idx];
if (model_object->instances.size() > num) {
@ -6354,26 +6356,27 @@ static long GetNumberFromUser( const wxString& msg,
#endif
}
void Plater::set_number_of_copies(/*size_t num*/)
void Plater::set_number_of_copies()
{
int obj_idx = p->get_selected_object_idx();
if (obj_idx == -1)
const auto obj_idxs = get_selection().get_object_idxs();
if (obj_idxs.empty())
return;
ModelObject* model_object = p->model.objects[obj_idx];
const size_t init_cnt = obj_idxs.size() == 1 ? p->model.objects[*obj_idxs.begin()]->instances.size() : 1;
const int num = GetNumberFromUser( " ", _L("Enter the number of copies:"),
_L("Copies of the selected object"), model_object->instances.size(), 0, 1000, this );
_L("Copies of the selected object"), init_cnt, 0, 1000, this );
if (num < 0)
return;
TakeSnapshot snapshot(this, wxString::Format(_L("Set numbers of copies to %d"), num));
Plater::TakeSnapshot snapshot(this, wxString::Format(_L("Set numbers of copies to %d"), num));
int diff = num - (int)model_object->instances.size();
if (diff > 0)
increase_instances(diff);
else if (diff < 0)
decrease_instances(-diff);
for (const auto obj_idx : obj_idxs) {
ModelObject* model_object = p->model.objects[obj_idx];
const int diff = num - (int)model_object->instances.size();
if (diff > 0)
increase_instances(diff, int(obj_idx));
else if (diff < 0)
decrease_instances(-diff, int(obj_idx));
}
}
void Plater::fill_bed_with_instances()
@ -6711,7 +6714,7 @@ void Plater::export_amf()
wxBusyCursor wait;
bool export_config = true;
DynamicPrintConfig cfg = wxGetApp().preset_bundle->full_config_secure();
bool full_pathnames = wxGetApp().app_config->get("export_sources_full_pathnames") == "1";
bool full_pathnames = wxGetApp().app_config->get_bool("export_sources_full_pathnames");
if (Slic3r::store_amf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, full_pathnames)) {
// Success
// p->statusbar()->set_status_text(format_wxstr(_L("AMF file exported to %s"), path));
@ -6744,7 +6747,7 @@ bool Plater::export_3mf(const boost::filesystem::path& output_path)
DynamicPrintConfig cfg = wxGetApp().preset_bundle->full_config_secure();
const std::string path_u8 = into_u8(path);
wxBusyCursor wait;
bool full_pathnames = wxGetApp().app_config->get("export_sources_full_pathnames") == "1";
bool full_pathnames = wxGetApp().app_config->get_bool("export_sources_full_pathnames");
ThumbnailData thumbnail_data;
ThumbnailsParams thumbnail_params = { {}, false, true, true, true };
p->generate_thumbnail(thumbnail_data, THUMBNAIL_SIZE_3MF.first, THUMBNAIL_SIZE_3MF.second, thumbnail_params, Camera::EType::Ortho);
@ -7665,7 +7668,7 @@ void Plater::init_notification_manager()
bool Plater::can_delete() const { return p->can_delete(); }
bool Plater::can_delete_all() const { return p->can_delete_all(); }
bool Plater::can_increase_instances() const { return p->can_increase_instances(); }
bool Plater::can_decrease_instances() const { return p->can_decrease_instances(); }
bool Plater::can_decrease_instances(int obj_idx/* = -1*/) const { return p->can_decrease_instances(obj_idx); }
bool Plater::can_set_instance_to_object() const { return p->can_set_instance_to_object(); }
bool Plater::can_fix_through_netfabb() const { return p->can_fix_through_netfabb(); }
bool Plater::can_simplify() const { return p->can_simplify(); }

View File

@ -249,9 +249,9 @@ public:
void reset_with_confirm();
bool delete_object_from_model(size_t obj_idx);
void remove_selected();
void increase_instances(size_t num = 1);
void decrease_instances(size_t num = 1);
void set_number_of_copies(/*size_t num*/);
void increase_instances(size_t num = 1, int obj_idx = -1);
void decrease_instances(size_t num = 1, int obj_idx = -1);
void set_number_of_copies();
void fill_bed_with_instances();
bool is_selection_empty() const;
void scale_selection_to_fit_print_volume();
@ -350,7 +350,7 @@ public:
bool can_delete() const;
bool can_delete_all() const;
bool can_increase_instances() const;
bool can_decrease_instances() const;
bool can_decrease_instances(int obj_idx = -1) const;
bool can_set_instance_to_object() const;
bool can_fix_through_netfabb() const;
bool can_simplify() const;

View File

@ -87,7 +87,7 @@ void PreferencesDialog::show(const std::string& highlight_opt_key /*= std::strin
// cache input values for custom toolbar size
m_custom_toolbar_size = atoi(get_app_config()->get("custom_toolbar_size").c_str());
m_use_custom_toolbar_size = get_app_config()->get("use_custom_toolbar_size") == "1";
m_use_custom_toolbar_size = get_app_config()->get_bool("use_custom_toolbar_size");
// set Field for notify_release to its value
if (m_optgroup_gui && m_optgroup_gui->get_field("notify_release") != nullptr) {
@ -100,10 +100,10 @@ void PreferencesDialog::show(const std::string& highlight_opt_key /*= std::strin
auto app_config = get_app_config();
downloader->set_path_name(app_config->get("url_downloader_dest"));
downloader->allow(!app_config->has("downloader_url_registered") || app_config->get("downloader_url_registered") == "1");
downloader->allow(!app_config->has("downloader_url_registered") || app_config->get_bool("downloader_url_registered"));
for (const std::string& opt_key : {"suppress_hyperlinks", "downloader_url_registered"})
m_optgroup_other->set_value(opt_key, app_config->get(opt_key) == "1");
m_optgroup_other->set_value(opt_key, app_config->get_bool(opt_key));
// update colors for color pickers of the labels
update_color(m_sys_colour, wxGetApp().get_label_clr_sys());
@ -257,25 +257,25 @@ void PreferencesDialog::build()
append_bool_option(m_optgroup_general, "remember_output_path",
L("Remember output directory"),
L("If this is enabled, Slic3r will prompt the last output directory instead of the one containing the input files."),
app_config->has("remember_output_path") ? app_config->get("remember_output_path") == "1" : true);
app_config->has("remember_output_path") ? app_config->get_bool("remember_output_path") : true);
append_bool_option(m_optgroup_general, "autocenter",
L("Auto-center parts"),
L("If this is enabled, Slic3r will auto-center objects around the print bed center."),
app_config->get("autocenter") == "1");
app_config->get_bool("autocenter"));
append_bool_option(m_optgroup_general, "background_processing",
L("Background processing"),
L("If this is enabled, Slic3r will pre-process objects as soon "
"as they\'re loaded in order to save time when exporting G-code."),
app_config->get("background_processing") == "1");
app_config->get_bool("background_processing"));
append_bool_option(m_optgroup_general, "alert_when_supports_needed",
L("Alert when supports needed"),
L("If this is enabled, Slic3r will raise alerts when it detects "
"issues in the sliced object, that can be resolved with supports (and brim). "
"Examples of such issues are floating object parts, unsupported extrusions and low bed adhesion."),
app_config->get("alert_when_supports_needed") == "1");
app_config->get_bool("alert_when_supports_needed"));
m_optgroup_general->append_separator();
@ -284,19 +284,19 @@ void PreferencesDialog::build()
append_bool_option(m_optgroup_general, "export_sources_full_pathnames",
L("Export sources full pathnames to 3mf and amf"),
L("If enabled, allows the Reload from disk command to automatically find and load the files when invoked."),
app_config->get("export_sources_full_pathnames") == "1");
app_config->get_bool("export_sources_full_pathnames"));
#ifdef _WIN32
// Please keep in sync with ConfigWizard
append_bool_option(m_optgroup_general, "associate_3mf",
L("Associate .3mf files to PrusaSlicer"),
L("If enabled, sets PrusaSlicer as default application to open .3mf files."),
app_config->get("associate_3mf") == "1");
app_config->get_bool("associate_3mf"));
append_bool_option(m_optgroup_general, "associate_stl",
L("Associate .stl files to PrusaSlicer"),
L("If enabled, sets PrusaSlicer as default application to open .stl files."),
app_config->get("associate_stl") == "1");
app_config->get_bool("associate_stl"));
#endif // _WIN32
m_optgroup_general->append_separator();
@ -306,23 +306,23 @@ void PreferencesDialog::build()
L("Update built-in Presets automatically"),
L("If enabled, Slic3r downloads updates of built-in system presets in the background. These updates are downloaded "
"into a separate temporary location. When a new preset version becomes available it is offered at application startup."),
app_config->get("preset_update") == "1");
app_config->get_bool("preset_update"));
append_bool_option(m_optgroup_general, "no_defaults",
L("Suppress \" - default - \" presets"),
L("Suppress \" - default - \" presets in the Print / Filament / Printer selections once there are any other valid presets available."),
app_config->get("no_defaults") == "1");
app_config->get_bool("no_defaults"));
append_bool_option(m_optgroup_general, "no_templates",
L("Suppress \" Template \" filament presets"),
L("Suppress \" Template \" filament presets in configuration wizard and sidebar visibility."),
app_config->get("no_templates") == "1");
app_config->get_bool("no_templates"));
append_bool_option(m_optgroup_general, "show_incompatible_presets",
L("Show incompatible print and filament presets"),
L("When checked, the print and filament presets are shown in the preset editor "
"even if they are marked as incompatible with the active printer"),
app_config->get("show_incompatible_presets") == "1");
app_config->get_bool("show_incompatible_presets"));
m_optgroup_general->append_separator();
@ -335,7 +335,7 @@ void PreferencesDialog::build()
L("Show drop project dialog"),
L("When checked, whenever dragging and dropping a project file on the application, shows a dialog asking to select the action to take on the file to load."),
#endif
app_config->get("show_drop_project_dialog") == "1");
app_config->get_bool("show_drop_project_dialog"));
append_bool_option(m_optgroup_general, "single_instance",
#if __APPLE__
@ -346,7 +346,7 @@ void PreferencesDialog::build()
L("Allow just a single PrusaSlicer instance"),
L("If this is enabled, when starting PrusaSlicer and another instance of the same PrusaSlicer is already running, that instance will be reactivated instead."),
#endif
app_config->has("single_instance") ? app_config->get("single_instance") == "1" : false );
app_config->has("single_instance") ? app_config->get_bool("single_instance") : false );
m_optgroup_general->append_separator();
@ -381,7 +381,7 @@ void PreferencesDialog::build()
append_bool_option(m_optgroup_general, "associate_gcode",
L("Associate .gcode files to PrusaSlicer G-code Viewer"),
L("If enabled, sets PrusaSlicer G-code Viewer as default application to open .gcode files."),
app_config->get("associate_gcode") == "1");
app_config->get_bool("associate_gcode"));
}
#endif // _WIN32
@ -390,7 +390,7 @@ void PreferencesDialog::build()
L("Use Retina resolution for the 3D scene"),
L("If enabled, the 3D scene will be rendered in Retina resolution. "
"If you are experiencing 3D performance problems, disabling this option may help."),
app_config->get("use_retina_opengl") == "1");
app_config->get_bool("use_retina_opengl"));
#endif
m_optgroup_general->append_separator();
@ -399,24 +399,24 @@ void PreferencesDialog::build()
append_bool_option(m_optgroup_general, "show_splash_screen",
L("Show splash screen"),
L("Show splash screen"),
app_config->get("show_splash_screen") == "1");
app_config->get_bool("show_splash_screen"));
append_bool_option(m_optgroup_general, "restore_win_position",
L("Restore window position on start"),
L("If enabled, PrusaSlicer will be open at the position it was closed"),
app_config->get("restore_win_position") == "1");
app_config->get_bool("restore_win_position"));
// Clear Undo / Redo stack on new project
append_bool_option(m_optgroup_general, "clear_undo_redo_stack_on_new_project",
L("Clear Undo / Redo stack on new project"),
L("Clear Undo / Redo stack on new project or when an existing project is loaded."),
app_config->get("clear_undo_redo_stack_on_new_project") == "1");
app_config->get_bool("clear_undo_redo_stack_on_new_project"));
#if defined(_WIN32) || defined(__APPLE__)
append_bool_option(m_optgroup_general, "use_legacy_3DConnexion",
L("Enable support for legacy 3DConnexion devices"),
L("If enabled, the legacy 3DConnexion devices settings dialog is available by pressing CTRL+M"),
app_config->get("use_legacy_3DConnexion") == "1");
app_config->get_bool("use_legacy_3DConnexion"));
#endif // _WIN32 || __APPLE__
activate_options_tab(m_optgroup_general);
@ -434,17 +434,17 @@ void PreferencesDialog::build()
append_bool_option(m_optgroup_camera, "use_perspective_camera",
L("Use perspective camera"),
L("If enabled, use perspective camera. If not enabled, use orthographic camera."),
app_config->get("use_perspective_camera") == "1");
app_config->get_bool("use_perspective_camera"));
append_bool_option(m_optgroup_camera, "use_free_camera",
L("Use free camera"),
L("If enabled, use free camera. If not enabled, use constrained camera."),
app_config->get("use_free_camera") == "1");
app_config->get_bool("use_free_camera"));
append_bool_option(m_optgroup_camera, "reverse_mouse_wheel_zoom",
L("Reverse direction of zoom with mouse wheel"),
L("If enabled, reverses the direction of zoom with mouse wheel"),
app_config->get("reverse_mouse_wheel_zoom") == "1");
app_config->get_bool("reverse_mouse_wheel_zoom"));
activate_options_tab(m_optgroup_camera);
@ -492,48 +492,48 @@ void PreferencesDialog::build()
L("Sequential slider applied only to top layer"),
L("If enabled, changes made using the sequential slider, in preview, apply only to gcode top layer."
"If disabled, changes made using the sequential slider, in preview, apply to the whole gcode."),
app_config->get("seq_top_layer_only") == "1");
app_config->get_bool("seq_top_layer_only"));
if (is_editor) {
append_bool_option(m_optgroup_gui, "show_collapse_button",
L("Show sidebar collapse/expand button"),
L("If enabled, the button for the collapse sidebar will be appeared in top right corner of the 3D Scene"),
app_config->get("show_collapse_button") == "1");
app_config->get_bool("show_collapse_button"));
/*
append_bool_option(m_optgroup_gui, "suppress_hyperlinks",
L("Suppress to open hyperlink in browser"),
L("If enabled, PrusaSlicer will not open a hyperlinks in your browser."),
//L("If enabled, the descriptions of configuration parameters in settings tabs wouldn't work as hyperlinks. "
// "If disabled, the descriptions of configuration parameters in settings tabs will work as hyperlinks."),
app_config->get("suppress_hyperlinks") == "1");
app_config->get_bool("suppress_hyperlinks"));
*/
append_bool_option(m_optgroup_gui, "color_mapinulation_panel",
L("Use colors for axes values in Manipulation panel"),
L("If enabled, the axes names and axes values will be colorized according to the axes colors. "
"If disabled, old UI will be used."),
app_config->get("color_mapinulation_panel") == "1");
app_config->get_bool("color_mapinulation_panel"));
append_bool_option(m_optgroup_gui, "order_volumes",
L("Order object volumes by types"),
L("If enabled, volumes will be always ordered inside the object. Correct order is Model Part, Negative Volume, Modifier, Support Blocker and Support Enforcer. "
"If disabled, you can reorder Model Parts, Negative Volumes and Modifiers. But one of the model parts have to be on the first place."),
app_config->get("order_volumes") == "1");
app_config->get_bool("order_volumes"));
append_bool_option(m_optgroup_gui, "non_manifold_edges",
L("Show non-manifold edges"),
L("If enabled, shows non-manifold edges."),
app_config->get("non_manifold_edges") == "1");
app_config->get_bool("non_manifold_edges"));
append_bool_option(m_optgroup_gui, "allow_auto_color_change",
L("Allow automatically color change"),
L("If enabled, related notification will be shown, when sliced object looks like a logo or a sign."),
app_config->get("allow_auto_color_change") == "1");
app_config->get_bool("allow_auto_color_change"));
#ifdef _MSW_DARK_MODE
append_bool_option(m_optgroup_gui, "tabs_as_menu",
L("Set settings tabs as menu items (experimental)"),
L("If enabled, Settings Tabs will be placed as menu items. If disabled, old UI will be used."),
app_config->get("tabs_as_menu") == "1");
app_config->get_bool("tabs_as_menu"));
#endif
m_optgroup_gui->append_separator();
@ -541,7 +541,7 @@ void PreferencesDialog::build()
append_bool_option(m_optgroup_gui, "show_hints",
L("Show \"Tip of the day\" notification after start"),
L("If enabled, useful hints are displayed at startup."),
app_config->get("show_hints") == "1");
app_config->get_bool("show_hints"));
append_enum_option<NotifyReleaseMode>(m_optgroup_gui, "notify_release",
L("Notify about new releases"),
@ -557,7 +557,7 @@ void PreferencesDialog::build()
append_bool_option(m_optgroup_gui, "use_custom_toolbar_size",
L("Use custom size for toolbar icons"),
L("If enabled, you can change size of toolbar icons manually."),
app_config->get("use_custom_toolbar_size") == "1");
app_config->get_bool("use_custom_toolbar_size"));
}
activate_options_tab(m_optgroup_gui);
@ -568,7 +568,7 @@ void PreferencesDialog::build()
m_optgroup_gui->get_field("notify_release")->set_value(val, false);
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_bool("use_custom_toolbar_size"));
create_settings_mode_widget();
create_settings_text_color_widget();
@ -594,12 +594,12 @@ void PreferencesDialog::build()
L("If enabled, PrusaSlicer will not open a hyperlinks in your browser."),
//L("If enabled, the descriptions of configuration parameters in settings tabs wouldn't work as hyperlinks. "
// "If disabled, the descriptions of configuration parameters in settings tabs will work as hyperlinks."),
app_config->get("suppress_hyperlinks") == "1");
app_config->get_bool("suppress_hyperlinks"));
append_bool_option(m_optgroup_other, "downloader_url_registered",
L("Allow downloads from Printables.com"),
L("If enabled, PrusaSlicer will allow to download from Printables.com"),
app_config->get("downloader_url_registered") == "1");
app_config->get_bool("downloader_url_registered"));
activate_options_tab(m_optgroup_other);
@ -619,7 +619,7 @@ void PreferencesDialog::build()
append_bool_option(m_optgroup_render, "use_environment_map",
L("Use environment map"),
L("If enabled, renders object using the environment map."),
app_config->get("use_environment_map") == "1");
app_config->get_bool("use_environment_map"));
activate_options_tab(m_optgroup_render);
#endif // ENABLE_ENVIRONMENT_MAP
@ -638,7 +638,7 @@ void PreferencesDialog::build()
append_bool_option(m_optgroup_dark_mode, "dark_color_mode",
L("Enable dark mode"),
L("If enabled, UI will use Dark mode colors. If disabled, old UI will be used."),
app_config->get("dark_color_mode") == "1");
app_config->get_bool("dark_color_mode"));
if (wxPlatformInfo::Get().GetOSMajorVersion() >= 10) // Use system menu just for Window newer then Windows 10
// Use menu with ownerdrawn items by default on systems older then Windows 10
@ -647,7 +647,7 @@ void PreferencesDialog::build()
L("Use system menu for application"),
L("If enabled, application will use the standart Windows system menu,\n"
"but on some combination od display scales it can look ugly. If disabled, old UI will be used."),
app_config->get("sys_menu_enabled") == "1");
app_config->get_bool("sys_menu_enabled"));
}
activate_options_tab(m_optgroup_dark_mode);
@ -799,7 +799,7 @@ void PreferencesDialog::revert(wxEvent&)
app_config->set("custom_toolbar_size", (boost::format("%d") % m_custom_toolbar_size).str());
m_icon_size_slider->SetValue(m_custom_toolbar_size);
}
if (m_use_custom_toolbar_size != (get_app_config()->get("use_custom_toolbar_size") == "1")) {
if (m_use_custom_toolbar_size != (get_app_config()->get_bool("use_custom_toolbar_size"))) {
app_config->set("use_custom_toolbar_size", m_use_custom_toolbar_size ? "1" : "0");
m_optgroup_gui->set_value("use_custom_toolbar_size", m_use_custom_toolbar_size);
@ -823,17 +823,17 @@ void PreferencesDialog::revert(wxEvent&)
continue;
}
if (key == "old_settings_layout_mode") {
m_rb_old_settings_layout_mode->SetValue(app_config->get(key) == "1");
m_rb_old_settings_layout_mode->SetValue(app_config->get_bool(key));
m_settings_layout_changed = false;
continue;
}
if (key == "new_settings_layout_mode") {
m_rb_new_settings_layout_mode->SetValue(app_config->get(key) == "1");
m_rb_new_settings_layout_mode->SetValue(app_config->get_bool(key));
m_settings_layout_changed = false;
continue;
}
if (key == "dlg_settings_layout_mode") {
m_rb_dlg_settings_layout_mode->SetValue(app_config->get(key) == "1");
m_rb_dlg_settings_layout_mode->SetValue(app_config->get_bool(key));
m_settings_layout_changed = false;
continue;
}
@ -846,11 +846,11 @@ void PreferencesDialog::revert(wxEvent&)
, m_optgroup_render
#endif // ENABLE_ENVIRONMENT_MAP
}) {
if (opt_group->set_value(key, app_config->get(key) == "1"))
if (opt_group->set_value(key, app_config->get_bool(key)))
break;
}
if (key == "tabs_as_menu") {
m_rb_new_settings_layout_mode->Show(app_config->get(key) != "1");
m_rb_new_settings_layout_mode->Show(!app_config->get_bool(key));
refresh_og(m_optgroup_gui);
continue;
}
@ -993,12 +993,12 @@ void PreferencesDialog::create_settings_mode_widget()
});
};
add_radio(&m_rb_old_settings_layout_mode, ++id, app_config->get("old_settings_layout_mode") == "1");
add_radio(&m_rb_new_settings_layout_mode, ++id, app_config->get("new_settings_layout_mode") == "1");
add_radio(&m_rb_dlg_settings_layout_mode, ++id, app_config->get("dlg_settings_layout_mode") == "1");
add_radio(&m_rb_old_settings_layout_mode, ++id, app_config->get_bool("old_settings_layout_mode"));
add_radio(&m_rb_new_settings_layout_mode, ++id, app_config->get_bool("new_settings_layout_mode"));
add_radio(&m_rb_dlg_settings_layout_mode, ++id, app_config->get_bool("dlg_settings_layout_mode"));
#ifdef _MSW_DARK_MODE
if (app_config->get("tabs_as_menu") == "1") {
if (app_config->get_bool("tabs_as_menu")) {
m_rb_new_settings_layout_mode->Hide();
if (m_rb_new_settings_layout_mode->GetValue()) {
m_rb_new_settings_layout_mode->SetValue(false);

View File

@ -2145,6 +2145,16 @@ std::vector<unsigned int> Selection::get_unselected_volume_idxs_from(const std::
return idxs;
}
std::set<unsigned int> Selection::get_object_idxs() const
{
std::set<unsigned int> idxs;
for (unsigned int i : m_list)
idxs.emplace((*m_volumes)[i]->object_idx());
return idxs;
}
void Selection::update_valid()
{
m_valid = (m_volumes != nullptr) && (m_model != nullptr);

View File

@ -453,6 +453,8 @@ public:
std::vector<unsigned int> get_missing_volume_idxs_from(const std::vector<unsigned int>& volume_idxs) const;
// returns the list of idxs of the volumes contained in the given list but not in the selection
std::vector<unsigned int> get_unselected_volume_idxs_from(const std::vector<unsigned int>& volume_idxs) const;
// returns the list of idxs of the objects which are in the selection
std::set<unsigned int> get_object_idxs() const;
#if ENABLE_WORLD_COORDINATE_DEBUG
void render_debug_window() const;

View File

@ -1526,7 +1526,7 @@ void TabPrint::build()
optgroup->append_single_option_line("dont_support_bridges", category_path + "dont-support-bridges");
optgroup->append_single_option_line("support_material_synchronize_layers", category_path + "synchronize-with-object-layers");
optgroup = page->new_optgroup(L("Tree supports"));
optgroup = page->new_optgroup(L("Organic supports"));
optgroup->append_single_option_line("support_tree_angle", category_path + "tree_angle");
optgroup->append_single_option_line("support_tree_angle_slow", category_path + "tree_angle_slow");
optgroup->append_single_option_line("support_tree_branch_diameter", category_path + "tree_branch_diameter");

View File

@ -300,7 +300,7 @@ bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Erro
boost::asio::ip::address host_ip = boost::asio::ip::make_address(host, ec);
if (!ec) {
resolved_addr.push_back(host_ip);
} else if ( GUI::get_app_config()->get("allow_ip_resolve") == "1" && boost::algorithm::ends_with(host, ".local")){
} else if ( GUI::get_app_config()->get_bool("allow_ip_resolve") && boost::algorithm::ends_with(host, ".local")){
Bonjour("octoprint")
.set_hostname(host)
.set_retries(5) // number of rounds of queries send
@ -428,7 +428,7 @@ bool OctoPrint::upload_inner_with_host(PrintHostUpload upload_data, ProgressFn p
#ifdef WIN32
// Workaround for Windows 10/11 mDNS resolve issue, where two mDNS resolves in succession fail.
if (m_host.find("https://") == 0 || test_msg_or_host_ip.empty() || GUI::get_app_config()->get("allow_ip_resolve") != "1")
if (m_host.find("https://") == 0 || test_msg_or_host_ip.empty() || !GUI::get_app_config()->get_bool("allow_ip_resolve"))
#endif // _WIN32
{
// If https is entered we assume signed ceritificate is being used
@ -972,7 +972,7 @@ bool PrusaLink::upload_inner_with_host(PrintHostUpload upload_data, ProgressFn p
storage_path += (upload_data.storage.empty() ? "/local" : upload_data.storage);
#ifdef WIN32
// Workaround for Windows 10/11 mDNS resolve issue, where two mDNS resolves in succession fail.
if (m_host.find("https://") == 0 || test_msg_or_host_ip.empty() || GUI::get_app_config()->get("allow_ip_resolve") != "1")
if (m_host.find("https://") == 0 || test_msg_or_host_ip.empty() || !GUI::get_app_config()->get_bool("allow_ip_resolve"))
#endif // _WIN32
{
// If https is entered we assume signed ceritificate is being used

View File

@ -213,7 +213,7 @@ void PresetUpdater::priv::set_download_prefs(const AppConfig *app_config)
{
enabled_version_check = app_config->get("notify_release") != "none";
version_check_url = app_config->version_check_url();
enabled_config_update = app_config->get("preset_update") == "1" && !app_config->legacy_datadir();
enabled_config_update = app_config->get_bool("preset_update") && !app_config->legacy_datadir();
}
// Downloads a file (http get operation). Cancels if the Updater is being destroyed.
@ -1168,7 +1168,7 @@ void PresetUpdater::slic3r_update_notify()
static bool reload_configs_update_gui()
{
wxString header = _L("Configuration Updates causes a lost of preset modification.\n"
wxString header = _L("Configuration Updates causes a loss of preset modification.\n"
"So, check unsaved changes and save them if necessary.");
if (!GUI::wxGetApp().check_and_save_current_preset_changes(_L("Updating"), header, false ))
return false;