Merge branch 'master' of https://github.com/prusa3d/Slic3r into et_copy_and_paste
This commit is contained in:
commit
e785709b91
File diff suppressed because it is too large
Load Diff
@ -323,7 +323,7 @@ PagePrinters::PagePrinters(ConfigWizard *parent, wxString title, wxString shortn
|
|||||||
COL_SIZE = 200,
|
COL_SIZE = 200,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool check_first_variant = wizard_p()->check_first_variant();
|
bool check_first_variant = technology == T_FFF && wizard_p()->check_first_variant();
|
||||||
|
|
||||||
AppConfig &appconfig_vendors = this->wizard_p()->appconfig_vendors;
|
AppConfig &appconfig_vendors = this->wizard_p()->appconfig_vendors;
|
||||||
|
|
||||||
@ -1062,7 +1062,7 @@ void ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
|
|||||||
// Public
|
// Public
|
||||||
|
|
||||||
ConfigWizard::ConfigWizard(wxWindow *parent, RunReason reason)
|
ConfigWizard::ConfigWizard(wxWindow *parent, RunReason reason)
|
||||||
: DPIDialog(parent, wxID_ANY, _(name().ToStdString()), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
: DPIDialog(parent, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _(name().ToStdString()), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
, p(new priv(this))
|
, p(new priv(this))
|
||||||
{
|
{
|
||||||
this->SetFont(wxGetApp().normal_font());
|
this->SetFont(wxGetApp().normal_font());
|
||||||
|
@ -3612,7 +3612,8 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: calculate a tighter value for depth will improve z-fighting
|
// FIXME: calculate a tighter value for depth will improve z-fighting
|
||||||
float depth = 5.0f * (float)bbox.max_size();
|
// Set at least some minimum depth in case the bounding box is empty to avoid an OpenGL driver error.
|
||||||
|
float depth = std::max(1.f, 5.0f * (float)bbox.max_size());
|
||||||
m_camera.apply_ortho_projection(-w2, w2, -h2, h2, -depth, depth);
|
m_camera.apply_ortho_projection(-w2, w2, -h2, h2, -depth, depth);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include "GUI_ObjectManipulation.hpp"
|
#include "GUI_ObjectManipulation.hpp"
|
||||||
#include "I18N.hpp"
|
#include "I18N.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <iterator>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
@ -21,6 +23,7 @@
|
|||||||
#include <wx/sysopt.h>
|
#include <wx/sysopt.h>
|
||||||
#include <wx/msgdlg.h>
|
#include <wx/msgdlg.h>
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
|
#include <wx/intl.h>
|
||||||
|
|
||||||
#include "libslic3r/Utils.hpp"
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "libslic3r/Model.hpp"
|
#include "libslic3r/Model.hpp"
|
||||||
@ -255,7 +258,7 @@ bool GUI_App::on_init_inner()
|
|||||||
|
|
||||||
CallAfter([this] {
|
CallAfter([this] {
|
||||||
if (!config_wizard_startup(app_conf_exists)) {
|
if (!config_wizard_startup(app_conf_exists)) {
|
||||||
// Only notify if there was not wizard so as not to bother too much ...
|
// Only notify if there was no wizard so as not to bother too much ...
|
||||||
preset_updater->slic3r_update_notify();
|
preset_updater->slic3r_update_notify();
|
||||||
}
|
}
|
||||||
preset_updater->sync(preset_bundle);
|
preset_updater->sync(preset_bundle);
|
||||||
@ -518,67 +521,106 @@ void GUI_App::import_model(wxWindow *parent, wxArrayString& input_files)
|
|||||||
dialog.GetPaths(input_files);
|
dialog.GetPaths(input_files);
|
||||||
}
|
}
|
||||||
|
|
||||||
// select language from the list of installed languages
|
bool GUI_App::switch_language()
|
||||||
bool GUI_App::select_language( wxArrayString & names,
|
|
||||||
wxArrayLong & identifiers)
|
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(names.Count() == identifiers.Count(), false,
|
if (select_language()) {
|
||||||
_(L("Array of language names and identifiers should have the same size.")));
|
save_language();
|
||||||
int init_selection = 0;
|
_3DScene::remove_all_canvases();
|
||||||
long current_language = m_wxLocale ? m_wxLocale->GetLanguage() : wxLANGUAGE_UNKNOWN;
|
recreate_GUI();
|
||||||
for (auto lang : identifiers) {
|
return true;
|
||||||
if (lang == current_language)
|
} else {
|
||||||
break;
|
return false;
|
||||||
++init_selection;
|
|
||||||
}
|
}
|
||||||
if (init_selection == identifiers.size())
|
}
|
||||||
init_selection = 0;
|
|
||||||
long index = wxGetSingleChoiceIndex(_(L("Select the language")), _(L("Language")),
|
// select language from the list of installed languages
|
||||||
names, init_selection);
|
bool GUI_App::select_language()
|
||||||
if (index != -1)
|
|
||||||
{
|
{
|
||||||
m_wxLocale = new wxLocale;
|
const auto langs = get_installed_languages();
|
||||||
m_wxLocale->Init(identifiers[index]);
|
wxArrayString names;
|
||||||
|
names.Alloc(langs.size());
|
||||||
|
|
||||||
|
int init_selection = -1;
|
||||||
|
const auto current_language = m_wxLocale ? m_wxLocale->GetLanguage() : wxLocale::GetSystemLanguage();
|
||||||
|
|
||||||
|
for (size_t i = 0; i < langs.size(); i++) {
|
||||||
|
const auto lang = langs[i]->Language;
|
||||||
|
const bool is_english = lang >= wxLANGUAGE_ENGLISH && lang <= wxLANGUAGE_ENGLISH_ZIMBABWE;
|
||||||
|
|
||||||
|
if (lang == current_language || (current_language == wxLANGUAGE_UNKNOWN && is_english)) {
|
||||||
|
init_selection = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
names.Add(langs[i]->Description);
|
||||||
|
}
|
||||||
|
|
||||||
|
const long index = wxGetSingleChoiceIndex(
|
||||||
|
_(L("Select the language")),
|
||||||
|
_(L("Language")), names, init_selection >= 0 ? init_selection : 0);
|
||||||
|
|
||||||
|
if (index != -1) {
|
||||||
|
const wxLanguageInfo *lang = langs[index];
|
||||||
|
if (lang->Language == current_language) {
|
||||||
|
// There was no change
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_wxLocale = new wxLocale; // FIXME: leak?
|
||||||
|
m_wxLocale->Init(lang->Language);
|
||||||
m_wxLocale->AddCatalogLookupPathPrefix(from_u8(localization_dir()));
|
m_wxLocale->AddCatalogLookupPathPrefix(from_u8(localization_dir()));
|
||||||
m_wxLocale->AddCatalog("Slic3rPE");
|
m_wxLocale->AddCatalog("Slic3rPE");
|
||||||
//FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only.
|
//FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only.
|
||||||
wxSetlocale(LC_NUMERIC, "C");
|
wxSetlocale(LC_NUMERIC, "C");
|
||||||
Preset::update_suffix_modified();
|
Preset::update_suffix_modified();
|
||||||
m_imgui->set_language(m_wxLocale->GetCanonicalName().ToUTF8().data());
|
m_imgui->set_language(into_u8(lang->CanonicalName));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// load language saved at application config
|
// Load gettext translation files and activate them at the start of the application,
|
||||||
|
// based on the "translation_language" key stored in the application config.
|
||||||
bool GUI_App::load_language()
|
bool GUI_App::load_language()
|
||||||
{
|
{
|
||||||
wxString language = wxEmptyString;
|
wxString language = wxEmptyString;
|
||||||
if (app_config->has("translation_language"))
|
if (app_config->has("translation_language"))
|
||||||
language = app_config->get("translation_language");
|
language = app_config->get("translation_language");
|
||||||
|
|
||||||
if (language.IsEmpty())
|
if (language.IsEmpty()) {
|
||||||
return false;
|
int lang = wxLocale::GetSystemLanguage();
|
||||||
wxArrayString names;
|
if (lang != wxLANGUAGE_UNKNOWN) {
|
||||||
wxArrayLong identifiers;
|
const wxLanguageInfo *info = wxLocale::GetLanguageInfo(lang);
|
||||||
get_installed_languages(names, identifiers);
|
if (info != nullptr)
|
||||||
for (size_t i = 0; i < identifiers.Count(); i++)
|
language = info->CanonicalName;
|
||||||
{
|
}
|
||||||
if (wxLocale::GetLanguageCanonicalName(identifiers[i]) == language)
|
}
|
||||||
{
|
|
||||||
|
const wxLanguageInfo *info = nullptr;
|
||||||
|
if (! language.IsEmpty()) {
|
||||||
|
const auto langs = get_installed_languages();
|
||||||
|
for (const wxLanguageInfo *this_info : langs)
|
||||||
|
if (this_info->CanonicalName == language) {
|
||||||
|
info = this_info;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_wxLocale = new wxLocale;
|
m_wxLocale = new wxLocale;
|
||||||
m_wxLocale->Init(identifiers[i]);
|
if (info == nullptr) {
|
||||||
|
m_wxLocale->Init(wxLANGUAGE_DEFAULT);
|
||||||
|
m_imgui->set_language("en");
|
||||||
|
} else {
|
||||||
|
m_wxLocale->Init(info->Language);
|
||||||
m_wxLocale->AddCatalogLookupPathPrefix(from_u8(localization_dir()));
|
m_wxLocale->AddCatalogLookupPathPrefix(from_u8(localization_dir()));
|
||||||
m_wxLocale->AddCatalog("Slic3rPE");
|
m_wxLocale->AddCatalog("Slic3rPE");
|
||||||
|
m_imgui->set_language(into_u8(info->CanonicalName));
|
||||||
|
}
|
||||||
//FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only.
|
//FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only.
|
||||||
wxSetlocale(LC_NUMERIC, "C");
|
wxSetlocale(LC_NUMERIC, "C");
|
||||||
Preset::update_suffix_modified();
|
Preset::update_suffix_modified();
|
||||||
m_imgui->set_language(m_wxLocale->GetCanonicalName().ToUTF8().data());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// save language at application config
|
// save language at application config
|
||||||
void GUI_App::save_language()
|
void GUI_App::save_language()
|
||||||
@ -591,36 +633,31 @@ void GUI_App::save_language()
|
|||||||
app_config->save();
|
app_config->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
// get list of installed languages
|
// Get a list of installed languages
|
||||||
void GUI_App::get_installed_languages(wxArrayString & names, wxArrayLong & identifiers)
|
std::vector<const wxLanguageInfo*> GUI_App::get_installed_languages()
|
||||||
{
|
{
|
||||||
names.Clear();
|
std::vector<const wxLanguageInfo*> res;
|
||||||
identifiers.Clear();
|
|
||||||
|
|
||||||
wxDir dir(from_u8(localization_dir()));
|
wxDir dir(from_u8(localization_dir()));
|
||||||
wxString filename;
|
wxString filename;
|
||||||
const wxLanguageInfo * langinfo;
|
const wxLanguageInfo * langinfo;
|
||||||
wxString name = wxLocale::GetLanguageName(wxLANGUAGE_DEFAULT);
|
wxString name = wxLocale::GetLanguageName(wxLANGUAGE_DEFAULT);
|
||||||
if (!name.IsEmpty())
|
if (!name.IsEmpty()) {
|
||||||
{
|
res.push_back(wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT));
|
||||||
names.Add(_(L("Default")));
|
|
||||||
identifiers.Add(wxLANGUAGE_DEFAULT);
|
|
||||||
}
|
}
|
||||||
for (bool cont = dir.GetFirst(&filename, wxEmptyString, wxDIR_DIRS);
|
|
||||||
cont; cont = dir.GetNext(&filename))
|
for (bool cont = dir.GetFirst(&filename, wxEmptyString, wxDIR_DIRS); cont; cont = dir.GetNext(&filename)) {
|
||||||
{
|
|
||||||
langinfo = wxLocale::FindLanguageInfo(filename);
|
langinfo = wxLocale::FindLanguageInfo(filename);
|
||||||
if (langinfo != NULL)
|
if (langinfo != NULL) {
|
||||||
{
|
|
||||||
auto full_file_name = dir.GetName() + wxFileName::GetPathSeparator() +
|
auto full_file_name = dir.GetName() + wxFileName::GetPathSeparator() +
|
||||||
filename + wxFileName::GetPathSeparator() + "Slic3rPE" + wxT(".mo");
|
filename + wxFileName::GetPathSeparator() + "Slic3rPE" + wxT(".mo");
|
||||||
if (wxFileExists(full_file_name))
|
if (wxFileExists(full_file_name)) {
|
||||||
{
|
res.push_back(langinfo);
|
||||||
names.Add(langinfo->Description);
|
|
||||||
identifiers.Add(langinfo->Language);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tab* GUI_App::get_tab(Preset::Type type)
|
Tab* GUI_App::get_tab(Preset::Type type)
|
||||||
@ -757,14 +794,7 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
|
|||||||
if ( dialog.ShowModal() == wxID_CANCEL)
|
if ( dialog.ShowModal() == wxID_CANCEL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxArrayString names;
|
switch_language();
|
||||||
wxArrayLong identifiers;
|
|
||||||
get_installed_languages(names, identifiers);
|
|
||||||
if (select_language(names, identifiers)) {
|
|
||||||
save_language();
|
|
||||||
_3DScene::remove_all_canvases();// remove all canvas before recreate GUI
|
|
||||||
recreate_GUI();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ConfigMenuFlashFirmware:
|
case ConfigMenuFlashFirmware:
|
||||||
@ -790,15 +820,15 @@ bool GUI_App::check_unsaved_changes()
|
|||||||
for (Tab *tab : tabs_list)
|
for (Tab *tab : tabs_list)
|
||||||
if (tab->supports_printer_technology(printer_technology) && tab->current_preset_is_dirty())
|
if (tab->supports_printer_technology(printer_technology) && tab->current_preset_is_dirty())
|
||||||
if (dirty.empty())
|
if (dirty.empty())
|
||||||
dirty = _(tab->name());
|
dirty = tab->title();
|
||||||
else
|
else
|
||||||
dirty += wxString(", ") + _(tab->name());
|
dirty += wxString(", ") + tab->title();
|
||||||
if (dirty.empty())
|
if (dirty.empty())
|
||||||
// No changes, the application may close or reload presets.
|
// No changes, the application may close or reload presets.
|
||||||
return true;
|
return true;
|
||||||
// Ask the user.
|
// Ask the user.
|
||||||
wxMessageDialog dialog(mainframe,
|
wxMessageDialog dialog(mainframe,
|
||||||
_(L("The following presets were modified")) + ": " + dirty + "\n" + _(L("Discard changes and continue anyway?")),
|
_(L("The presets on the following tabs were modified")) + ": " + dirty + "\n\n" + _(L("Discard changes and continue anyway?")),
|
||||||
wxString(SLIC3R_APP_NAME) + " - " + _(L("Unsaved Presets")),
|
wxString(SLIC3R_APP_NAME) + " - " + _(L("Unsaved Presets")),
|
||||||
wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT);
|
wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT);
|
||||||
return dialog.ShowModal() == wxID_YES;
|
return dialog.ShowModal() == wxID_YES;
|
||||||
|
@ -19,6 +19,7 @@ class wxMenuItem;
|
|||||||
class wxMenuBar;
|
class wxMenuBar;
|
||||||
class wxTopLevelWindow;
|
class wxTopLevelWindow;
|
||||||
class wxNotebook;
|
class wxNotebook;
|
||||||
|
struct wxLanguageInfo;
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
class AppConfig;
|
class AppConfig;
|
||||||
@ -119,18 +120,15 @@ public:
|
|||||||
void keyboard_shortcuts();
|
void keyboard_shortcuts();
|
||||||
void load_project(wxWindow *parent, wxString& input_file);
|
void load_project(wxWindow *parent, wxString& input_file);
|
||||||
void import_model(wxWindow *parent, wxArrayString& input_files);
|
void import_model(wxWindow *parent, wxArrayString& input_files);
|
||||||
static bool catch_error(std::function<void()> cb,
|
static bool catch_error(std::function<void()> cb, const std::string& err);
|
||||||
// wxMessageDialog* message_dialog,
|
|
||||||
const std::string& err);
|
|
||||||
// void notify(/*message*/);
|
|
||||||
|
|
||||||
void persist_window_geometry(wxTopLevelWindow *window, bool default_maximized = false);
|
void persist_window_geometry(wxTopLevelWindow *window, bool default_maximized = false);
|
||||||
void update_ui_from_settings();
|
void update_ui_from_settings();
|
||||||
|
|
||||||
bool select_language(wxArrayString & names, wxArrayLong & identifiers);
|
bool switch_language();
|
||||||
|
// Load gettext translation files and activate them at the start of the application,
|
||||||
|
// based on the "translation_language" key stored in the application config.
|
||||||
bool load_language();
|
bool load_language();
|
||||||
void save_language();
|
|
||||||
void get_installed_languages(wxArrayString & names, wxArrayLong & identifiers);
|
|
||||||
|
|
||||||
Tab* get_tab(Preset::Type type);
|
Tab* get_tab(Preset::Type type);
|
||||||
ConfigOptionMode get_mode();
|
ConfigOptionMode get_mode();
|
||||||
@ -178,6 +176,9 @@ private:
|
|||||||
void window_pos_save(wxTopLevelWindow* window, const std::string &name);
|
void window_pos_save(wxTopLevelWindow* window, const std::string &name);
|
||||||
void window_pos_restore(wxTopLevelWindow* window, const std::string &name, bool default_maximized = false);
|
void window_pos_restore(wxTopLevelWindow* window, const std::string &name, bool default_maximized = false);
|
||||||
void window_pos_sanitize(wxTopLevelWindow* window);
|
void window_pos_sanitize(wxTopLevelWindow* window);
|
||||||
|
bool select_language();
|
||||||
|
void save_language();
|
||||||
|
std::vector<const wxLanguageInfo*> get_installed_languages();
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
void associate_3mf_files();
|
void associate_3mf_files();
|
||||||
#endif // __WXMSW__
|
#endif // __WXMSW__
|
||||||
|
@ -554,10 +554,10 @@ void MainFrame::init_menubar()
|
|||||||
//# $versioncheck->Enable(wxTheApp->have_version_check);
|
//# $versioncheck->Enable(wxTheApp->have_version_check);
|
||||||
append_menu_item(helpMenu, wxID_ANY, wxString::Format(_(L("%s &Website")), SLIC3R_APP_NAME),
|
append_menu_item(helpMenu, wxID_ANY, wxString::Format(_(L("%s &Website")), SLIC3R_APP_NAME),
|
||||||
wxString::Format(_(L("Open the %s website in your browser")), SLIC3R_APP_NAME),
|
wxString::Format(_(L("Open the %s website in your browser")), SLIC3R_APP_NAME),
|
||||||
[this](wxCommandEvent&) { wxLaunchDefaultBrowser("http://slic3r.org/"); });
|
[this](wxCommandEvent&) { wxLaunchDefaultBrowser("https://www.prusa3d.com/slic3r-prusa-edition/"); });
|
||||||
append_menu_item(helpMenu, wxID_ANY, wxString::Format(_(L("%s &Manual")), SLIC3R_APP_NAME),
|
// append_menu_item(helpMenu, wxID_ANY, wxString::Format(_(L("%s &Manual")), SLIC3R_APP_NAME),
|
||||||
wxString::Format(_(L("Open the %s manual in your browser")), SLIC3R_APP_NAME),
|
// wxString::Format(_(L("Open the %s manual in your browser")), SLIC3R_APP_NAME),
|
||||||
[this](wxCommandEvent&) { wxLaunchDefaultBrowser("http://manual.slic3r.org/"); });
|
// [this](wxCommandEvent&) { wxLaunchDefaultBrowser("http://manual.slic3r.org/"); });
|
||||||
helpMenu->AppendSeparator();
|
helpMenu->AppendSeparator();
|
||||||
append_menu_item(helpMenu, wxID_ANY, _(L("System &Info")), _(L("Show system information")),
|
append_menu_item(helpMenu, wxID_ANY, _(L("System &Info")), _(L("Show system information")),
|
||||||
[this](wxCommandEvent&) { wxGetApp().system_info(); });
|
[this](wxCommandEvent&) { wxGetApp().system_info(); });
|
||||||
@ -917,7 +917,7 @@ void MainFrame::load_config(const DynamicPrintConfig& config)
|
|||||||
#if 0
|
#if 0
|
||||||
for (auto tab : wxGetApp().tabs_list)
|
for (auto tab : wxGetApp().tabs_list)
|
||||||
if (tab->supports_printer_technology(printer_technology)) {
|
if (tab->supports_printer_technology(printer_technology)) {
|
||||||
if (tab->name() == "printer")
|
if (tab->type() == Slic3r::Preset::TYPE_PRINTER)
|
||||||
static_cast<TabPrinter*>(tab)->update_pages();
|
static_cast<TabPrinter*>(tab)->update_pages();
|
||||||
tab->load_config(config);
|
tab->load_config(config);
|
||||||
}
|
}
|
||||||
|
@ -3338,7 +3338,7 @@ void Plater::remove(size_t obj_idx) { p->remove(obj_idx); }
|
|||||||
void Plater::reset() { p->reset(); }
|
void Plater::reset() { p->reset(); }
|
||||||
void Plater::reset_with_confirm()
|
void Plater::reset_with_confirm()
|
||||||
{
|
{
|
||||||
if (wxMessageDialog((wxWindow*)this, _(L("All objects will be removed, continue ?")), _(L("Delete all")), wxYES_NO | wxYES_DEFAULT | wxCENTRE).ShowModal() == wxID_YES)
|
if (wxMessageDialog((wxWindow*)this, _(L("All objects will be removed, continue ?")), _(L("Delete all")), wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxCENTRE).ShowModal() == wxID_YES)
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,12 +38,13 @@ namespace GUI {
|
|||||||
wxDEFINE_EVENT(EVT_TAB_VALUE_CHANGED, wxCommandEvent);
|
wxDEFINE_EVENT(EVT_TAB_VALUE_CHANGED, wxCommandEvent);
|
||||||
wxDEFINE_EVENT(EVT_TAB_PRESETS_CHANGED, SimpleEvent);
|
wxDEFINE_EVENT(EVT_TAB_PRESETS_CHANGED, SimpleEvent);
|
||||||
|
|
||||||
Tab::Tab(wxNotebook* parent, const wxString& title, const char* name) :
|
// Tab::Tab(wxNotebook* parent, const wxString& title, const char* name) :
|
||||||
m_parent(parent), m_title(title), m_name(name)
|
// m_parent(parent), m_title(title), m_name(name)
|
||||||
|
Tab::Tab(wxNotebook* parent, const wxString& title, Preset::Type type) :
|
||||||
|
m_parent(parent), m_title(title), m_type(type)
|
||||||
{
|
{
|
||||||
Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL, name);
|
Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL/*, name*/);
|
||||||
this->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
this->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||||
set_type();
|
|
||||||
|
|
||||||
m_compatible_printers.type = Preset::TYPE_PRINTER;
|
m_compatible_printers.type = Preset::TYPE_PRINTER;
|
||||||
m_compatible_printers.key_list = "compatible_printers";
|
m_compatible_printers.key_list = "compatible_printers";
|
||||||
@ -463,6 +464,7 @@ void Tab::update_changed_ui()
|
|||||||
// Thaw();
|
// Thaw();
|
||||||
|
|
||||||
wxTheApp->CallAfter([this]() {
|
wxTheApp->CallAfter([this]() {
|
||||||
|
if (parent()) //To avoid a crash, parent should be exist for a moment of a tree updating
|
||||||
update_changed_tree_ui();
|
update_changed_tree_ui();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -228,12 +228,14 @@ public:
|
|||||||
int m_update_cnt = 0;
|
int m_update_cnt = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Tab(wxNotebook* parent, const wxString& title, const char* name);
|
// Tab(wxNotebook* parent, const wxString& title, const char* name);
|
||||||
|
Tab(wxNotebook* parent, const wxString& title, Preset::Type type);
|
||||||
~Tab() {}
|
~Tab() {}
|
||||||
|
|
||||||
wxWindow* parent() const { return m_parent; }
|
wxWindow* parent() const { return m_parent; }
|
||||||
wxString title() const { return m_title; }
|
wxString title() const { return m_title; }
|
||||||
std::string name() const { return m_name; }
|
// std::string name() const { return m_name; }
|
||||||
|
std::string name() const { return m_presets->name(); }
|
||||||
Preset::Type type() const { return m_type; }
|
Preset::Type type() const { return m_type; }
|
||||||
bool complited() const { return m_complited; }
|
bool complited() const { return m_complited; }
|
||||||
virtual bool supports_printer_technology(const PrinterTechnology tech) = 0;
|
virtual bool supports_printer_technology(const PrinterTechnology tech) = 0;
|
||||||
@ -312,7 +314,8 @@ class TabPrint : public Tab
|
|||||||
bool is_msg_dlg_already_exist {false};
|
bool is_msg_dlg_already_exist {false};
|
||||||
public:
|
public:
|
||||||
TabPrint(wxNotebook* parent) :
|
TabPrint(wxNotebook* parent) :
|
||||||
Tab(parent, _(L("Print Settings")), L("print")) {}
|
// Tab(parent, _(L("Print Settings")), L("print")) {}
|
||||||
|
Tab(parent, _(L("Print Settings")), Slic3r::Preset::TYPE_PRINT) {}
|
||||||
~TabPrint() {}
|
~TabPrint() {}
|
||||||
|
|
||||||
ogStaticText* m_recommended_thin_wall_thickness_description_line;
|
ogStaticText* m_recommended_thin_wall_thickness_description_line;
|
||||||
@ -330,7 +333,8 @@ class TabFilament : public Tab
|
|||||||
ogStaticText* m_cooling_description_line;
|
ogStaticText* m_cooling_description_line;
|
||||||
public:
|
public:
|
||||||
TabFilament(wxNotebook* parent) :
|
TabFilament(wxNotebook* parent) :
|
||||||
Tab(parent, _(L("Filament Settings")), L("filament")) {}
|
// Tab(parent, _(L("Filament Settings")), L("filament")) {}
|
||||||
|
Tab(parent, _(L("Filament Settings")), Slic3r::Preset::TYPE_FILAMENT) {}
|
||||||
~TabFilament() {}
|
~TabFilament() {}
|
||||||
|
|
||||||
void build() override;
|
void build() override;
|
||||||
@ -363,7 +367,9 @@ public:
|
|||||||
|
|
||||||
PrinterTechnology m_printer_technology = ptFFF;
|
PrinterTechnology m_printer_technology = ptFFF;
|
||||||
|
|
||||||
TabPrinter(wxNotebook* parent) : Tab(parent, _(L("Printer Settings")), L("printer")) {}
|
// TabPrinter(wxNotebook* parent) : Tab(parent, _(L("Printer Settings")), L("printer")) {}
|
||||||
|
TabPrinter(wxNotebook* parent) :
|
||||||
|
Tab(parent, _(L("Printer Settings")), Slic3r::Preset::TYPE_PRINTER) {}
|
||||||
~TabPrinter() {}
|
~TabPrinter() {}
|
||||||
|
|
||||||
void build() override;
|
void build() override;
|
||||||
@ -386,7 +392,8 @@ class TabSLAMaterial : public Tab
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TabSLAMaterial(wxNotebook* parent) :
|
TabSLAMaterial(wxNotebook* parent) :
|
||||||
Tab(parent, _(L("Material Settings")), L("sla_material")) {}
|
// Tab(parent, _(L("Material Settings")), L("sla_material")) {}
|
||||||
|
Tab(parent, _(L("Material Settings")), Slic3r::Preset::TYPE_SLA_MATERIAL) {}
|
||||||
~TabSLAMaterial() {}
|
~TabSLAMaterial() {}
|
||||||
|
|
||||||
void build() override;
|
void build() override;
|
||||||
@ -400,7 +407,8 @@ class TabSLAPrint : public Tab
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TabSLAPrint(wxNotebook* parent) :
|
TabSLAPrint(wxNotebook* parent) :
|
||||||
Tab(parent, _(L("Print Settings")), L("sla_print")) {}
|
// Tab(parent, _(L("Print Settings")), L("sla_print")) {}
|
||||||
|
Tab(parent, _(L("Print Settings")), Slic3r::Preset::TYPE_SLA_PRINT) {}
|
||||||
~TabSLAPrint() {}
|
~TabSLAPrint() {}
|
||||||
void build() override;
|
void build() override;
|
||||||
void reload_config() override;
|
void reload_config() override;
|
||||||
|
Loading…
Reference in New Issue
Block a user