Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_perspective_camera
This commit is contained in:
commit
64bd392e7d
Binary file not shown.
@ -474,6 +474,8 @@ WipeTowerPrusaMM::material_type WipeTowerPrusaMM::parse_material(const char *nam
|
||||
return NGEN;
|
||||
if (strcasecmp(name, "PVA") == 0)
|
||||
return PVA;
|
||||
if (strcasecmp(name, "PC") == 0)
|
||||
return PC;
|
||||
return INVALID;
|
||||
}
|
||||
|
||||
@ -489,6 +491,7 @@ std::string WipeTowerPrusaMM::to_string(material_type material)
|
||||
case EDGE: return "EDGE";
|
||||
case NGEN: return "NGEN";
|
||||
case PVA: return "PVA";
|
||||
case PC: return "PC";
|
||||
case INVALID:
|
||||
default: return "INVALID";
|
||||
}
|
||||
|
@ -34,7 +34,8 @@ public:
|
||||
SCAFF = 5, // E:215C B:55C
|
||||
EDGE = 6, // E:240C B:80C
|
||||
NGEN = 7, // E:230C B:80C
|
||||
PVA = 8 // E:210C B:80C
|
||||
PVA = 8, // E:210C B:80C
|
||||
PC = 9
|
||||
};
|
||||
|
||||
// Parse material name into material_type.
|
||||
|
@ -57,7 +57,9 @@ std::string PrintBase::output_filename(const std::string &format, const std::str
|
||||
PlaceholderParser::update_timestamp(cfg);
|
||||
this->update_object_placeholders(cfg);
|
||||
try {
|
||||
boost::filesystem::path filename = this->placeholder_parser().process(format, 0, &cfg);
|
||||
boost::filesystem::path filename = format.empty() ?
|
||||
cfg.opt_string("input_filename_base") + "." + default_ext :
|
||||
this->placeholder_parser().process(format, 0, &cfg);
|
||||
if (filename.extension().empty())
|
||||
filename = boost::filesystem::change_extension(filename, default_ext);
|
||||
return filename.string();
|
||||
|
@ -699,12 +699,22 @@ void PrintConfigDef::init_fff_params()
|
||||
def->enum_values.push_back("PLA");
|
||||
def->enum_values.push_back("ABS");
|
||||
def->enum_values.push_back("PET");
|
||||
def->enum_values.push_back("HIPS");
|
||||
def->enum_values.push_back("FLEX");
|
||||
def->enum_values.push_back("SCAFF");
|
||||
def->enum_values.push_back("HIPS");
|
||||
def->enum_values.push_back("EDGE");
|
||||
def->enum_values.push_back("NGEN");
|
||||
def->enum_values.push_back("NYLON");
|
||||
def->enum_values.push_back("PVA");
|
||||
def->enum_values.push_back("PC");
|
||||
def->enum_values.push_back("PP");
|
||||
def->enum_values.push_back("PEI");
|
||||
def->enum_values.push_back("PEEK");
|
||||
def->enum_values.push_back("PEKK");
|
||||
def->enum_values.push_back("POM");
|
||||
def->enum_values.push_back("PSU");
|
||||
def->enum_values.push_back("PVDF");
|
||||
def->enum_values.push_back("SCAFF");
|
||||
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionStrings { "PLA" });
|
||||
|
||||
@ -1323,7 +1333,7 @@ void PrintConfigDef::init_fff_params()
|
||||
"[input_filename_base].");
|
||||
def->full_width = true;
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionString("[input_filename_base]"));
|
||||
def->set_default_value(new ConfigOptionString("[input_filename_base].gcode"));
|
||||
|
||||
def = this->add("overhangs", coBool);
|
||||
def->label = L("Detect bridging perimeters");
|
||||
|
@ -46,9 +46,11 @@ enum SeamPosition {
|
||||
spRandom, spNearest, spAligned, spRear
|
||||
};
|
||||
|
||||
/*
|
||||
enum FilamentType {
|
||||
ftPLA, ftABS, ftPET, ftHIPS, ftFLEX, ftSCAFF, ftEDGE, ftNGEN, ftPVA
|
||||
};
|
||||
*/
|
||||
|
||||
enum SLADisplayOrientation {
|
||||
sladoLandscape,
|
||||
@ -137,6 +139,7 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<SeamPosition>::ge
|
||||
return keys_map;
|
||||
}
|
||||
|
||||
/*
|
||||
template<> inline const t_config_enum_values& ConfigOptionEnum<FilamentType>::get_enum_values() {
|
||||
static t_config_enum_values keys_map;
|
||||
if (keys_map.empty()) {
|
||||
@ -152,6 +155,7 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<FilamentType>::ge
|
||||
}
|
||||
return keys_map;
|
||||
}
|
||||
*/
|
||||
|
||||
template<> inline const t_config_enum_values& ConfigOptionEnum<SLADisplayOrientation>::get_enum_values() {
|
||||
static const t_config_enum_values keys_map = {
|
||||
|
@ -31,6 +31,165 @@ void AboutDialogLogo::onRepaint(wxEvent &event)
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------
|
||||
// CopyrightsDialog
|
||||
// -----------------------------------------
|
||||
CopyrightsDialog::CopyrightsDialog()
|
||||
: DPIDialog(NULL, wxID_ANY, wxString::Format("%s - %s", SLIC3R_APP_NAME, _(L("Portions copyright"))),
|
||||
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||
{
|
||||
this->SetFont(wxGetApp().normal_font());
|
||||
this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
|
||||
auto sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
fill_entries();
|
||||
|
||||
m_html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition,
|
||||
wxSize(40 * em_unit(), 20 * em_unit()), wxHW_SCROLLBAR_AUTO);
|
||||
|
||||
wxFont font = GetFont();
|
||||
const int fs = font.GetPointSize();
|
||||
const int fs2 = static_cast<int>(1.2f*fs);
|
||||
int size[] = { fs, fs, fs, fs, fs2, fs2, fs2 };
|
||||
|
||||
m_html->SetFonts(font.GetFaceName(), font.GetFaceName(), size);
|
||||
m_html->SetBorders(2);
|
||||
m_html->SetPage(get_html_text());
|
||||
|
||||
sizer->Add(m_html, 1, wxEXPAND | wxALL, 15);
|
||||
m_html->Bind(wxEVT_HTML_LINK_CLICKED, &CopyrightsDialog::onLinkClicked, this);
|
||||
|
||||
wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxCLOSE);
|
||||
|
||||
this->SetEscapeId(wxID_CLOSE);
|
||||
this->Bind(wxEVT_BUTTON, &CopyrightsDialog::onCloseDialog, this, wxID_CLOSE);
|
||||
sizer->Add(buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3);
|
||||
|
||||
SetSizer(sizer);
|
||||
sizer->SetSizeHints(this);
|
||||
|
||||
}
|
||||
|
||||
void CopyrightsDialog::fill_entries()
|
||||
{
|
||||
m_entries = {
|
||||
{ "wxWidgets" , "2019 wxWidgets" , "https://www.wxwidgets.org/" },
|
||||
{ "OpenGL" , "1997-2019 The Khronos™ Group Inc" , "https://www.opengl.org/" },
|
||||
{ "GNU gettext" , "1998, 2019 Free Software Foundation, Inc." , "https://www.gnu.org/software/gettext/" },
|
||||
{ "PoEdit" , "2019 Václav Slavík" , "https://poedit.net/" },
|
||||
{ "ImGUI" , "2014-2019 Omar Cornut" , "https://github.com/ocornut/imgui" },
|
||||
{ "Eigen" , "" , "http://eigen.tuxfamily.org" },
|
||||
{ "ADMesh" , "1995, 1996 Anthony D. Martin; "
|
||||
"2015, ADMesh contributors" , "https://admesh.readthedocs.io/en/latest/" },
|
||||
{ "Anti-Grain Geometry"
|
||||
, "2002-2005 Maxim Shemanarev (McSeem)" , "http://antigrain.com" },
|
||||
{ "Boost" , "1998-2005 Beman Dawes, David Abrahams; "
|
||||
"2004 - 2007 Rene Rivera" , "https://www.boost.org/" },
|
||||
{ "Clipper" , "2010-2015 Angus Johnson " , "http://www.angusj.com " },
|
||||
{ "GLEW (The OpenGL Extension Wrangler Library)",
|
||||
"2002 - 2007, Milan Ikits; "
|
||||
"2002 - 2007, Marcelo E.Magallon; "
|
||||
"2002, Lev Povalahev" , "http://glew.sourceforge.net/" },
|
||||
{ "Libigl" , "2013 Alec Jacobson and others" , "https://libigl.github.io/" },
|
||||
{ "Poly2Tri" , "2009-2018, Poly2Tri Contributors" , "https://github.com/jhasse/poly2tri" },
|
||||
{ "PolyPartition" , "2011 Ivan Fratric" , "https://github.com/ivanfratric/polypartition" },
|
||||
{ "Qhull" , "1993-2015 C.B.Barber Arlington and "
|
||||
"University of Minnesota" , "http://qhull.org/" },
|
||||
{ "SemVer" , "2015-2017 Tomas Aparicio" , "https://semver.org/" },
|
||||
{ "Nanosvg" , "2013-14 Mikko Mononen" , "https://github.com/memononen/nanosvg" },
|
||||
{ "Miniz" , "2013-2014 RAD Game Tools and Valve Software; "
|
||||
"2010-2014 Rich Geldreich and Tenacious Software LLC"
|
||||
, "https://github.com/richgel999/miniz" },
|
||||
{ "Expat" , "1998-2000 Thai Open Source Software Center Ltd and Clark Cooper"
|
||||
"2001-2016 Expat maintainers" , "http://www.libexpat.org/" },
|
||||
{ "AVRDUDE" , "2018 Free Software Foundation, Inc." , "http://savannah.nongnu.org/projects/avrdude" },
|
||||
{ "Shinyprofiler" , "2007-2010 Aidin Abedi" , "http://code.google.com/p/shinyprofiler/" },
|
||||
{ "Icons for STL and GCODE files."
|
||||
, "Akira Yasuda" , "http://3dp0.com/icons-for-stl-and-gcode/" }
|
||||
};
|
||||
}
|
||||
|
||||
wxString CopyrightsDialog::get_html_text()
|
||||
{
|
||||
wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
||||
|
||||
const auto text_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
|
||||
const auto text_clr_str = wxString::Format(wxT("#%02X%02X%02X"), text_clr.Red(), text_clr.Green(), text_clr.Blue());
|
||||
const auto bgr_clr_str = wxString::Format(wxT("#%02X%02X%02X"), bgr_clr.Red(), bgr_clr.Green(), bgr_clr.Blue());
|
||||
|
||||
const wxString copyright_str = _(L("Copyright")) + "© ";
|
||||
// TRN "Slic3r _is licensed under the_ License"
|
||||
const wxString header_str = _(L("License agreements of all following programs (libraries) are part of application license agreement"));
|
||||
|
||||
wxString text = wxString::Format(
|
||||
"<html>"
|
||||
"<body bgcolor= %s link= %s>"
|
||||
"<font color=%s>"
|
||||
"<font size=\"5\">%s.</font>"
|
||||
"<br /><br />"
|
||||
"<font size=\"3\">"
|
||||
, bgr_clr_str, text_clr_str
|
||||
, text_clr_str
|
||||
, header_str);
|
||||
|
||||
for (auto& entry : m_entries) {
|
||||
text += wxString::Format(
|
||||
"<a href=\"%s\">%s</a><br/>"
|
||||
, entry.link, entry.lib_name);
|
||||
|
||||
if (!entry.copyright.empty())
|
||||
text += wxString::Format(
|
||||
"%s %s"
|
||||
"<br/><br/>"
|
||||
, copyright_str, entry.copyright);
|
||||
}
|
||||
|
||||
text += wxString(
|
||||
"</font>"
|
||||
"</font>"
|
||||
"</body>"
|
||||
"</html>");
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
void CopyrightsDialog::on_dpi_changed(const wxRect &suggested_rect)
|
||||
{
|
||||
const wxFont& font = GetFont();
|
||||
const int fs = font.GetPointSize();
|
||||
const int fs2 = static_cast<int>(1.2f*fs);
|
||||
int font_size[] = { fs, fs, fs, fs, fs2, fs2, fs2 };
|
||||
|
||||
m_html->SetFonts(font.GetFaceName(), font.GetFaceName(), font_size);
|
||||
|
||||
const int& em = em_unit();
|
||||
|
||||
msw_buttons_rescale(this, em, { wxID_CLOSE });
|
||||
|
||||
const wxSize& size = wxSize(40 * em, 20 * em);
|
||||
|
||||
m_html->SetMinSize(size);
|
||||
m_html->Refresh();
|
||||
|
||||
SetMinSize(size);
|
||||
Fit();
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void CopyrightsDialog::onLinkClicked(wxHtmlLinkEvent &event)
|
||||
{
|
||||
wxLaunchDefaultBrowser(event.GetLinkInfo().GetHref());
|
||||
event.Skip(false);
|
||||
}
|
||||
|
||||
void CopyrightsDialog::onCloseDialog(wxEvent &)
|
||||
{
|
||||
this->EndModal(wxID_CLOSE);
|
||||
}
|
||||
|
||||
AboutDialog::AboutDialog()
|
||||
: DPIDialog(NULL, wxID_ANY, wxString::Format(_(L("About %s")), SLIC3R_APP_NAME), wxDefaultPosition,
|
||||
wxDefaultSize, /*wxCAPTION*/wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||
@ -120,7 +279,14 @@ AboutDialog::AboutDialog()
|
||||
m_html->Bind(wxEVT_HTML_LINK_CLICKED, &AboutDialog::onLinkClicked, this);
|
||||
}
|
||||
|
||||
|
||||
wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxCLOSE);
|
||||
|
||||
m_copy_rights_btn_id = NewControlId();
|
||||
auto copy_rights_btn = new wxButton(this, m_copy_rights_btn_id, _(L("Portions copyright"))+dots);
|
||||
buttons->Insert(0, copy_rights_btn, 0, wxLEFT, 5);
|
||||
copy_rights_btn->Bind(wxEVT_BUTTON, &AboutDialog::onCopyrightBtn, this);
|
||||
|
||||
this->SetEscapeId(wxID_CLOSE);
|
||||
this->Bind(wxEVT_BUTTON, &AboutDialog::onCloseDialog, this, wxID_CLOSE);
|
||||
vsizer->Add(buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3);
|
||||
@ -141,7 +307,7 @@ void AboutDialog::on_dpi_changed(const wxRect &suggested_rect)
|
||||
|
||||
const int& em = em_unit();
|
||||
|
||||
msw_buttons_rescale(this, em, { wxID_CLOSE });
|
||||
msw_buttons_rescale(this, em, { wxID_CLOSE, m_copy_rights_btn_id });
|
||||
|
||||
m_html->SetMinSize(wxSize(-1, 16 * em));
|
||||
m_html->Refresh();
|
||||
@ -163,7 +329,12 @@ void AboutDialog::onLinkClicked(wxHtmlLinkEvent &event)
|
||||
void AboutDialog::onCloseDialog(wxEvent &)
|
||||
{
|
||||
this->EndModal(wxID_CLOSE);
|
||||
this->Close();
|
||||
}
|
||||
|
||||
void AboutDialog::onCopyrightBtn(wxEvent &)
|
||||
{
|
||||
CopyrightsDialog dlg;
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
} // namespace GUI
|
||||
|
@ -23,11 +23,45 @@ private:
|
||||
void onRepaint(wxEvent &event);
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CopyrightsDialog : public DPIDialog
|
||||
{
|
||||
public:
|
||||
CopyrightsDialog();
|
||||
~CopyrightsDialog() {}
|
||||
|
||||
struct Entry {
|
||||
Entry(const std::string &lib_name, const std::string ©right, const std::string &link) :
|
||||
lib_name(lib_name), copyright(copyright), link(link) {}
|
||||
|
||||
std::string lib_name;
|
||||
std::string copyright;
|
||||
std::string link;
|
||||
};
|
||||
|
||||
protected:
|
||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||
|
||||
private:
|
||||
wxHtmlWindow* m_html;
|
||||
std::vector<Entry> m_entries;
|
||||
|
||||
void onLinkClicked(wxHtmlLinkEvent &event);
|
||||
void onCloseDialog(wxEvent &);
|
||||
|
||||
void fill_entries();
|
||||
wxString get_html_text();
|
||||
};
|
||||
|
||||
|
||||
|
||||
class AboutDialog : public DPIDialog
|
||||
{
|
||||
ScalableBitmap m_logo_bitmap;
|
||||
wxHtmlWindow* m_html;
|
||||
wxStaticBitmap* m_logo;
|
||||
int m_copy_rights_btn_id { wxID_ANY };
|
||||
public:
|
||||
AboutDialog();
|
||||
|
||||
@ -37,6 +71,7 @@ protected:
|
||||
private:
|
||||
void onLinkClicked(wxHtmlLinkEvent &event);
|
||||
void onCloseDialog(wxEvent &);
|
||||
void onCopyrightBtn(wxEvent &);
|
||||
};
|
||||
|
||||
} // namespace GUI
|
||||
|
@ -22,7 +22,7 @@ namespace Slic3r {
|
||||
|
||||
static const std::string VENDOR_PREFIX = "vendor:";
|
||||
static const std::string MODEL_PREFIX = "model:";
|
||||
static const std::string VERSION_CHECK_URL = "https://raw.githubusercontent.com/prusa3d/PrusaSlicer-settings/master/live/PrusaSlicer.version";
|
||||
static const std::string VERSION_CHECK_URL = "http://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/PrusaSlicer.version";
|
||||
|
||||
void AppConfig::reset()
|
||||
{
|
||||
|
@ -159,13 +159,11 @@ void ConfigSnapshotDialog::onLinkClicked(wxHtmlLinkEvent &event)
|
||||
{
|
||||
m_snapshot_to_activate = event.GetLinkInfo().GetHref();
|
||||
this->EndModal(wxID_CLOSE);
|
||||
this->Close();
|
||||
}
|
||||
|
||||
void ConfigSnapshotDialog::onCloseDialog(wxEvent &)
|
||||
{
|
||||
this->EndModal(wxID_CLOSE);
|
||||
this->Close();
|
||||
}
|
||||
|
||||
} // namespace GUI
|
||||
|
@ -723,10 +723,10 @@ void FirmwareDialog::priv::ensure_joined()
|
||||
const char* FirmwareDialog::priv::avr109_dev_name(Avr109Pid usb_pid) {
|
||||
switch (usb_pid.boot) {
|
||||
case USB_PID_MMU_BOOT:
|
||||
return "Prusa MMU 2.0 Control";
|
||||
return "Original Prusa MMU 2.0 Control";
|
||||
break;
|
||||
case USB_PID_CW1_BOOT:
|
||||
return "Prusa CurWa";
|
||||
return "Original Prusa CW1";
|
||||
break;
|
||||
|
||||
default: throw std::runtime_error((boost::format("Invalid avr109 device USB PID: %1%") % usb_pid.boot).str());
|
||||
|
@ -183,9 +183,8 @@ bool GUI_App::on_init_inner()
|
||||
// supplied as argument to --datadir; in that case we should still run the wizard
|
||||
preset_bundle->setup_directories();
|
||||
|
||||
app_conf_exists = app_config->exists();
|
||||
// load settings
|
||||
if (app_conf_exists)
|
||||
if (app_config->exists())
|
||||
app_config->load();
|
||||
app_config->set("version", SLIC3R_VERSION);
|
||||
app_config->save();
|
||||
@ -258,7 +257,7 @@ bool GUI_App::on_init_inner()
|
||||
}
|
||||
|
||||
CallAfter([this] {
|
||||
if (!config_wizard_startup(app_conf_exists)) {
|
||||
if (!config_wizard_startup(app_config->exists())) {
|
||||
// Only notify if there was no wizard so as not to bother too much ...
|
||||
preset_updater->slic3r_update_notify();
|
||||
}
|
||||
@ -442,14 +441,12 @@ void GUI_App::system_info()
|
||||
{
|
||||
SysInfoDialog dlg;
|
||||
dlg.ShowModal();
|
||||
dlg.Destroy();
|
||||
}
|
||||
|
||||
void GUI_App::keyboard_shortcuts()
|
||||
{
|
||||
KBShortcutsDialog dlg;
|
||||
dlg.ShowModal();
|
||||
dlg.Destroy();
|
||||
}
|
||||
|
||||
// static method accepting a wxWindow object as first parameter
|
||||
@ -1000,7 +997,7 @@ void GUI_App::associate_3mf_files()
|
||||
{
|
||||
// see as reference: https://stackoverflow.com/questions/20245262/c-program-needs-an-file-association
|
||||
|
||||
auto reg_set = [](HKEY hkeyHive, const wchar_t* pszVar, const wchar_t* pszValue)
|
||||
auto reg_set = [](HKEY hkeyHive, const wchar_t* pszVar, const wchar_t* pszValue)->bool
|
||||
{
|
||||
wchar_t szValueCurrent[1000];
|
||||
DWORD dwType;
|
||||
@ -1012,26 +1009,32 @@ void GUI_App::associate_3mf_files()
|
||||
|
||||
if ((iRC != ERROR_SUCCESS) && !bDidntExist)
|
||||
// an error occurred
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (!bDidntExist)
|
||||
{
|
||||
if (dwType != REG_SZ)
|
||||
// invalid type
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (::wcscmp(szValueCurrent, pszValue) == 0)
|
||||
// value already set
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD dwDisposition;
|
||||
HKEY hkey;
|
||||
iRC = ::RegCreateKeyExW(hkeyHive, pszVar, 0, 0, 0, KEY_ALL_ACCESS, nullptr, &hkey, &dwDisposition);
|
||||
bool ret = false;
|
||||
if (iRC == ERROR_SUCCESS)
|
||||
{
|
||||
iRC = ::RegSetValueExW(hkey, L"", 0, REG_SZ, (BYTE*)pszValue, (::wcslen(pszValue) + 1) * sizeof(wchar_t));
|
||||
if (iRC == ERROR_SUCCESS)
|
||||
ret = true;
|
||||
}
|
||||
|
||||
RegCloseKey(hkey);
|
||||
return ret;
|
||||
};
|
||||
|
||||
wchar_t app_path[MAX_PATH];
|
||||
@ -1046,10 +1049,13 @@ void GUI_App::associate_3mf_files()
|
||||
std::wstring reg_prog_id = reg_base + L"\\" + prog_id;
|
||||
std::wstring reg_prog_id_command = reg_prog_id + L"\\Shell\\Open\\Command";
|
||||
|
||||
reg_set(HKEY_CURRENT_USER, reg_extension.c_str(), prog_id.c_str());
|
||||
reg_set(HKEY_CURRENT_USER, reg_prog_id.c_str(), prog_desc.c_str());
|
||||
reg_set(HKEY_CURRENT_USER, reg_prog_id_command.c_str(), prog_command.c_str());
|
||||
bool is_new = false;
|
||||
is_new |= reg_set(HKEY_CURRENT_USER, reg_extension.c_str(), prog_id.c_str());
|
||||
is_new |= reg_set(HKEY_CURRENT_USER, reg_prog_id.c_str(), prog_desc.c_str());
|
||||
is_new |= reg_set(HKEY_CURRENT_USER, reg_prog_id_command.c_str(), prog_command.c_str());
|
||||
|
||||
if (is_new)
|
||||
// notify Windows only when any of the values gets changed
|
||||
::SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
|
||||
}
|
||||
#endif // __WXMSW__
|
||||
|
@ -72,7 +72,6 @@ static wxString dots("…", wxConvUTF8);
|
||||
class GUI_App : public wxApp
|
||||
{
|
||||
bool m_initialized { false };
|
||||
bool app_conf_exists{ false };
|
||||
|
||||
wxColour m_color_label_modified;
|
||||
wxColour m_color_label_sys;
|
||||
|
@ -533,6 +533,7 @@ void Preview::create_double_slider()
|
||||
|
||||
m_slider->Bind(wxEVT_SCROLL_CHANGED, &Preview::on_sliders_scroll_changed, this);
|
||||
|
||||
|
||||
Bind(wxCUSTOMEVT_TICKSCHANGED, [this](wxEvent&) {
|
||||
auto& config = wxGetApp().preset_bundle->project_config;
|
||||
((config.option<ConfigOptionFloats>("colorprint_heights"))->values) = (m_slider->GetTicksValues());
|
||||
@ -823,7 +824,7 @@ void Preview::load_print_as_sla()
|
||||
}
|
||||
}
|
||||
|
||||
void Preview::on_sliders_scroll_changed(wxEvent& event)
|
||||
void Preview::on_sliders_scroll_changed(wxCommandEvent& event)
|
||||
{
|
||||
if (IsShown())
|
||||
{
|
||||
@ -831,7 +832,7 @@ void Preview::on_sliders_scroll_changed(wxEvent& event)
|
||||
if (tech == ptFFF)
|
||||
{
|
||||
m_canvas->set_toolpaths_range(m_slider->GetLowerValueD() - 1e-6, m_slider->GetHigherValueD() + 1e-6);
|
||||
m_canvas_widget->Refresh();
|
||||
m_canvas->render();
|
||||
m_canvas->set_use_clipping_planes(false);
|
||||
}
|
||||
else if (tech == ptSLA)
|
||||
@ -839,10 +840,11 @@ void Preview::on_sliders_scroll_changed(wxEvent& event)
|
||||
m_canvas->set_clipping_plane(0, ClippingPlane(Vec3d::UnitZ(), -m_slider->GetLowerValueD()));
|
||||
m_canvas->set_clipping_plane(1, ClippingPlane(-Vec3d::UnitZ(), m_slider->GetHigherValueD()));
|
||||
m_canvas->set_use_clipping_planes(m_slider->GetHigherValue() != 0);
|
||||
m_canvas_widget->Refresh();
|
||||
m_canvas->render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
@ -154,7 +154,7 @@ private:
|
||||
void load_print_as_fff(bool keep_z_range = false);
|
||||
void load_print_as_sla();
|
||||
|
||||
void on_sliders_scroll_changed(wxEvent& event);
|
||||
void on_sliders_scroll_changed(wxCommandEvent& event);
|
||||
|
||||
};
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/dcclient.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/fontutil.h>
|
||||
|
||||
#include "libslic3r/Config.hpp"
|
||||
|
||||
@ -113,6 +115,32 @@ int get_dpi_for_window(wxWindow *window)
|
||||
#endif
|
||||
}
|
||||
|
||||
wxFont get_default_font_for_dpi(int dpi)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// First try to load the font with the Windows 10 specific way.
|
||||
struct SystemParametersInfoForDpi_t { typedef BOOL (WINAPI *FN)(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni, UINT dpi); };
|
||||
static auto SystemParametersInfoForDpi_fn = winapi_get_function<SystemParametersInfoForDpi_t>(L"User32.dll", "SystemParametersInfoForDpi");
|
||||
if (SystemParametersInfoForDpi_fn != nullptr) {
|
||||
NONCLIENTMETRICS nm;
|
||||
memset(&nm, 0, sizeof(NONCLIENTMETRICS));
|
||||
nm.cbSize = sizeof(NONCLIENTMETRICS);
|
||||
if (SystemParametersInfoForDpi_fn(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &nm, 0, dpi)) {
|
||||
wxNativeFontInfo info;
|
||||
info.lf = nm.lfMessageFont;
|
||||
return wxFont(info);
|
||||
}
|
||||
}
|
||||
// Then try to guesstimate the font DPI scaling on Windows 8.
|
||||
// Let's hope that the font returned by the SystemParametersInfo(), which is used by wxWidgets internally, makes sense.
|
||||
int dpi_primary = get_dpi_for_window(nullptr);
|
||||
if (dpi_primary != dpi) {
|
||||
// Rescale the font.
|
||||
return wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scaled(float(dpi) / float(dpi_primary));
|
||||
}
|
||||
#endif
|
||||
return wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
}
|
||||
|
||||
CheckboxFileDialog::ExtraPanel::ExtraPanel(wxWindow *parent)
|
||||
: wxPanel(parent, wxID_ANY)
|
||||
|
@ -34,6 +34,7 @@ void on_window_geometry(wxTopLevelWindow *tlw, std::function<void()> callback);
|
||||
enum { DPI_DEFAULT = 96 };
|
||||
|
||||
int get_dpi_for_window(wxWindow *window);
|
||||
wxFont get_default_font_for_dpi(int dpi);
|
||||
|
||||
struct DpiChangedEvent : public wxEvent {
|
||||
int dpi;
|
||||
@ -58,12 +59,10 @@ public:
|
||||
const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE, const wxString &name=wxFrameNameStr)
|
||||
: P(parent, id, title, pos, size, style, name)
|
||||
{
|
||||
m_scale_factor = (float)get_dpi_for_window(this) / (float)DPI_DEFAULT;
|
||||
int dpi = get_dpi_for_window(this);
|
||||
m_scale_factor = (float)dpi / (float)DPI_DEFAULT;
|
||||
m_prev_scale_factor = m_scale_factor;
|
||||
float scale_primary_display = (float)get_dpi_for_window(nullptr) / (float)DPI_DEFAULT;
|
||||
m_normal_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
if (std::abs(m_scale_factor - scale_primary_display) > 1e-6)
|
||||
m_normal_font = m_normal_font.Scale(m_scale_factor / scale_primary_display);
|
||||
m_normal_font = get_default_font_for_dpi(dpi);
|
||||
|
||||
// initialize default width_unit according to the width of the one symbol ("m") of the currently active font of this window.
|
||||
m_em_unit = std::max<size_t>(10, this->GetTextExtent("m").x - 1);
|
||||
|
@ -211,7 +211,6 @@ void KBShortcutsDialog::on_dpi_changed(const wxRect &suggested_rect)
|
||||
void KBShortcutsDialog::onCloseDialog(wxEvent &)
|
||||
{
|
||||
this->EndModal(wxID_CLOSE);
|
||||
this->Close();
|
||||
}
|
||||
|
||||
} // namespace GUI
|
||||
|
@ -136,7 +136,6 @@ void PreferencesDialog::accept()
|
||||
}
|
||||
|
||||
EndModal(wxID_OK);
|
||||
Close(); // needed on Linux
|
||||
|
||||
// Nothify the UI to update itself from the ini file.
|
||||
wxGetApp().update_ui_from_settings();
|
||||
|
@ -78,6 +78,7 @@ PresetBundle::PresetBundle() :
|
||||
this->sla_materials.default_preset().inherits();
|
||||
|
||||
this->sla_prints.default_preset().config.optptr("sla_print_settings_id", true);
|
||||
this->sla_prints.default_preset().config.opt_string("output_filename_format", true) = "[input_filename_base].sl1";
|
||||
this->sla_prints.default_preset().compatible_printers_condition();
|
||||
this->sla_prints.default_preset().inherits();
|
||||
|
||||
|
@ -117,7 +117,7 @@ SysInfoDialog::SysInfoDialog()
|
||||
}
|
||||
|
||||
wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxOK);
|
||||
m_btn_copy_to_clipboard = new wxButton(this, wxID_ANY, "Copy to Clipboard", wxDefaultPosition, wxDefaultSize);
|
||||
m_btn_copy_to_clipboard = new wxButton(this, wxID_ANY, _(L("Copy to Clipboard")), wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
buttons->Insert(0, m_btn_copy_to_clipboard, 0, wxLEFT, 5);
|
||||
m_btn_copy_to_clipboard->Bind(wxEVT_BUTTON, &SysInfoDialog::onCopyToClipboard, this);
|
||||
@ -172,7 +172,6 @@ void SysInfoDialog::onCopyToClipboard(wxEvent &)
|
||||
void SysInfoDialog::onCloseDialog(wxEvent &)
|
||||
{
|
||||
this->EndModal(wxID_CLOSE);
|
||||
this->Close();
|
||||
}
|
||||
|
||||
} // namespace GUI
|
||||
|
@ -2235,14 +2235,16 @@ void DoubleSlider::OnMotion(wxMouseEvent& event)
|
||||
}
|
||||
else if (m_is_left_down || m_is_right_down) {
|
||||
if (m_selection == ssLower) {
|
||||
int current_value = m_lower_value;
|
||||
m_lower_value = get_value_from_position(pos.x, pos.y);
|
||||
correct_lower_value();
|
||||
action = true;
|
||||
action = (current_value != m_lower_value);
|
||||
}
|
||||
else if (m_selection == ssHigher) {
|
||||
int current_value = m_higher_value;
|
||||
m_higher_value = get_value_from_position(pos.x, pos.y);
|
||||
correct_higher_value();
|
||||
action = true;
|
||||
action = (current_value != m_higher_value);
|
||||
}
|
||||
}
|
||||
Refresh();
|
||||
@ -2253,6 +2255,7 @@ void DoubleSlider::OnMotion(wxMouseEvent& event)
|
||||
{
|
||||
wxCommandEvent e(wxEVT_SCROLL_CHANGED);
|
||||
e.SetEventObject(this);
|
||||
e.SetString("moving");
|
||||
ProcessWindowEvent(e);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user