mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-26 18:21:18 -06:00
Merge remote-tracking branch 'origin/master' into ys_update_settings
This commit is contained in:
commit
7ff68ad210
94 changed files with 2540 additions and 2639 deletions
|
|
@ -609,10 +609,12 @@ void Bed3D::render_default(bool bottom) const
|
|||
if (!has_model && !bottom)
|
||||
{
|
||||
// draw background
|
||||
glsafe(::glDepthMask(GL_FALSE));
|
||||
glsafe(::glColor4f(0.35f, 0.35f, 0.35f, 0.4f));
|
||||
glsafe(::glNormal3d(0.0f, 0.0f, 1.0f));
|
||||
glsafe(::glVertexPointer(3, GL_FLOAT, m_triangles.get_vertex_data_size(), (GLvoid*)m_triangles.get_vertices_data()));
|
||||
glsafe(::glDrawArrays(GL_TRIANGLES, 0, (GLsizei)triangles_vcount));
|
||||
glsafe(::glDepthMask(GL_TRUE));
|
||||
}
|
||||
|
||||
// draw grid
|
||||
|
|
|
|||
|
|
@ -76,9 +76,9 @@ void CopyrightsDialog::fill_entries()
|
|||
{
|
||||
m_entries = {
|
||||
{ "wxWidgets" , "2019 wxWidgets" , "https://www.wxwidgets.org/" },
|
||||
{ "OpenGL" , "1997-2019 The Khronos™ Group Inc" , "https://www.opengl.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/" },
|
||||
{ "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; "
|
||||
|
|
@ -110,7 +110,9 @@ void CopyrightsDialog::fill_entries()
|
|||
, "Based on original by fabian \"ryg\" giesen v1.04. "
|
||||
"Custom version, modified by Yann Collet" , "https://github.com/Cyan4973/RygsDXTc" },
|
||||
{ "Icons for STL and GCODE files."
|
||||
, "Akira Yasuda" , "http://3dp0.com/icons-for-stl-and-gcode/" }
|
||||
, "Akira Yasuda" , "http://3dp0.com/icons-for-stl-and-gcode/" },
|
||||
{ "AppImage packaging for Linux using AppImageKit"
|
||||
, "2004-2019 Simon Peter and contributors" , "https://appimage.org/" }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,13 @@
|
|||
#include <boost/nowide/fstream.hpp>
|
||||
#include <boost/property_tree/ini_parser.hpp>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/exceptions.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include <wx/string.h>
|
||||
#include "I18N.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
static const std::string VENDOR_PREFIX = "vendor:";
|
||||
|
|
@ -58,7 +62,7 @@ void AppConfig::set_defaults()
|
|||
if (!get("use_legacy_opengl").empty())
|
||||
erase("", "use_legacy_opengl");
|
||||
|
||||
#if __APPLE__
|
||||
#ifdef __APPLE__
|
||||
if (get("use_retina_opengl").empty())
|
||||
set("use_retina_opengl", "1");
|
||||
#endif
|
||||
|
|
@ -90,7 +94,15 @@ void AppConfig::load()
|
|||
namespace pt = boost::property_tree;
|
||||
pt::ptree tree;
|
||||
boost::nowide::ifstream ifs(AppConfig::config_path());
|
||||
pt::read_ini(ifs, tree);
|
||||
try {
|
||||
pt::read_ini(ifs, tree);
|
||||
} catch (pt::ptree_error& ex) {
|
||||
// Error while parsing config file. We'll customize the error message and rethrow to be displayed.
|
||||
throw std::runtime_error(
|
||||
_utf8(L("Error parsing PrusaSlicer config file, it is probably corrupted. "
|
||||
"Try to manualy delete the file to recover from the error. Your user profiles will not be affected.")) +
|
||||
"\n\n" + AppConfig::config_path() + "\n\n" + ex.what());
|
||||
}
|
||||
|
||||
// 2) Parse the property_tree, extract the sections and key / value pairs.
|
||||
for (const auto §ion : tree) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "libslic3r/Config.hpp"
|
||||
#include "slic3r/Utils/Semver.hpp"
|
||||
#include "libslic3r/Semver.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
|
|
|||
|
|
@ -151,7 +151,12 @@ void BackgroundSlicingProcess::thread_proc()
|
|||
} catch (CanceledException & /* ex */) {
|
||||
// Canceled, this is all right.
|
||||
assert(m_print->canceled());
|
||||
} catch (std::exception &ex) {
|
||||
} catch (const std::bad_alloc& ex) {
|
||||
wxString errmsg = wxString::Format(_(L("%s has encountered an error. It was likely caused by running out of memory. "
|
||||
"If you are sure you have enough RAM on your system, this may also be a bug and we would "
|
||||
"be glad if you reported it.")), SLIC3R_APP_NAME);
|
||||
error = errmsg.ToStdString() + "\n\n" + std::string(ex.what());
|
||||
} catch (std::exception &ex) {
|
||||
error = ex.what();
|
||||
} catch (...) {
|
||||
error = "Unknown C++ exception.";
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "PresetBundle.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_Utils.hpp"
|
||||
#include "slic3r/Config/Snapshot.hpp"
|
||||
#include "slic3r/Utils/PresetUpdater.hpp"
|
||||
|
||||
|
||||
|
|
@ -32,6 +33,10 @@ namespace Slic3r {
|
|||
namespace GUI {
|
||||
|
||||
|
||||
using Config::Snapshot;
|
||||
using Config::SnapshotDB;
|
||||
|
||||
|
||||
// Printer model picker GUI control
|
||||
|
||||
struct PrinterPickerEvent : public wxEvent
|
||||
|
|
@ -1025,15 +1030,33 @@ void ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
|
|||
|
||||
// Decide whether to create snapshot based on run_reason and the reset profile checkbox
|
||||
bool snapshot = true;
|
||||
Snapshot::Reason snapshot_reason = Snapshot::SNAPSHOT_UPGRADE;
|
||||
switch (run_reason) {
|
||||
case ConfigWizard::RR_DATA_EMPTY: snapshot = false; break;
|
||||
case ConfigWizard::RR_DATA_LEGACY: snapshot = true; break;
|
||||
case ConfigWizard::RR_DATA_INCOMPAT: snapshot = false; break; // In this case snapshot is done by PresetUpdater with the appropriate reason
|
||||
case ConfigWizard::RR_USER: snapshot = page_welcome->reset_user_profile(); break;
|
||||
case ConfigWizard::RR_DATA_EMPTY:
|
||||
snapshot = false;
|
||||
break;
|
||||
case ConfigWizard::RR_DATA_LEGACY:
|
||||
snapshot = true;
|
||||
break;
|
||||
case ConfigWizard::RR_DATA_INCOMPAT:
|
||||
// In this case snapshot has already been taken by
|
||||
// PresetUpdater with the appropriate reason
|
||||
snapshot = false;
|
||||
break;
|
||||
case ConfigWizard::RR_USER:
|
||||
snapshot = page_welcome->reset_user_profile();
|
||||
snapshot_reason = Snapshot::SNAPSHOT_USER;
|
||||
break;
|
||||
}
|
||||
|
||||
if (snapshot) {
|
||||
SnapshotDB::singleton().take_snapshot(*app_config, snapshot_reason);
|
||||
}
|
||||
|
||||
if (install_bundles.size() > 0) {
|
||||
// Install bundles from resources.
|
||||
updater->install_bundles_rsrc(std::move(install_bundles), snapshot);
|
||||
// Don't create snapshot - we've already done that above if applicable.
|
||||
updater->install_bundles_rsrc(std::move(install_bundles), false);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << "No bundles need to be installed from resources";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,8 +206,8 @@ void Field::get_value_by_opt_type(wxString& str)
|
|||
const wxString msg_text = wxString::Format(_(L("Do you mean %s%% instead of %s %s?\n"
|
||||
"Select YES if you want to change this value to %s%%, \n"
|
||||
"or NO if you are sure that %s %s is a correct value.")), stVal, stVal, sidetext, stVal, stVal, sidetext);
|
||||
auto dialog = new wxMessageDialog(m_parent, msg_text, _(L("Parameter validation")), wxICON_WARNING | wxYES | wxNO);
|
||||
if (dialog->ShowModal() == wxID_YES) {
|
||||
wxMessageDialog dialog(m_parent, msg_text, _(L("Parameter validation")), wxICON_WARNING | wxYES | wxNO);
|
||||
if (dialog.ShowModal() == wxID_YES) {
|
||||
set_value(wxString::Format("%s%%", stVal), false/*true*/);
|
||||
str += "%%";
|
||||
}
|
||||
|
|
@ -559,7 +559,16 @@ void SpinCtrl::BUILD() {
|
|||
break;
|
||||
}
|
||||
|
||||
const int min_val = m_opt.min == INT_MIN ? 0: m_opt.min;
|
||||
const int min_val = m_opt.min == INT_MIN
|
||||
#ifdef __WXOSX__
|
||||
// We will forcibly set the input value for SpinControl, since the value
|
||||
// inserted from the keyboard is not updated under OSX.
|
||||
// So, we can't set min control value bigger then 0.
|
||||
// Otherwise, it couldn't be possible to input from keyboard value
|
||||
// less then min_val.
|
||||
|| m_opt.min > 0
|
||||
#endif
|
||||
? 0 : m_opt.min;
|
||||
const int max_val = m_opt.max < 2147483647 ? m_opt.max : 2147483647;
|
||||
|
||||
auto temp = new wxSpinCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size,
|
||||
|
|
@ -628,16 +637,24 @@ void SpinCtrl::BUILD() {
|
|||
|
||||
void SpinCtrl::propagate_value()
|
||||
{
|
||||
if (suppress_propagating)
|
||||
if (suppress_propagation)
|
||||
return;
|
||||
|
||||
suppress_propagating = true;
|
||||
suppress_propagation = true;
|
||||
if (tmp_value == UNDEF_VALUE) {
|
||||
on_kill_focus();
|
||||
} else {
|
||||
#ifdef __WXOSX__
|
||||
// check input value for minimum
|
||||
if (m_opt.min > 0 && tmp_value < m_opt.min) {
|
||||
wxSpinCtrl* spin = static_cast<wxSpinCtrl*>(window);
|
||||
spin->SetValue(m_opt.min);
|
||||
spin->GetText()->SetInsertionPointEnd();
|
||||
}
|
||||
#endif
|
||||
on_change_field();
|
||||
}
|
||||
suppress_propagating = false;
|
||||
suppress_propagation = false;
|
||||
}
|
||||
|
||||
void SpinCtrl::msw_rescale()
|
||||
|
|
@ -1021,11 +1038,12 @@ void ColourPicker::BUILD()
|
|||
// Validate the color
|
||||
wxString clr_str(m_opt.get_default_value<ConfigOptionStrings>()->get_at(m_opt_idx));
|
||||
wxColour clr(clr_str);
|
||||
if (! clr.IsOk()) {
|
||||
if (clr_str.IsEmpty() || !clr.IsOk()) {
|
||||
clr = wxTransparentColour;
|
||||
}
|
||||
|
||||
auto temp = new wxColourPickerCtrl(m_parent, wxID_ANY, clr, wxDefaultPosition, size);
|
||||
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
|
||||
// // recast as a wxWindow to fit the calling convention
|
||||
|
|
@ -1036,17 +1054,59 @@ void ColourPicker::BUILD()
|
|||
temp->SetToolTip(get_tooltip_text(clr_str));
|
||||
}
|
||||
|
||||
void ColourPicker::set_undef_value(wxColourPickerCtrl* field)
|
||||
{
|
||||
field->SetColour(wxTransparentColour);
|
||||
|
||||
wxButton* btn = dynamic_cast<wxButton*>(field->GetPickerCtrl());
|
||||
wxBitmap bmp = btn->GetBitmap();
|
||||
wxMemoryDC dc(bmp);
|
||||
dc.SetTextForeground(*wxWHITE);
|
||||
dc.SetFont(wxGetApp().normal_font());
|
||||
|
||||
const wxRect rect = wxRect(0, 0, bmp.GetWidth(), bmp.GetHeight());
|
||||
dc.DrawLabel("undef", rect, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
dc.SelectObject(wxNullBitmap);
|
||||
btn->SetBitmapLabel(bmp);
|
||||
}
|
||||
|
||||
void ColourPicker::set_value(const boost::any& value, bool change_event)
|
||||
{
|
||||
m_disable_change_event = !change_event;
|
||||
const wxString clr_str(boost::any_cast<wxString>(value));
|
||||
auto field = dynamic_cast<wxColourPickerCtrl*>(window);
|
||||
|
||||
wxColour clr(clr_str);
|
||||
if (clr_str.IsEmpty() || !clr.IsOk())
|
||||
set_undef_value(field);
|
||||
else
|
||||
field->SetColour(clr);
|
||||
|
||||
m_disable_change_event = false;
|
||||
}
|
||||
|
||||
boost::any& ColourPicker::get_value()
|
||||
{
|
||||
// boost::any m_value;
|
||||
|
||||
auto colour = static_cast<wxColourPickerCtrl*>(window)->GetColour();
|
||||
auto clr_str = wxString::Format(wxT("#%02X%02X%02X"), colour.Red(), colour.Green(), colour.Blue());
|
||||
m_value = clr_str.ToStdString();
|
||||
|
||||
if (colour == wxTransparentColour)
|
||||
m_value = std::string("");
|
||||
else {
|
||||
auto clr_str = wxString::Format(wxT("#%02X%02X%02X"), colour.Red(), colour.Green(), colour.Blue());
|
||||
m_value = clr_str.ToStdString();
|
||||
}
|
||||
return m_value;
|
||||
}
|
||||
|
||||
void ColourPicker::msw_rescale()
|
||||
{
|
||||
Field::msw_rescale();
|
||||
|
||||
wxColourPickerCtrl* field = dynamic_cast<wxColourPickerCtrl*>(window);
|
||||
if (field->GetColour() == wxTransparentColour)
|
||||
set_undef_value(field);
|
||||
}
|
||||
|
||||
void PointCtrl::BUILD()
|
||||
{
|
||||
auto temp = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
|
|
|||
|
|
@ -406,6 +406,8 @@ public:
|
|||
|
||||
class ColourPicker : public Field {
|
||||
using Field::Field;
|
||||
|
||||
void set_undef_value(wxColourPickerCtrl* field);
|
||||
public:
|
||||
ColourPicker(const ConfigOptionDef& opt, const t_config_option_key& id) : Field(opt, id) {}
|
||||
ColourPicker(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : Field(parent, opt, id) {}
|
||||
|
|
@ -419,13 +421,9 @@ public:
|
|||
dynamic_cast<wxColourPickerCtrl*>(window)->SetColour(value);
|
||||
m_disable_change_event = false;
|
||||
}
|
||||
void set_value(const boost::any& value, bool change_event = false) {
|
||||
m_disable_change_event = !change_event;
|
||||
dynamic_cast<wxColourPickerCtrl*>(window)->SetColour(boost::any_cast<wxString>(value));
|
||||
m_disable_change_event = false;
|
||||
}
|
||||
|
||||
void set_value(const boost::any& value, bool change_event = false) override;
|
||||
boost::any& get_value() override;
|
||||
void msw_rescale() override;
|
||||
|
||||
void enable() override { dynamic_cast<wxColourPickerCtrl*>(window)->Enable(); };
|
||||
void disable() override{ dynamic_cast<wxColourPickerCtrl*>(window)->Disable(); };
|
||||
|
|
|
|||
|
|
@ -2474,6 +2474,13 @@ void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt)
|
|||
evt.SetY(evt.GetY() * scale);
|
||||
#endif
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// For some reason the Idle event is not being generated after the mouse scroll event in case of scrolling with the two fingers on the touch pad,
|
||||
// if the event is not allowed to be passed further.
|
||||
// https://github.com/prusa3d/PrusaSlicer/issues/2750
|
||||
evt.Skip();
|
||||
#endif /* __WXMSW__ */
|
||||
|
||||
// Performs layers editing updates, if enabled
|
||||
if (is_layers_editing_enabled())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -126,7 +126,16 @@ static void generic_exception_handle()
|
|||
|
||||
try {
|
||||
throw;
|
||||
} catch (const std::exception &ex) {
|
||||
} catch (const std::bad_alloc& ex) {
|
||||
// bad_alloc in main thread is most likely fatal. Report immediately to the user (wxLogError would be delayed)
|
||||
// and terminate the app so it is at least certain to happen now.
|
||||
wxString errmsg = wxString::Format(_(L("%s has encountered an error. It was likely caused by running out of memory. "
|
||||
"If you are sure you have enough RAM on your system, this may also be a bug and we would "
|
||||
"be glad if you reported it.\n\nThe application will now terminate.")), SLIC3R_APP_NAME);
|
||||
wxMessageBox(errmsg + "\n\n" + wxString(ex.what()), _(L("Fatal error")), wxOK | wxICON_ERROR);
|
||||
BOOST_LOG_TRIVIAL(error) << boost::format("std::bad_alloc exception: %1%") % ex.what();
|
||||
std::terminate();
|
||||
} catch (const std::exception& ex) {
|
||||
wxLogError("Internal error: %s", ex.what());
|
||||
BOOST_LOG_TRIVIAL(error) << boost::format("Uncaught exception: %1%") % ex.what();
|
||||
throw;
|
||||
|
|
@ -284,6 +293,20 @@ bool GUI_App::on_init_inner()
|
|||
config_wizard_startup(app_conf_exists);
|
||||
preset_updater->slic3r_update_notify();
|
||||
preset_updater->sync(preset_bundle);
|
||||
const GLCanvas3DManager::GLInfo &glinfo = GLCanvas3DManager::get_gl_info();
|
||||
if (! glinfo.is_version_greater_or_equal_to(2, 0)) {
|
||||
// Complain about the OpenGL version.
|
||||
wxString message = wxString::Format(
|
||||
_(L("PrusaSlicer requires OpenGL 2.0 capable graphics driver to run correctly, \n"
|
||||
"while OpenGL version %s, render %s, vendor %s was detected.")), wxString(glinfo.get_version()), wxString(glinfo.get_renderer()), wxString(glinfo.get_vendor()));
|
||||
message += "\n";
|
||||
message += _(L("You may need to update your graphics card driver."));
|
||||
#ifdef _WIN32
|
||||
message += "\n";
|
||||
message += _(L("As a workaround, you may run PrusaSlicer with a software rendered 3D graphics by running prusa-slicer.exe with the --sw_renderer parameter."));
|
||||
#endif
|
||||
wxMessageBox(message, wxString("PrusaSlicer - ") + _(L("Unsupported OpenGL version")), wxOK | wxICON_ERROR);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -134,7 +134,11 @@ ObjectList::ObjectList(wxWindow* parent) :
|
|||
selection_changed();
|
||||
#ifndef __WXMSW__
|
||||
set_tooltip_for_item(get_mouse_position_in_control());
|
||||
#endif //__WXMSW__
|
||||
#endif //__WXMSW__
|
||||
|
||||
#ifndef __WXOSX__
|
||||
list_manipulation();
|
||||
#endif //__WXOSX__
|
||||
});
|
||||
|
||||
#ifdef __WXOSX__
|
||||
|
|
@ -169,7 +173,7 @@ ObjectList::ObjectList(wxWindow* parent) :
|
|||
|
||||
#ifdef __WXMSW__
|
||||
GetMainWindow()->Bind(wxEVT_MOTION, [this](wxMouseEvent& event) {
|
||||
set_tooltip_for_item(/*event.GetPosition()*/get_mouse_position_in_control());
|
||||
set_tooltip_for_item(get_mouse_position_in_control());
|
||||
event.Skip();
|
||||
});
|
||||
#endif //__WXMSW__
|
||||
|
|
@ -330,28 +334,34 @@ void ObjectList::set_tooltip_for_item(const wxPoint& pt)
|
|||
* Just this->SetToolTip(tooltip) => has no effect.
|
||||
*/
|
||||
|
||||
if (!item)
|
||||
if (!item || GetSelectedItemsCount() > 1)
|
||||
{
|
||||
GetMainWindow()->SetToolTip(""); // hide tooltip
|
||||
return;
|
||||
}
|
||||
|
||||
if (col->GetTitle() == _(L("Editing")) && GetSelectedItemsCount()<2)
|
||||
GetMainWindow()->SetToolTip(_(L("Right button click the icon to change the object settings")));
|
||||
else if (col->GetTitle() == _("Name"))
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
if (pt.x < 2 * wxGetApp().em_unit() || pt.x > 4 * wxGetApp().em_unit()) {
|
||||
GetMainWindow()->SetToolTip(""); // hide tooltip
|
||||
return;
|
||||
}
|
||||
wxString tooltip = "";
|
||||
|
||||
if (col->GetTitle() == _(L("Editing")))
|
||||
#ifdef __WXOSX__
|
||||
tooltip = _(L("Right button click the icon to change the object settings"));
|
||||
#else
|
||||
tooltip = _(L("Click the icon to change the object settings"));
|
||||
#endif //__WXMSW__
|
||||
else if (col->GetTitle() == " ")
|
||||
#ifdef __WXOSX__
|
||||
tooltip = _(L("Right button click the icon to change the object printable property"));
|
||||
#else
|
||||
tooltip = _(L("Click the icon to change the object printable property"));
|
||||
#endif //__WXMSW__
|
||||
else if (col->GetTitle() == _("Name") && (pt.x >= 2 * wxGetApp().em_unit() && pt.x <= 4 * wxGetApp().em_unit()))
|
||||
{
|
||||
int obj_idx, vol_idx;
|
||||
get_selected_item_indexes(obj_idx, vol_idx, item);
|
||||
GetMainWindow()->SetToolTip(get_mesh_errors_list(obj_idx, vol_idx));
|
||||
tooltip = get_mesh_errors_list(obj_idx, vol_idx);
|
||||
}
|
||||
else
|
||||
GetMainWindow()->SetToolTip(""); // hide tooltip
|
||||
|
||||
GetMainWindow()->SetToolTip(tooltip);
|
||||
}
|
||||
|
||||
wxPoint ObjectList::get_mouse_position_in_control()
|
||||
|
|
@ -744,6 +754,11 @@ void ObjectList::OnChar(wxKeyEvent& event)
|
|||
#endif /* __WXOSX__ */
|
||||
|
||||
void ObjectList::OnContextMenu(wxDataViewEvent&)
|
||||
{
|
||||
list_manipulation();
|
||||
}
|
||||
|
||||
void ObjectList::list_manipulation()
|
||||
{
|
||||
wxDataViewItem item;
|
||||
wxDataViewColumn* col;
|
||||
|
|
@ -2291,14 +2306,14 @@ void ObjectList::add_object_to_list(size_t obj_idx, bool call_selection_changed)
|
|||
{
|
||||
std::vector<bool> print_idicator(model_object->instances.size());
|
||||
for (int i = 0; i < model_object->instances.size(); ++i)
|
||||
print_idicator[i] = model_object->instances[i]->is_printable();
|
||||
print_idicator[i] = model_object->instances[i]->printable;
|
||||
|
||||
const wxDataViewItem object_item = m_objects_model->GetItemById(obj_idx);
|
||||
m_objects_model->AddInstanceChild(object_item, print_idicator);
|
||||
Expand(m_objects_model->GetInstanceRootItem(object_item));
|
||||
}
|
||||
else
|
||||
m_objects_model->SetPrintableState(model_object->instances[0]->is_printable() ? piPrintable : piUnprintable, obj_idx);
|
||||
m_objects_model->SetPrintableState(model_object->instances[0]->printable ? piPrintable : piUnprintable, obj_idx);
|
||||
|
||||
// add settings to the object, if it has those
|
||||
add_settings_item(item, &model_object->config);
|
||||
|
|
|
|||
|
|
@ -358,6 +358,7 @@ private:
|
|||
// void OnChar(wxKeyEvent& event);
|
||||
#endif /* __WXOSX__ */
|
||||
void OnContextMenu(wxDataViewEvent &event);
|
||||
void list_manipulation();
|
||||
|
||||
void OnBeginDrag(wxDataViewEvent &event);
|
||||
void OnDropPossible(wxDataViewEvent &event);
|
||||
|
|
|
|||
|
|
@ -153,8 +153,8 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
|
|||
|
||||
auto manifold_warning_icon = [this](wxWindow* parent) {
|
||||
m_fix_throught_netfab_bitmap = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap);
|
||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(m_fix_throught_netfab_bitmap);
|
||||
// auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
// sizer->Add(m_fix_throught_netfab_bitmap);
|
||||
|
||||
if (is_windows10())
|
||||
m_fix_throught_netfab_bitmap->Bind(wxEVT_CONTEXT_MENU, [this](wxCommandEvent &e)
|
||||
|
|
@ -167,17 +167,19 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
|
|||
update_warning_icon_state(wxGetApp().obj_list()->get_mesh_errors_list());
|
||||
});
|
||||
|
||||
return sizer;
|
||||
// return sizer;
|
||||
return m_fix_throught_netfab_bitmap;
|
||||
};
|
||||
|
||||
line.append_widget(manifold_warning_icon);
|
||||
// line.append_widget(manifold_warning_icon);
|
||||
line.near_label_widget = manifold_warning_icon;
|
||||
def.label = "";
|
||||
def.gui_type = "legend";
|
||||
def.tooltip = L("Object name");
|
||||
#ifdef __APPLE__
|
||||
def.width = 19;
|
||||
def.width = 20;
|
||||
#else
|
||||
def.width = 21;
|
||||
def.width = 22;
|
||||
#endif
|
||||
def.set_default_value(new ConfigOptionString{ " " });
|
||||
line.append_option(Option(def, "object_name"));
|
||||
|
|
@ -392,10 +394,19 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
|
|||
|
||||
// call back for a rescale of button "Set uniform scale"
|
||||
m_og->rescale_near_label_widget = [this](wxWindow* win) {
|
||||
// rescale lock icon
|
||||
auto *ctrl = dynamic_cast<LockButton*>(win);
|
||||
if (ctrl == nullptr)
|
||||
if (ctrl != nullptr) {
|
||||
ctrl->msw_rescale();
|
||||
return;
|
||||
ctrl->msw_rescale();
|
||||
}
|
||||
|
||||
if (win == m_fix_throught_netfab_bitmap)
|
||||
return;
|
||||
|
||||
// rescale "place" of the empty icon (to correct layout of the "Size" and "Scale")
|
||||
if (dynamic_cast<wxStaticBitmap*>(win) != nullptr)
|
||||
win->SetMinSize(create_scaled_bitmap(m_parent, "one_layer_lock_on.png").GetSize());
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -685,6 +696,7 @@ void ObjectManipulation::emulate_kill_focus()
|
|||
void ObjectManipulation::update_warning_icon_state(const wxString& tooltip)
|
||||
{
|
||||
m_fix_throught_netfab_bitmap->SetBitmap(tooltip.IsEmpty() ? wxNullBitmap : m_manifold_warning_bmp.bmp());
|
||||
m_fix_throught_netfab_bitmap->SetMinSize(tooltip.IsEmpty() ? wxSize(0,0) : m_manifold_warning_bmp.bmp().GetSize());
|
||||
m_fix_throught_netfab_bitmap->SetToolTip(tooltip);
|
||||
}
|
||||
|
||||
|
|
@ -919,7 +931,10 @@ void ObjectManipulation::msw_rescale()
|
|||
{
|
||||
msw_rescale_word_local_combo(m_word_local_combo);
|
||||
m_manifold_warning_bmp.msw_rescale();
|
||||
m_fix_throught_netfab_bitmap->SetBitmap(m_manifold_warning_bmp.bmp());
|
||||
|
||||
const wxString& tooltip = m_fix_throught_netfab_bitmap->GetToolTipText();
|
||||
m_fix_throught_netfab_bitmap->SetBitmap(tooltip.IsEmpty() ? wxNullBitmap : m_manifold_warning_bmp.bmp());
|
||||
m_fix_throught_netfab_bitmap->SetMinSize(tooltip.IsEmpty() ? wxSize(0, 0) : m_manifold_warning_bmp.bmp().GetSize());
|
||||
|
||||
m_mirror_bitmap_on.msw_rescale();
|
||||
m_mirror_bitmap_off.msw_rescale();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ template<class F> typename F::FN winapi_get_function(const wchar_t *dll, const c
|
|||
static HINSTANCE dll_handle = LoadLibraryExW(dll, nullptr, 0);
|
||||
|
||||
if (dll_handle == nullptr) { return nullptr; }
|
||||
return (F::FN)GetProcAddress(dll_handle, fn_name);
|
||||
return (typename F::FN)GetProcAddress(dll_handle, fn_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,12 @@ public:
|
|||
m_prev_scale_factor = m_scale_factor;
|
||||
m_normal_font = get_default_font_for_dpi(dpi);
|
||||
|
||||
/* Because of default window font is a primary display font,
|
||||
* We should set correct font for window before getting em_unit value.
|
||||
*/
|
||||
#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
|
||||
this->SetFont(m_normal_font);
|
||||
#endif
|
||||
// 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);
|
||||
|
||||
|
|
@ -72,6 +78,8 @@ public:
|
|||
this->Bind(EVT_DPI_CHANGED, [this](const DpiChangedEvent &evt) {
|
||||
m_scale_factor = (float)evt.dpi / (float)DPI_DEFAULT;
|
||||
|
||||
m_new_font_point_size = get_default_font_for_dpi(evt.dpi).GetPointSize();
|
||||
|
||||
if (!m_can_rescale)
|
||||
return;
|
||||
|
||||
|
|
@ -124,6 +132,8 @@ private:
|
|||
float m_prev_scale_factor;
|
||||
bool m_can_rescale{ true };
|
||||
|
||||
int m_new_font_point_size;
|
||||
|
||||
// void recalc_font()
|
||||
// {
|
||||
// wxClientDC dc(this);
|
||||
|
|
@ -135,14 +145,22 @@ private:
|
|||
// check if new scale is differ from previous
|
||||
bool is_new_scale_factor() const { return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }
|
||||
|
||||
// function for a font scaling of the window
|
||||
void scale_win_font(wxWindow *window, const int font_point_size)
|
||||
{
|
||||
wxFont new_font(window->GetFont());
|
||||
new_font.SetPointSize(font_point_size);
|
||||
window->SetFont(new_font);
|
||||
}
|
||||
|
||||
// recursive function for scaling fonts for all controls in Window
|
||||
void scale_controls_fonts(wxWindow *window, const float scale_f)
|
||||
void scale_controls_fonts(wxWindow *window, const int font_point_size)
|
||||
{
|
||||
auto children = window->GetChildren();
|
||||
|
||||
for (auto child : children) {
|
||||
scale_controls_fonts(child, scale_f);
|
||||
child->SetFont(child->GetFont().Scaled(scale_f));
|
||||
scale_controls_fonts(child, font_point_size);
|
||||
scale_win_font(child, font_point_size);
|
||||
}
|
||||
|
||||
window->Layout();
|
||||
|
|
@ -151,18 +169,18 @@ private:
|
|||
void rescale(const wxRect &suggested_rect)
|
||||
{
|
||||
this->Freeze();
|
||||
const float relative_scale_factor = m_scale_factor / m_prev_scale_factor;
|
||||
|
||||
// rescale fonts of all controls
|
||||
scale_controls_fonts(this, relative_scale_factor);
|
||||
this->SetFont(this->GetFont().Scaled(relative_scale_factor));
|
||||
scale_controls_fonts(this, m_new_font_point_size);
|
||||
// rescale current window font
|
||||
scale_win_font(this, m_new_font_point_size);
|
||||
|
||||
|
||||
// rescale normal_font value
|
||||
m_normal_font = m_normal_font.Scaled(relative_scale_factor);
|
||||
// set normal application font as a current window font
|
||||
m_normal_font = this->GetFont();
|
||||
|
||||
// An analog of em_unit value from GUI_App.
|
||||
m_em_unit = std::max<size_t>(10, 10 * m_scale_factor);
|
||||
// update em_unit value for new window font
|
||||
m_em_unit = std::max<size_t>(10, this->GetTextExtent("m").x - 1);
|
||||
|
||||
// rescale missed controls sizes and images
|
||||
on_dpi_changed(suggested_rect);
|
||||
|
|
|
|||
|
|
@ -39,10 +39,12 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
|
|||
{
|
||||
// Fonts were created by the DPIFrame constructor for the monitor, on which the window opened.
|
||||
wxGetApp().update_fonts(this);
|
||||
/*
|
||||
#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
|
||||
this->SetFont(this->normal_font());
|
||||
#endif
|
||||
|
||||
// Font is already set in DPIFrame constructor
|
||||
*/
|
||||
// Load the icon either from the exe, or from the ico file.
|
||||
#if _WIN32
|
||||
{
|
||||
|
|
@ -729,29 +731,26 @@ void MainFrame::quick_slice(const int qs)
|
|||
|
||||
// select input file
|
||||
if (!(qs & qsReslice)) {
|
||||
auto dlg = new wxFileDialog(this, _(L("Choose a file to slice (STL/OBJ/AMF/3MF/PRUSA):")),
|
||||
wxFileDialog dlg(this, _(L("Choose a file to slice (STL/OBJ/AMF/3MF/PRUSA):")),
|
||||
wxGetApp().app_config->get_last_dir(), "",
|
||||
file_wildcards(FT_MODEL), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (dlg->ShowModal() != wxID_OK) {
|
||||
dlg->Destroy();
|
||||
if (dlg.ShowModal() != wxID_OK)
|
||||
return;
|
||||
}
|
||||
input_file = dlg->GetPath();
|
||||
dlg->Destroy();
|
||||
input_file = dlg.GetPath();
|
||||
if (!(qs & qsExportSVG))
|
||||
m_qs_last_input_file = input_file;
|
||||
}
|
||||
else {
|
||||
if (m_qs_last_input_file.IsEmpty()) {
|
||||
auto dlg = new wxMessageDialog(this, _(L("No previously sliced file.")),
|
||||
wxMessageDialog dlg(this, _(L("No previously sliced file.")),
|
||||
_(L("Error")), wxICON_ERROR | wxOK);
|
||||
dlg->ShowModal();
|
||||
dlg.ShowModal();
|
||||
return;
|
||||
}
|
||||
if (std::ifstream(m_qs_last_input_file.ToUTF8().data())) {
|
||||
auto dlg = new wxMessageDialog(this, _(L("Previously sliced file ("))+m_qs_last_input_file+_(L(") not found.")),
|
||||
wxMessageDialog dlg(this, _(L("Previously sliced file ("))+m_qs_last_input_file+_(L(") not found.")),
|
||||
_(L("File Not Found")), wxICON_ERROR | wxOK);
|
||||
dlg->ShowModal();
|
||||
dlg.ShowModal();
|
||||
return;
|
||||
}
|
||||
input_file = m_qs_last_input_file;
|
||||
|
|
@ -785,30 +784,24 @@ void MainFrame::quick_slice(const int qs)
|
|||
}
|
||||
else if (qs & qsSaveAs) {
|
||||
// The following line may die if the output_filename_format template substitution fails.
|
||||
auto dlg = new wxFileDialog(this, wxString::Format(_(L("Save %s file as:")) , qs & qsExportSVG ? _(L("SVG")) : _(L("G-code")) ),
|
||||
wxFileDialog dlg(this, wxString::Format(_(L("Save %s file as:")) , qs & qsExportSVG ? _(L("SVG")) : _(L("G-code")) ),
|
||||
wxGetApp().app_config->get_last_output_dir(get_dir_name(output_file)), get_base_name(input_file),
|
||||
qs & qsExportSVG ? file_wildcards(FT_SVG) : file_wildcards(FT_GCODE),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
if (dlg->ShowModal() != wxID_OK) {
|
||||
dlg->Destroy();
|
||||
if (dlg.ShowModal() != wxID_OK)
|
||||
return;
|
||||
}
|
||||
output_file = dlg->GetPath();
|
||||
dlg->Destroy();
|
||||
output_file = dlg.GetPath();
|
||||
if (!(qs & qsExportSVG))
|
||||
m_qs_last_output_file = output_file;
|
||||
wxGetApp().app_config->update_last_output_dir(get_dir_name(output_file));
|
||||
}
|
||||
else if (qs & qsExportPNG) {
|
||||
auto dlg = new wxFileDialog(this, _(L("Save zip file as:")),
|
||||
wxFileDialog dlg(this, _(L("Save zip file as:")),
|
||||
wxGetApp().app_config->get_last_output_dir(get_dir_name(output_file)),
|
||||
get_base_name(output_file), "*.sl1", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
if (dlg->ShowModal() != wxID_OK) {
|
||||
dlg->Destroy();
|
||||
if (dlg.ShowModal() != wxID_OK)
|
||||
return;
|
||||
}
|
||||
output_file = dlg->GetPath();
|
||||
dlg->Destroy();
|
||||
output_file = dlg.GetPath();
|
||||
}
|
||||
|
||||
// show processbar dialog
|
||||
|
|
@ -854,28 +847,22 @@ void MainFrame::repair_stl()
|
|||
{
|
||||
wxString input_file;
|
||||
{
|
||||
auto dlg = new wxFileDialog(this, _(L("Select the STL file to repair:")),
|
||||
wxFileDialog dlg(this, _(L("Select the STL file to repair:")),
|
||||
wxGetApp().app_config->get_last_dir(), "",
|
||||
file_wildcards(FT_STL), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (dlg->ShowModal() != wxID_OK) {
|
||||
dlg->Destroy();
|
||||
if (dlg.ShowModal() != wxID_OK)
|
||||
return;
|
||||
}
|
||||
input_file = dlg->GetPath();
|
||||
dlg->Destroy();
|
||||
input_file = dlg.GetPath();
|
||||
}
|
||||
|
||||
wxString output_file = input_file;
|
||||
{
|
||||
auto dlg = new wxFileDialog( this, L("Save OBJ file (less prone to coordinate errors than STL) as:"),
|
||||
wxFileDialog dlg( this, L("Save OBJ file (less prone to coordinate errors than STL) as:"),
|
||||
get_dir_name(output_file), get_base_name(output_file, ".obj"),
|
||||
file_wildcards(FT_OBJ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
if (dlg->ShowModal() != wxID_OK) {
|
||||
dlg->Destroy();
|
||||
if (dlg.ShowModal() != wxID_OK)
|
||||
return;
|
||||
}
|
||||
output_file = dlg->GetPath();
|
||||
dlg->Destroy();
|
||||
output_file = dlg.GetPath();
|
||||
}
|
||||
|
||||
auto tmesh = new Slic3r::TriangleMesh();
|
||||
|
|
@ -896,14 +883,13 @@ void MainFrame::export_config()
|
|||
return;
|
||||
}
|
||||
// Ask user for the file name for the config file.
|
||||
auto dlg = new wxFileDialog(this, _(L("Save configuration as:")),
|
||||
wxFileDialog dlg(this, _(L("Save configuration as:")),
|
||||
!m_last_config.IsEmpty() ? get_dir_name(m_last_config) : wxGetApp().app_config->get_last_dir(),
|
||||
!m_last_config.IsEmpty() ? get_base_name(m_last_config) : "config.ini",
|
||||
file_wildcards(FT_INI), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
wxString file;
|
||||
if (dlg->ShowModal() == wxID_OK)
|
||||
file = dlg->GetPath();
|
||||
dlg->Destroy();
|
||||
if (dlg.ShowModal() == wxID_OK)
|
||||
file = dlg.GetPath();
|
||||
if (!file.IsEmpty()) {
|
||||
wxGetApp().app_config->update_config_dir(get_dir_name(file));
|
||||
m_last_config = file;
|
||||
|
|
@ -916,13 +902,12 @@ void MainFrame::load_config_file()
|
|||
{
|
||||
if (!wxGetApp().check_unsaved_changes())
|
||||
return;
|
||||
auto dlg = new wxFileDialog(this, _(L("Select configuration to load:")),
|
||||
wxFileDialog dlg(this, _(L("Select configuration to load:")),
|
||||
!m_last_config.IsEmpty() ? get_dir_name(m_last_config) : wxGetApp().app_config->get_last_dir(),
|
||||
"config.ini", "INI files (*.ini, *.gcode)|*.ini;*.INI;*.gcode;*.g", wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
wxString file;
|
||||
if (dlg->ShowModal() == wxID_OK)
|
||||
file = dlg->GetPath();
|
||||
dlg->Destroy();
|
||||
if (dlg.ShowModal() == wxID_OK)
|
||||
file = dlg.GetPath();
|
||||
if (! file.IsEmpty() && this->load_config_file(file.ToUTF8().data())) {
|
||||
wxGetApp().app_config->update_config_dir(get_dir_name(file));
|
||||
m_last_config = file;
|
||||
|
|
@ -953,14 +938,13 @@ void MainFrame::export_configbundle()
|
|||
return;
|
||||
}
|
||||
// Ask user for a file name.
|
||||
auto dlg = new wxFileDialog(this, _(L("Save presets bundle as:")),
|
||||
wxFileDialog dlg(this, _(L("Save presets bundle as:")),
|
||||
!m_last_config.IsEmpty() ? get_dir_name(m_last_config) : wxGetApp().app_config->get_last_dir(),
|
||||
SLIC3R_APP_KEY "_config_bundle.ini",
|
||||
file_wildcards(FT_INI), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
wxString file;
|
||||
if (dlg->ShowModal() == wxID_OK)
|
||||
file = dlg->GetPath();
|
||||
dlg->Destroy();
|
||||
if (dlg.ShowModal() == wxID_OK)
|
||||
file = dlg.GetPath();
|
||||
if (!file.IsEmpty()) {
|
||||
// Export the config bundle.
|
||||
wxGetApp().app_config->update_config_dir(get_dir_name(file));
|
||||
|
|
@ -980,15 +964,12 @@ void MainFrame::load_configbundle(wxString file/* = wxEmptyString, const bool re
|
|||
if (!wxGetApp().check_unsaved_changes())
|
||||
return;
|
||||
if (file.IsEmpty()) {
|
||||
auto dlg = new wxFileDialog(this, _(L("Select configuration to load:")),
|
||||
wxFileDialog dlg(this, _(L("Select configuration to load:")),
|
||||
!m_last_config.IsEmpty() ? get_dir_name(m_last_config) : wxGetApp().app_config->get_last_dir(),
|
||||
"config.ini", file_wildcards(FT_INI), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (dlg->ShowModal() != wxID_OK) {
|
||||
dlg->Destroy();
|
||||
return;
|
||||
}
|
||||
file = dlg->GetPath();
|
||||
dlg->Destroy();
|
||||
if (dlg.ShowModal() != wxID_OK)
|
||||
return;
|
||||
file = dlg.GetPath();
|
||||
}
|
||||
|
||||
wxGetApp().app_config->update_config_dir(get_dir_name(file));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef slic3r_MainFrame_hpp_
|
||||
#ifndef slic3r_MainFrame_hpp_
|
||||
#define slic3r_MainFrame_hpp_
|
||||
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@
|
|||
#include <wx/font.h>
|
||||
#include <wx/bitmap.h>
|
||||
|
||||
#include "slic3r/Utils/Semver.hpp"
|
||||
|
||||
class wxBoxSizer;
|
||||
class wxCheckBox;
|
||||
class wxStaticBitmap;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "OptionsGroup.hpp"
|
||||
#include "OptionsGroup.hpp"
|
||||
#include "ConfigExceptions.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
|
|
|||
|
|
@ -290,17 +290,17 @@ wxBitmapComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(15 *
|
|||
auto colors = static_cast<ConfigOptionStrings*>(cfg->option("extruder_colour")->clone());
|
||||
wxColour clr(colors->values[extruder_idx]);
|
||||
if (!clr.IsOk())
|
||||
clr = wxTransparentColour;
|
||||
clr = wxColour(0,0,0); // Don't set alfa to transparence
|
||||
|
||||
auto data = new wxColourData();
|
||||
data->SetChooseFull(1);
|
||||
data->SetColour(clr);
|
||||
|
||||
auto dialog = new wxColourDialog(this, data);
|
||||
dialog->CenterOnParent();
|
||||
if (dialog->ShowModal() == wxID_OK)
|
||||
wxColourDialog dialog(this, data);
|
||||
dialog.CenterOnParent();
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
{
|
||||
colors->values[extruder_idx] = dialog->GetColourData().GetColour().GetAsString(wxC2S_HTML_SYNTAX);
|
||||
colors->values[extruder_idx] = dialog.GetColourData().GetColour().GetAsString(wxC2S_HTML_SYNTAX);
|
||||
|
||||
DynamicPrintConfig cfg_new = *cfg;
|
||||
cfg_new.set_key_value("extruder_colour", colors);
|
||||
|
|
@ -309,7 +309,6 @@ wxBitmapComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(15 *
|
|||
wxGetApp().preset_bundle->update_platter_filament_ui(extruder_idx, this);
|
||||
wxGetApp().plater()->on_config_change(cfg_new);
|
||||
}
|
||||
dialog->Destroy();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -2511,15 +2510,14 @@ wxString Plater::priv::get_export_file(GUI::FileType file_type)
|
|||
default: break;
|
||||
}
|
||||
|
||||
wxFileDialog* dlg = new wxFileDialog(q, dlg_title,
|
||||
wxFileDialog dlg(q, dlg_title,
|
||||
from_path(output_file.parent_path()), from_path(output_file.filename()),
|
||||
wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
|
||||
if (dlg->ShowModal() != wxID_OK) {
|
||||
if (dlg.ShowModal() != wxID_OK)
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
wxString out_path = dlg->GetPath();
|
||||
wxString out_path = dlg.GetPath();
|
||||
fs::path path(into_path(out_path));
|
||||
wxGetApp().app_config->update_last_output_dir(path.parent_path().string());
|
||||
|
||||
|
|
@ -4604,6 +4602,30 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
|||
bool update_scheduled = false;
|
||||
bool bed_shape_changed = false;
|
||||
for (auto opt_key : p->config->diff(config)) {
|
||||
if (opt_key == "filament_colour")
|
||||
{
|
||||
update_scheduled = true; // update should be scheduled (for update 3DScene) #2738
|
||||
|
||||
/* There is a case, when we use filament_color instead of extruder_color (when extruder_color == "").
|
||||
* Thus plater config option "filament_colour" should be filled with filament_presets values.
|
||||
* Otherwise, on 3dScene will be used last edited filament color for all volumes with extruder_color == "".
|
||||
*/
|
||||
const std::vector<std::string> filament_presets = wxGetApp().preset_bundle->filament_presets;
|
||||
if (filament_presets.size() > 1 &&
|
||||
p->config->option<ConfigOptionStrings>(opt_key)->values.size() != config.option<ConfigOptionStrings>(opt_key)->values.size())
|
||||
{
|
||||
const PresetCollection& filaments = wxGetApp().preset_bundle->filaments;
|
||||
std::vector<std::string> filament_colors;
|
||||
filament_colors.reserve(filament_presets.size());
|
||||
|
||||
for (const std::string& filament_preset : filament_presets)
|
||||
filament_colors.push_back(filaments.find_preset(filament_preset, true)->config.opt_string("filament_colour", (unsigned)0));
|
||||
|
||||
p->config->option<ConfigOptionStrings>(opt_key)->values = filament_colors;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
p->config->set_key_value(opt_key, config.option(opt_key)->clone());
|
||||
if (opt_key == "printer_technology")
|
||||
this->set_printer_technology(config.opt_enum<PrinterTechnology>(opt_key));
|
||||
|
|
|
|||
|
|
@ -500,7 +500,8 @@ const std::vector<std::string>& Preset::sla_material_options()
|
|||
if (s_opts.empty()) {
|
||||
s_opts = {
|
||||
"initial_layer_height",
|
||||
"exposure_time", "initial_exposure_time",
|
||||
"exposure_time",
|
||||
"initial_exposure_time",
|
||||
"material_correction",
|
||||
"material_notes",
|
||||
"default_sla_material_profile",
|
||||
|
|
@ -526,6 +527,8 @@ const std::vector<std::string>& Preset::sla_printer_options()
|
|||
"relative_correction",
|
||||
"absolute_correction",
|
||||
"gamma_correction",
|
||||
"min_exposure_time", "max_exposure_time",
|
||||
"min_initial_exposure_time", "max_initial_exposure_time",
|
||||
"print_host", "printhost_apikey", "printhost_cafile",
|
||||
"printer_notes",
|
||||
"inherits"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "libslic3r/libslic3r.h"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#include "slic3r/Utils/Semver.hpp"
|
||||
#include "libslic3r/Semver.hpp"
|
||||
|
||||
class wxBitmap;
|
||||
class wxBitmapComboBox;
|
||||
|
|
|
|||
|
|
@ -763,8 +763,11 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
|
|||
}
|
||||
}
|
||||
// Load the configs into this->filaments and make them active.
|
||||
this->filament_presets.clear();
|
||||
for (size_t i = 0; i < configs.size(); ++ i) {
|
||||
this->filament_presets = std::vector<std::string>(configs.size());
|
||||
// To avoid incorrect selection of the first filament preset (means a value of Preset->m_idx_selected)
|
||||
// in a case when next added preset take a place of previosly selected preset,
|
||||
// we should add presets from last to first
|
||||
for (int i = (int)configs.size()-1; i >= 0; i--) {
|
||||
DynamicPrintConfig &cfg = configs[i];
|
||||
// Split the "compatible_printers_condition" and "inherits" from the cummulative vectors to separate filament presets.
|
||||
cfg.opt_string("compatible_printers_condition", true) = compatible_printers_condition_values[i + 1];
|
||||
|
|
@ -789,7 +792,7 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
|
|||
new_name, std::move(cfg), i == 0);
|
||||
loaded->save();
|
||||
}
|
||||
this->filament_presets.emplace_back(loaded->name);
|
||||
this->filament_presets[i] = loaded->name;
|
||||
}
|
||||
}
|
||||
// 4) Load the project config values (the per extruder wipe matrix etc).
|
||||
|
|
|
|||
|
|
@ -159,8 +159,8 @@ void Tab::create_preset_tab()
|
|||
m_undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_roll_back_value(true); }));
|
||||
m_question_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent)
|
||||
{
|
||||
auto dlg = new ButtonsDescription(this, m_icon_descriptions);
|
||||
if (dlg->ShowModal() == wxID_OK) {
|
||||
ButtonsDescription dlg(this, m_icon_descriptions);
|
||||
if (dlg.ShowModal() == wxID_OK) {
|
||||
// Colors for ui "decoration"
|
||||
for (Tab *tab : wxGetApp().tabs_list) {
|
||||
tab->m_sys_label_clr = wxGetApp().get_label_clr_sys();
|
||||
|
|
@ -838,7 +838,7 @@ static wxString support_combo_value_for_config(const DynamicPrintConfig &config,
|
|||
|
||||
static wxString pad_combo_value_for_config(const DynamicPrintConfig &config)
|
||||
{
|
||||
return config.opt_bool("pad_enable") ? (config.opt_bool("pad_zero_elevation") ? _("Around object") : _("Below object")) : _("None");
|
||||
return config.opt_bool("pad_enable") ? (config.opt_bool("pad_zero_elevation") ? _("Around object") : _("Below object")) : _("None");
|
||||
}
|
||||
|
||||
void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||
|
|
@ -860,8 +860,8 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
|||
(opt_key == "supports_enable" || opt_key == "support_buildplate_only"))
|
||||
og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff));
|
||||
|
||||
if (! is_fff && (opt_key == "pad_enable" || opt_key == "pad_zero_elevation"))
|
||||
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
|
||||
if (! is_fff && (opt_key == "pad_enable" || opt_key == "pad_zero_elevation"))
|
||||
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
|
||||
|
||||
if (opt_key == "brim_width")
|
||||
{
|
||||
|
|
@ -998,7 +998,7 @@ void Tab::update_frequently_changed_parameters()
|
|||
|
||||
og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff));
|
||||
if (! is_fff)
|
||||
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
|
||||
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
|
||||
|
||||
const std::string updated_value_key = is_fff ? "fill_density" : "pad_enable";
|
||||
|
||||
|
|
@ -1266,10 +1266,10 @@ void TabPrint::update()
|
|||
if (m_config->opt_float("layer_height") < EPSILON)
|
||||
{
|
||||
const wxString msg_text = _(L("Zero layer height is not valid.\n\nThe layer height will be reset to 0.01."));
|
||||
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Layer height")), wxICON_WARNING | wxOK);
|
||||
wxMessageDialog dialog(parent(), msg_text, _(L("Layer height")), wxICON_WARNING | wxOK);
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
is_msg_dlg_already_exist = true;
|
||||
dialog->ShowModal();
|
||||
dialog.ShowModal();
|
||||
new_conf.set_key_value("layer_height", new ConfigOptionFloat(0.01));
|
||||
load_config(new_conf);
|
||||
is_msg_dlg_already_exist = false;
|
||||
|
|
@ -1278,10 +1278,10 @@ void TabPrint::update()
|
|||
if (fabs(m_config->option<ConfigOptionFloatOrPercent>("first_layer_height")->value - 0) < EPSILON)
|
||||
{
|
||||
const wxString msg_text = _(L("Zero first layer height is not valid.\n\nThe first layer height will be reset to 0.01."));
|
||||
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("First layer height")), wxICON_WARNING | wxOK);
|
||||
wxMessageDialog dialog(parent(), msg_text, _(L("First layer height")), wxICON_WARNING | wxOK);
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
is_msg_dlg_already_exist = true;
|
||||
dialog->ShowModal();
|
||||
dialog.ShowModal();
|
||||
new_conf.set_key_value("first_layer_height", new ConfigOptionFloatOrPercent(0.01, false));
|
||||
load_config(new_conf);
|
||||
is_msg_dlg_already_exist = false;
|
||||
|
|
@ -1299,9 +1299,9 @@ void TabPrint::update()
|
|||
"- no support material\n"
|
||||
"- no ensure_vertical_shell_thickness\n"
|
||||
"\nShall I adjust those settings in order to enable Spiral Vase?"));
|
||||
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Spiral Vase")), wxICON_WARNING | wxYES | wxNO);
|
||||
wxMessageDialog dialog(parent(), msg_text, _(L("Spiral Vase")), wxICON_WARNING | wxYES | wxNO);
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
if (dialog->ShowModal() == wxID_YES) {
|
||||
if (dialog.ShowModal() == wxID_YES) {
|
||||
new_conf.set_key_value("perimeters", new ConfigOptionInt(1));
|
||||
new_conf.set_key_value("top_solid_layers", new ConfigOptionInt(0));
|
||||
new_conf.set_key_value("fill_density", new ConfigOptionPercent(0));
|
||||
|
|
@ -1324,9 +1324,9 @@ void TabPrint::update()
|
|||
"if they are printed with the current extruder without triggering a tool change.\n"
|
||||
"(both support_material_extruder and support_material_interface_extruder need to be set to 0).\n"
|
||||
"\nShall I adjust those settings in order to enable the Wipe Tower?"));
|
||||
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Wipe Tower")), wxICON_WARNING | wxYES | wxNO);
|
||||
wxMessageDialog dialog(parent(), msg_text, _(L("Wipe Tower")), wxICON_WARNING | wxYES | wxNO);
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
if (dialog->ShowModal() == wxID_YES) {
|
||||
if (dialog.ShowModal() == wxID_YES) {
|
||||
new_conf.set_key_value("support_material_extruder", new ConfigOptionInt(0));
|
||||
new_conf.set_key_value("support_material_interface_extruder", new ConfigOptionInt(0));
|
||||
}
|
||||
|
|
@ -1341,9 +1341,9 @@ void TabPrint::update()
|
|||
wxString msg_text = _(L("For the Wipe Tower to work with the soluble supports, the support layers\n"
|
||||
"need to be synchronized with the object layers.\n"
|
||||
"\nShall I synchronize support layers in order to enable the Wipe Tower?"));
|
||||
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Wipe Tower")), wxICON_WARNING | wxYES | wxNO);
|
||||
wxMessageDialog dialog(parent(), msg_text, _(L("Wipe Tower")), wxICON_WARNING | wxYES | wxNO);
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
if (dialog->ShowModal() == wxID_YES) {
|
||||
if (dialog.ShowModal() == wxID_YES) {
|
||||
new_conf.set_key_value("support_material_synchronize_layers", new ConfigOptionBool(true));
|
||||
}
|
||||
else
|
||||
|
|
@ -1359,9 +1359,9 @@ void TabPrint::update()
|
|||
wxString msg_text = _(L("Supports work better, if the following feature is enabled:\n"
|
||||
"- Detect bridging perimeters\n"
|
||||
"\nShall I adjust those settings for supports?"));
|
||||
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Support Generator")), wxICON_WARNING | wxYES | wxNO | wxCANCEL);
|
||||
wxMessageDialog dialog(parent(), msg_text, _(L("Support Generator")), wxICON_WARNING | wxYES | wxNO | wxCANCEL);
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
auto answer = dialog->ShowModal();
|
||||
auto answer = dialog.ShowModal();
|
||||
if (answer == wxID_YES) {
|
||||
// Enable "detect bridging perimeters".
|
||||
new_conf.set_key_value("overhangs", new ConfigOptionBool(true));
|
||||
|
|
@ -1403,9 +1403,9 @@ void TabPrint::update()
|
|||
if (!correct_100p_fill) {
|
||||
wxString msg_text = GUI::from_u8((boost::format(_utf8(L("The %1% infill pattern is not supposed to work at 100%% density.\n\n"
|
||||
"Shall I switch to rectilinear fill pattern?"))) % str_fill_pattern).str());
|
||||
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Infill")), wxICON_WARNING | wxYES | wxNO);
|
||||
wxMessageDialog dialog(parent(), msg_text, _(L("Infill")), wxICON_WARNING | wxYES | wxNO);
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
if (dialog->ShowModal() == wxID_YES) {
|
||||
if (dialog.ShowModal() == wxID_YES) {
|
||||
new_conf.set_key_value("fill_pattern", new ConfigOptionEnum<InfillPattern>(ipRectilinear));
|
||||
fill_density = 100;
|
||||
}
|
||||
|
|
@ -1772,13 +1772,13 @@ void TabFilament::reload_config()
|
|||
|
||||
void TabFilament::update_volumetric_flow_preset_hints()
|
||||
{
|
||||
wxString text;
|
||||
try {
|
||||
text = from_u8(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle));
|
||||
} catch (std::exception &ex) {
|
||||
text = _(L("Volumetric flow hints not available\n\n")) + from_u8(ex.what());
|
||||
}
|
||||
m_volumetric_speed_description_line->SetText(text);
|
||||
wxString text;
|
||||
try {
|
||||
text = from_u8(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle));
|
||||
} catch (std::exception &ex) {
|
||||
text = _(L("Volumetric flow hints not available\n\n")) + from_u8(ex.what());
|
||||
}
|
||||
m_volumetric_speed_description_line->SetText(text);
|
||||
}
|
||||
|
||||
void TabFilament::update()
|
||||
|
|
@ -1788,9 +1788,9 @@ void TabFilament::update()
|
|||
|
||||
m_update_cnt++;
|
||||
|
||||
wxString text = from_u8(PresetHints::cooling_description(m_presets->get_edited_preset()));
|
||||
m_cooling_description_line->SetText(text);
|
||||
this->update_volumetric_flow_preset_hints();
|
||||
wxString text = from_u8(PresetHints::cooling_description(m_presets->get_edited_preset()));
|
||||
m_cooling_description_line->SetText(text);
|
||||
this->update_volumetric_flow_preset_hints();
|
||||
Layout();
|
||||
|
||||
bool cooling = m_config->opt_bool("cooling", 0);
|
||||
|
|
@ -1812,8 +1812,8 @@ void TabFilament::update()
|
|||
|
||||
void TabFilament::OnActivate()
|
||||
{
|
||||
this->update_volumetric_flow_preset_hints();
|
||||
Tab::OnActivate();
|
||||
this->update_volumetric_flow_preset_hints();
|
||||
Tab::OnActivate();
|
||||
}
|
||||
|
||||
wxSizer* Tab::description_line_widget(wxWindow* parent, ogStaticText* *StaticText)
|
||||
|
|
@ -2045,10 +2045,10 @@ void TabPrinter::build_fff()
|
|||
const wxString msg_text = _(L("Single Extruder Multi Material is selected, \n"
|
||||
"and all extruders must have the same diameter.\n"
|
||||
"Do you want to change the diameter for all extruders to first extruder nozzle diameter value?"));
|
||||
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Nozzle diameter")), wxICON_WARNING | wxYES_NO);
|
||||
wxMessageDialog dialog(parent(), msg_text, _(L("Nozzle diameter")), wxICON_WARNING | wxYES_NO);
|
||||
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
if (dialog->ShowModal() == wxID_YES) {
|
||||
if (dialog.ShowModal() == wxID_YES) {
|
||||
for (size_t i = 1; i < nozzle_diameters.size(); i++)
|
||||
nozzle_diameters[i] = frst_diam;
|
||||
|
||||
|
|
@ -2290,6 +2290,12 @@ void TabPrinter::build_sla()
|
|||
optgroup->append_single_option_line("absolute_correction");
|
||||
optgroup->append_single_option_line("gamma_correction");
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Exposure")));
|
||||
optgroup->append_single_option_line("min_exposure_time");
|
||||
optgroup->append_single_option_line("max_exposure_time");
|
||||
optgroup->append_single_option_line("min_initial_exposure_time");
|
||||
optgroup->append_single_option_line("max_initial_exposure_time");
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Print Host upload")));
|
||||
build_printhost(optgroup.get());
|
||||
|
||||
|
|
@ -2507,10 +2513,10 @@ void TabPrinter::build_unregular_pages()
|
|||
{
|
||||
const wxString msg_text = _(L("This is a single extruder multimaterial printer, diameters of all extruders "
|
||||
"will be set to the new value. Do you want to proceed?"));
|
||||
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Nozzle diameter")), wxICON_WARNING | wxYES_NO);
|
||||
wxMessageDialog dialog(parent(), msg_text, _(L("Nozzle diameter")), wxICON_WARNING | wxYES_NO);
|
||||
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
if (dialog->ShowModal() == wxID_YES) {
|
||||
if (dialog.ShowModal() == wxID_YES) {
|
||||
for (size_t i = 0; i < nozzle_diameters.size(); i++) {
|
||||
if (i==extruder_idx)
|
||||
continue;
|
||||
|
|
@ -2558,7 +2564,33 @@ void TabPrinter::build_unregular_pages()
|
|||
optgroup->append_single_option_line("retract_restart_extra_toolchange", extruder_idx);
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Preview")));
|
||||
optgroup->append_single_option_line("extruder_colour", extruder_idx);
|
||||
|
||||
auto reset_to_filament_color = [this, extruder_idx](wxWindow* parent) {
|
||||
add_scaled_button(parent, &m_reset_to_filament_color, "undo",
|
||||
_(L("Reset to Filament Color")), wxBU_LEFT | wxBU_EXACTFIT);
|
||||
ScalableButton* btn = m_reset_to_filament_color;
|
||||
btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(btn);
|
||||
|
||||
btn->Bind(wxEVT_BUTTON, [this, extruder_idx](wxCommandEvent& e)
|
||||
{
|
||||
std::vector<std::string> colors = static_cast<const ConfigOptionStrings*>(m_config->option("extruder_colour"))->values;
|
||||
colors[extruder_idx] = "";
|
||||
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
new_conf.set_key_value("extruder_colour", new ConfigOptionStrings(colors));
|
||||
load_config(new_conf);
|
||||
|
||||
update_dirty();
|
||||
update();
|
||||
});
|
||||
|
||||
return sizer;
|
||||
};
|
||||
line = optgroup->create_single_option_line("extruder_colour", extruder_idx);
|
||||
line.append_widget(reset_to_filament_color);
|
||||
optgroup->append_line(line);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
layout_page(page);
|
||||
|
|
@ -2715,13 +2747,13 @@ void TabPrinter::update_fff()
|
|||
get_field("retract_before_wipe", i)->toggle(wipe);
|
||||
|
||||
if (use_firmware_retraction && wipe) {
|
||||
auto dialog = new wxMessageDialog(parent(),
|
||||
wxMessageDialog dialog(parent(),
|
||||
_(L("The Wipe option is not available when using the Firmware Retraction mode.\n"
|
||||
"\nShall I disable it in order to enable Firmware Retraction?")),
|
||||
_(L("Firmware Retraction")), wxICON_WARNING | wxYES | wxNO);
|
||||
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
if (dialog->ShowModal() == wxID_YES) {
|
||||
if (dialog.ShowModal() == wxID_YES) {
|
||||
auto wipe = static_cast<ConfigOptionBools*>(m_config->option("wipe")->clone());
|
||||
for (int w = 0; w < wipe->values.size(); w++)
|
||||
wipe->values[w] = false;
|
||||
|
|
@ -3073,10 +3105,10 @@ bool Tab::may_discard_current_dirty_preset(PresetCollection* presets /*= nullptr
|
|||
message += wxString("\n") + tab + from_u8(new_printer_name) + "\n\n";
|
||||
message += _(L("and it has the following unsaved changes:"));
|
||||
}
|
||||
auto confirm = new wxMessageDialog(parent(),
|
||||
wxMessageDialog confirm(parent(),
|
||||
message + "\n" + changes + "\n\n" + _(L("Discard changes and continue anyway?")),
|
||||
_(L("Unsaved Changes")), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
|
||||
return confirm->ShowModal() == wxID_YES;
|
||||
return confirm.ShowModal() == wxID_YES;
|
||||
}
|
||||
|
||||
// If we are switching from the FFF-preset to the SLA, we should to control the printed objects if they have a part(s).
|
||||
|
|
@ -3183,11 +3215,11 @@ void Tab::save_preset(std::string name /*= ""*/)
|
|||
values.push_back(preset.name);
|
||||
}
|
||||
|
||||
auto dlg = new SavePresetWindow(parent());
|
||||
dlg->build(title(), default_name, values);
|
||||
if (dlg->ShowModal() != wxID_OK)
|
||||
SavePresetWindow dlg(parent());
|
||||
dlg.build(title(), default_name, values);
|
||||
if (dlg.ShowModal() != wxID_OK)
|
||||
return;
|
||||
name = dlg->get_name();
|
||||
name = dlg.get_name();
|
||||
if (name == "") {
|
||||
show_error(this, _(L("The supplied name is empty. It can't be saved.")));
|
||||
return;
|
||||
|
|
@ -3799,13 +3831,13 @@ void TabSLAPrint::update()
|
|||
wxString msg_text = _(
|
||||
L("Head penetration should not be greater than the head width."));
|
||||
|
||||
auto dialog = new wxMessageDialog(parent(),
|
||||
msg_text,
|
||||
_(L("Invalid Head penetration")),
|
||||
wxICON_WARNING | wxOK);
|
||||
wxMessageDialog dialog(parent(),
|
||||
msg_text,
|
||||
_(L("Invalid Head penetration")),
|
||||
wxICON_WARNING | wxOK);
|
||||
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
if (dialog->ShowModal() == wxID_OK) {
|
||||
if (dialog.ShowModal() == wxID_OK) {
|
||||
new_conf.set_key_value("support_head_penetration",
|
||||
new ConfigOptionFloat(head_width));
|
||||
}
|
||||
|
|
@ -3819,13 +3851,13 @@ void TabSLAPrint::update()
|
|||
wxString msg_text = _(L(
|
||||
"Pinhead diameter should be smaller than the pillar diameter."));
|
||||
|
||||
auto dialog = new wxMessageDialog(parent(),
|
||||
msg_text,
|
||||
_(L("Invalid pinhead diameter")),
|
||||
wxICON_WARNING | wxOK);
|
||||
wxMessageDialog dialog (parent(),
|
||||
msg_text,
|
||||
_(L("Invalid pinhead diameter")),
|
||||
wxICON_WARNING | wxOK);
|
||||
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
if (dialog->ShowModal() == wxID_OK) {
|
||||
if (dialog.ShowModal() == wxID_OK) {
|
||||
new_conf.set_key_value("support_head_front_diameter",
|
||||
new ConfigOptionFloat(pillar_d / 2.0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -371,6 +371,7 @@ public:
|
|||
wxButton* m_serial_test_btn = nullptr;
|
||||
ScalableButton* m_print_host_test_btn = nullptr;
|
||||
ScalableButton* m_printhost_browse_btn = nullptr;
|
||||
ScalableButton* m_reset_to_filament_color = nullptr;
|
||||
|
||||
size_t m_extruders_count;
|
||||
size_t m_extruders_count_old = 0;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "slic3r/Utils/Semver.hpp"
|
||||
#include "libslic3r/Semver.hpp"
|
||||
#include "MsgDialog.hpp"
|
||||
|
||||
class wxBoxSizer;
|
||||
|
|
|
|||
|
|
@ -11,13 +11,14 @@
|
|||
#include <wx/sizer.h>
|
||||
#include <wx/slider.h>
|
||||
#include <wx/menu.h>
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <functional>
|
||||
|
||||
namespace Slic3r {
|
||||
enum class ModelVolumeType : int;
|
||||
enum class ModelVolumeType : int;
|
||||
};
|
||||
|
||||
typedef double coordf_t;
|
||||
|
|
@ -36,11 +37,11 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const
|
|||
std::function<void(wxCommandEvent& event)> cb, const std::string& icon = "", wxEvtHandler* event_handler = nullptr,
|
||||
std::function<bool()> const cb_condition = []() { return true; }, wxWindow* parent = nullptr);
|
||||
|
||||
wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxString& string, const wxString& description,
|
||||
wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxString& string, const wxString& description,
|
||||
const std::string& icon = "",
|
||||
std::function<bool()> const cb_condition = []() { return true; }, wxWindow* parent = nullptr);
|
||||
|
||||
wxMenuItem* append_menu_radio_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||
wxMenuItem* append_menu_radio_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||
std::function<void(wxCommandEvent& event)> cb, wxEvtHandler* event_handler);
|
||||
|
||||
wxMenuItem* append_menu_check_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||
|
|
@ -51,7 +52,7 @@ void edit_tooltip(wxString& tooltip);
|
|||
void msw_buttons_rescale(wxDialog* dlg, const int em_unit, const std::vector<int>& btn_ids);
|
||||
int em_unit(wxWindow* win);
|
||||
|
||||
wxBitmap create_scaled_bitmap(wxWindow *win, const std::string& bmp_name,
|
||||
wxBitmap create_scaled_bitmap(wxWindow *win, const std::string& bmp_name,
|
||||
const int px_cnt = 16, const bool is_horizontal = false, const bool grayscale = false);
|
||||
|
||||
class wxCheckListBoxComboPopup : public wxCheckListBox, public wxComboPopup
|
||||
|
|
@ -95,23 +96,23 @@ public:
|
|||
|
||||
class wxDataViewTreeCtrlComboPopup: public wxDataViewTreeCtrl, public wxComboPopup
|
||||
{
|
||||
static const unsigned int DefaultWidth;
|
||||
static const unsigned int DefaultHeight;
|
||||
static const unsigned int DefaultItemHeight;
|
||||
static const unsigned int DefaultWidth;
|
||||
static const unsigned int DefaultHeight;
|
||||
static const unsigned int DefaultItemHeight;
|
||||
|
||||
wxString m_text;
|
||||
int m_cnt_open_items{0};
|
||||
wxString m_text;
|
||||
int m_cnt_open_items{0};
|
||||
|
||||
public:
|
||||
virtual bool Create(wxWindow* parent);
|
||||
virtual wxWindow* GetControl() { return this; }
|
||||
virtual void SetStringValue(const wxString& value) { m_text = value; }
|
||||
virtual wxString GetStringValue() const { return m_text; }
|
||||
virtual bool Create(wxWindow* parent);
|
||||
virtual wxWindow* GetControl() { return this; }
|
||||
virtual void SetStringValue(const wxString& value) { m_text = value; }
|
||||
virtual wxString GetStringValue() const { return m_text; }
|
||||
// virtual wxSize GetAdjustedSize(int minWidth, int prefHeight, int maxHeight);
|
||||
|
||||
virtual void OnKeyEvent(wxKeyEvent& evt);
|
||||
void OnDataViewTreeCtrlSelection(wxCommandEvent& evt);
|
||||
void SetItemsCnt(int cnt) { m_cnt_open_items = cnt; }
|
||||
virtual void OnKeyEvent(wxKeyEvent& evt);
|
||||
void OnDataViewTreeCtrlSelection(wxCommandEvent& evt);
|
||||
void SetItemsCnt(int cnt) { m_cnt_open_items = cnt; }
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -124,7 +125,7 @@ class DataViewBitmapText : public wxObject
|
|||
public:
|
||||
DataViewBitmapText( const wxString &text = wxEmptyString,
|
||||
const wxBitmap& bmp = wxNullBitmap) :
|
||||
m_text(text),
|
||||
m_text(text),
|
||||
m_bmp(bmp)
|
||||
{ }
|
||||
|
||||
|
|
@ -195,8 +196,8 @@ WX_DEFINE_ARRAY_PTR(ObjectDataViewModelNode*, MyObjectTreeModelNodePtrArray);
|
|||
|
||||
class ObjectDataViewModelNode
|
||||
{
|
||||
ObjectDataViewModelNode* m_parent;
|
||||
MyObjectTreeModelNodePtrArray m_children;
|
||||
ObjectDataViewModelNode* m_parent;
|
||||
MyObjectTreeModelNodePtrArray m_children;
|
||||
wxBitmap m_empty_bmp;
|
||||
size_t m_volumes_cnt = 0;
|
||||
std::vector< std::string > m_opt_categories;
|
||||
|
|
@ -216,7 +217,7 @@ class ObjectDataViewModelNode
|
|||
Slic3r::ModelVolumeType m_volume_type;
|
||||
|
||||
public:
|
||||
ObjectDataViewModelNode(const wxString &name,
|
||||
ObjectDataViewModelNode(const wxString &name,
|
||||
const wxString& extruder):
|
||||
m_parent(NULL),
|
||||
m_name(name),
|
||||
|
|
@ -227,14 +228,14 @@ public:
|
|||
init_container();
|
||||
}
|
||||
|
||||
ObjectDataViewModelNode(ObjectDataViewModelNode* parent,
|
||||
const wxString& sub_obj_name,
|
||||
const wxBitmap& bmp,
|
||||
const wxString& extruder,
|
||||
ObjectDataViewModelNode(ObjectDataViewModelNode* parent,
|
||||
const wxString& sub_obj_name,
|
||||
const wxBitmap& bmp,
|
||||
const wxString& extruder,
|
||||
const int idx = -1 ) :
|
||||
m_parent (parent),
|
||||
m_name (sub_obj_name),
|
||||
m_type (itVolume),
|
||||
m_name (sub_obj_name),
|
||||
m_type (itVolume),
|
||||
m_idx (idx),
|
||||
m_extruder (extruder)
|
||||
{
|
||||
|
|
@ -243,27 +244,27 @@ public:
|
|||
init_container();
|
||||
}
|
||||
|
||||
ObjectDataViewModelNode(ObjectDataViewModelNode* parent,
|
||||
const t_layer_height_range& layer_range,
|
||||
ObjectDataViewModelNode(ObjectDataViewModelNode* parent,
|
||||
const t_layer_height_range& layer_range,
|
||||
const int idx = -1,
|
||||
const wxString& extruder = wxEmptyString );
|
||||
|
||||
ObjectDataViewModelNode(ObjectDataViewModelNode* parent, const ItemType type);
|
||||
|
||||
~ObjectDataViewModelNode()
|
||||
{
|
||||
// free all our children nodes
|
||||
size_t count = m_children.GetCount();
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
ObjectDataViewModelNode *child = m_children[i];
|
||||
delete child;
|
||||
}
|
||||
~ObjectDataViewModelNode()
|
||||
{
|
||||
// free all our children nodes
|
||||
size_t count = m_children.GetCount();
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
ObjectDataViewModelNode *child = m_children[i];
|
||||
delete child;
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
// Indicate that the object was deleted.
|
||||
m_idx = -2;
|
||||
// Indicate that the object was deleted.
|
||||
m_idx = -2;
|
||||
#endif /* NDEBUG */
|
||||
}
|
||||
}
|
||||
|
||||
void init_container();
|
||||
bool IsContainer() const
|
||||
|
|
@ -271,53 +272,53 @@ public:
|
|||
return m_container;
|
||||
}
|
||||
|
||||
ObjectDataViewModelNode* GetParent()
|
||||
{
|
||||
assert(m_parent == nullptr || m_parent->valid());
|
||||
return m_parent;
|
||||
}
|
||||
MyObjectTreeModelNodePtrArray& GetChildren()
|
||||
{
|
||||
return m_children;
|
||||
}
|
||||
ObjectDataViewModelNode* GetNthChild(unsigned int n)
|
||||
{
|
||||
return m_children.Item(n);
|
||||
}
|
||||
void Insert(ObjectDataViewModelNode* child, unsigned int n)
|
||||
{
|
||||
if (!m_container)
|
||||
m_container = true;
|
||||
m_children.Insert(child, n);
|
||||
}
|
||||
void Append(ObjectDataViewModelNode* child)
|
||||
{
|
||||
if (!m_container)
|
||||
m_container = true;
|
||||
m_children.Add(child);
|
||||
}
|
||||
void RemoveAllChildren()
|
||||
{
|
||||
if (GetChildCount() == 0)
|
||||
return;
|
||||
for (int id = int(GetChildCount()) - 1; id >= 0; --id)
|
||||
{
|
||||
if (m_children.Item(id)->GetChildCount() > 0)
|
||||
m_children[id]->RemoveAllChildren();
|
||||
auto node = m_children[id];
|
||||
m_children.RemoveAt(id);
|
||||
delete node;
|
||||
}
|
||||
}
|
||||
ObjectDataViewModelNode* GetParent()
|
||||
{
|
||||
assert(m_parent == nullptr || m_parent->valid());
|
||||
return m_parent;
|
||||
}
|
||||
MyObjectTreeModelNodePtrArray& GetChildren()
|
||||
{
|
||||
return m_children;
|
||||
}
|
||||
ObjectDataViewModelNode* GetNthChild(unsigned int n)
|
||||
{
|
||||
return m_children.Item(n);
|
||||
}
|
||||
void Insert(ObjectDataViewModelNode* child, unsigned int n)
|
||||
{
|
||||
if (!m_container)
|
||||
m_container = true;
|
||||
m_children.Insert(child, n);
|
||||
}
|
||||
void Append(ObjectDataViewModelNode* child)
|
||||
{
|
||||
if (!m_container)
|
||||
m_container = true;
|
||||
m_children.Add(child);
|
||||
}
|
||||
void RemoveAllChildren()
|
||||
{
|
||||
if (GetChildCount() == 0)
|
||||
return;
|
||||
for (int id = int(GetChildCount()) - 1; id >= 0; --id)
|
||||
{
|
||||
if (m_children.Item(id)->GetChildCount() > 0)
|
||||
m_children[id]->RemoveAllChildren();
|
||||
auto node = m_children[id];
|
||||
m_children.RemoveAt(id);
|
||||
delete node;
|
||||
}
|
||||
}
|
||||
|
||||
size_t GetChildCount() const
|
||||
{
|
||||
return m_children.GetCount();
|
||||
}
|
||||
size_t GetChildCount() const
|
||||
{
|
||||
return m_children.GetCount();
|
||||
}
|
||||
|
||||
bool SetValue(const wxVariant &variant, unsigned int col);
|
||||
bool SetValue(const wxVariant &variant, unsigned int col);
|
||||
|
||||
void SetBitmap(const wxBitmap &icon) { m_bmp = icon; }
|
||||
void SetBitmap(const wxBitmap &icon) { m_bmp = icon; }
|
||||
const wxBitmap& GetBitmap() const { return m_bmp; }
|
||||
const wxString& GetName() const { return m_name; }
|
||||
ItemType GetType() const { return m_type; }
|
||||
|
|
@ -326,46 +327,46 @@ public:
|
|||
t_layer_height_range GetLayerRange() const { return m_layer_range; }
|
||||
PrintIndicator IsPrintable() const { return m_printable; }
|
||||
|
||||
// use this function only for childrens
|
||||
void AssignAllVal(ObjectDataViewModelNode& from_node)
|
||||
{
|
||||
// ! Don't overwrite other values because of equality of this values for all children --
|
||||
m_name = from_node.m_name;
|
||||
// use this function only for childrens
|
||||
void AssignAllVal(ObjectDataViewModelNode& from_node)
|
||||
{
|
||||
// ! Don't overwrite other values because of equality of this values for all children --
|
||||
m_name = from_node.m_name;
|
||||
m_bmp = from_node.m_bmp;
|
||||
m_idx = from_node.m_idx;
|
||||
m_extruder = from_node.m_extruder;
|
||||
m_type = from_node.m_type;
|
||||
}
|
||||
}
|
||||
|
||||
bool SwapChildrens(int frst_id, int scnd_id) {
|
||||
if (GetChildCount() < 2 ||
|
||||
frst_id < 0 || (size_t)frst_id >= GetChildCount() ||
|
||||
scnd_id < 0 || (size_t)scnd_id >= GetChildCount())
|
||||
return false;
|
||||
bool SwapChildrens(int frst_id, int scnd_id) {
|
||||
if (GetChildCount() < 2 ||
|
||||
frst_id < 0 || (size_t)frst_id >= GetChildCount() ||
|
||||
scnd_id < 0 || (size_t)scnd_id >= GetChildCount())
|
||||
return false;
|
||||
|
||||
ObjectDataViewModelNode new_scnd = *GetNthChild(frst_id);
|
||||
ObjectDataViewModelNode new_frst = *GetNthChild(scnd_id);
|
||||
ObjectDataViewModelNode new_scnd = *GetNthChild(frst_id);
|
||||
ObjectDataViewModelNode new_frst = *GetNthChild(scnd_id);
|
||||
|
||||
new_scnd.m_idx = m_children.Item(scnd_id)->m_idx;
|
||||
new_frst.m_idx = m_children.Item(frst_id)->m_idx;
|
||||
|
||||
m_children.Item(frst_id)->AssignAllVal(new_frst);
|
||||
m_children.Item(scnd_id)->AssignAllVal(new_scnd);
|
||||
return true;
|
||||
}
|
||||
m_children.Item(frst_id)->AssignAllVal(new_frst);
|
||||
m_children.Item(scnd_id)->AssignAllVal(new_scnd);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set action icons for node
|
||||
// Set action icons for node
|
||||
void set_action_icon();
|
||||
// Set printable icon for node
|
||||
void set_printable_icon(PrintIndicator printable);
|
||||
|
||||
void update_settings_digest_bitmaps();
|
||||
bool update_settings_digest(const std::vector<std::string>& categories);
|
||||
bool update_settings_digest(const std::vector<std::string>& categories);
|
||||
int volume_type() const { return int(m_volume_type); }
|
||||
void msw_rescale();
|
||||
|
||||
#ifndef NDEBUG
|
||||
bool valid();
|
||||
bool valid();
|
||||
#endif /* NDEBUG */
|
||||
bool invalid() const { return m_idx < -1; }
|
||||
|
||||
|
|
@ -382,7 +383,7 @@ wxDECLARE_EVENT(wxCUSTOMEVT_LAST_VOLUME_IS_DELETED, wxCommandEvent);
|
|||
|
||||
class ObjectDataViewModel :public wxDataViewModel
|
||||
{
|
||||
std::vector<ObjectDataViewModelNode*> m_objects;
|
||||
std::vector<ObjectDataViewModelNode*> m_objects;
|
||||
std::vector<wxBitmap*> m_volume_bmps;
|
||||
wxBitmap* m_warning_bmp;
|
||||
|
||||
|
|
@ -392,7 +393,7 @@ public:
|
|||
ObjectDataViewModel();
|
||||
~ObjectDataViewModel();
|
||||
|
||||
wxDataViewItem Add( const wxString &name,
|
||||
wxDataViewItem Add( const wxString &name,
|
||||
const int extruder,
|
||||
const bool has_errors = false);
|
||||
wxDataViewItem AddVolumeChild( const wxDataViewItem &parent_item,
|
||||
|
|
@ -405,24 +406,24 @@ public:
|
|||
wxDataViewItem AddInstanceChild(const wxDataViewItem &parent_item, size_t num);
|
||||
wxDataViewItem AddInstanceChild(const wxDataViewItem &parent_item, const std::vector<bool>& print_indicator);
|
||||
wxDataViewItem AddLayersRoot(const wxDataViewItem &parent_item);
|
||||
wxDataViewItem AddLayersChild( const wxDataViewItem &parent_item,
|
||||
wxDataViewItem AddLayersChild( const wxDataViewItem &parent_item,
|
||||
const t_layer_height_range& layer_range,
|
||||
const int extruder = 0,
|
||||
const int extruder = 0,
|
||||
const int index = -1);
|
||||
wxDataViewItem Delete(const wxDataViewItem &item);
|
||||
wxDataViewItem DeleteLastInstance(const wxDataViewItem &parent_item, size_t num);
|
||||
void DeleteAll();
|
||||
wxDataViewItem Delete(const wxDataViewItem &item);
|
||||
wxDataViewItem DeleteLastInstance(const wxDataViewItem &parent_item, size_t num);
|
||||
void DeleteAll();
|
||||
void DeleteChildren(wxDataViewItem& parent);
|
||||
void DeleteVolumeChildren(wxDataViewItem& parent);
|
||||
void DeleteSettings(const wxDataViewItem& parent);
|
||||
wxDataViewItem GetItemById(int obj_idx);
|
||||
wxDataViewItem GetItemById(int obj_idx);
|
||||
wxDataViewItem GetItemById(const int obj_idx, const int sub_obj_idx, const ItemType parent_type);
|
||||
wxDataViewItem GetItemByVolumeId(int obj_idx, int volume_idx);
|
||||
wxDataViewItem GetItemByInstanceId(int obj_idx, int inst_idx);
|
||||
wxDataViewItem GetItemByVolumeId(int obj_idx, int volume_idx);
|
||||
wxDataViewItem GetItemByInstanceId(int obj_idx, int inst_idx);
|
||||
wxDataViewItem GetItemByLayerId(int obj_idx, int layer_idx);
|
||||
wxDataViewItem GetItemByLayerRange(const int obj_idx, const t_layer_height_range& layer_range);
|
||||
int GetItemIdByLayerRange(const int obj_idx, const t_layer_height_range& layer_range);
|
||||
int GetIdByItem(const wxDataViewItem& item) const;
|
||||
int GetIdByItem(const wxDataViewItem& item) const;
|
||||
int GetIdByItemAndType(const wxDataViewItem& item, const ItemType type) const;
|
||||
int GetObjectIdByItem(const wxDataViewItem& item) const;
|
||||
int GetVolumeIdByItem(const wxDataViewItem& item) const;
|
||||
|
|
@ -433,53 +434,53 @@ public:
|
|||
bool IsEmpty() { return m_objects.empty(); }
|
||||
bool InvalidItem(const wxDataViewItem& item);
|
||||
|
||||
// helper method for wxLog
|
||||
// helper method for wxLog
|
||||
|
||||
wxString GetName(const wxDataViewItem &item) const;
|
||||
wxString GetName(const wxDataViewItem &item) const;
|
||||
wxBitmap& GetBitmap(const wxDataViewItem &item) const;
|
||||
|
||||
// helper methods to change the model
|
||||
// helper methods to change the model
|
||||
|
||||
virtual unsigned int GetColumnCount() const override { return 3;}
|
||||
virtual wxString GetColumnType(unsigned int col) const override{ return wxT("string"); }
|
||||
virtual unsigned int GetColumnCount() const override { return 3;}
|
||||
virtual wxString GetColumnType(unsigned int col) const override{ return wxT("string"); }
|
||||
|
||||
virtual void GetValue( wxVariant &variant,
|
||||
const wxDataViewItem &item,
|
||||
virtual void GetValue( wxVariant &variant,
|
||||
const wxDataViewItem &item,
|
||||
unsigned int col) const override;
|
||||
virtual bool SetValue( const wxVariant &variant,
|
||||
const wxDataViewItem &item,
|
||||
virtual bool SetValue( const wxVariant &variant,
|
||||
const wxDataViewItem &item,
|
||||
unsigned int col) override;
|
||||
bool SetValue( const wxVariant &variant,
|
||||
const int item_idx,
|
||||
bool SetValue( const wxVariant &variant,
|
||||
const int item_idx,
|
||||
unsigned int col);
|
||||
|
||||
// For parent move child from cur_volume_id place to new_volume_id
|
||||
// For parent move child from cur_volume_id place to new_volume_id
|
||||
// Remaining items will moved up/down accordingly
|
||||
wxDataViewItem ReorganizeChildren( const int cur_volume_id,
|
||||
wxDataViewItem ReorganizeChildren( const int cur_volume_id,
|
||||
const int new_volume_id,
|
||||
const wxDataViewItem &parent);
|
||||
|
||||
virtual bool IsEnabled(const wxDataViewItem &item, unsigned int col) const override;
|
||||
virtual bool IsEnabled(const wxDataViewItem &item, unsigned int col) const override;
|
||||
|
||||
virtual wxDataViewItem GetParent(const wxDataViewItem &item) const override;
|
||||
virtual wxDataViewItem GetParent(const wxDataViewItem &item) const override;
|
||||
// get object item
|
||||
wxDataViewItem GetTopParent(const wxDataViewItem &item) const;
|
||||
virtual bool IsContainer(const wxDataViewItem &item) const override;
|
||||
virtual unsigned int GetChildren(const wxDataViewItem &parent,
|
||||
wxDataViewItemArray &array) const override;
|
||||
virtual bool IsContainer(const wxDataViewItem &item) const override;
|
||||
virtual unsigned int GetChildren(const wxDataViewItem &parent,
|
||||
wxDataViewItemArray &array) const override;
|
||||
void GetAllChildren(const wxDataViewItem &parent,wxDataViewItemArray &array) const;
|
||||
// Is the container just a header or an item with all columns
|
||||
// In our case it is an item with all columns
|
||||
virtual bool HasContainerColumns(const wxDataViewItem& WXUNUSED(item)) const override { return true; }
|
||||
// Is the container just a header or an item with all columns
|
||||
// In our case it is an item with all columns
|
||||
virtual bool HasContainerColumns(const wxDataViewItem& WXUNUSED(item)) const override { return true; }
|
||||
|
||||
ItemType GetItemType(const wxDataViewItem &item) const ;
|
||||
wxDataViewItem GetItemByType( const wxDataViewItem &parent_item,
|
||||
wxDataViewItem GetItemByType( const wxDataViewItem &parent_item,
|
||||
ItemType type) const;
|
||||
wxDataViewItem GetSettingsItem(const wxDataViewItem &item) const;
|
||||
wxDataViewItem GetInstanceRootItem(const wxDataViewItem &item) const;
|
||||
wxDataViewItem GetLayerRootItem(const wxDataViewItem &item) const;
|
||||
bool IsSettingsItem(const wxDataViewItem &item) const;
|
||||
void UpdateSettingsDigest( const wxDataViewItem &item,
|
||||
void UpdateSettingsDigest( const wxDataViewItem &item,
|
||||
const std::vector<std::string>& categories);
|
||||
|
||||
bool IsPrintable(const wxDataViewItem &item) const;
|
||||
|
|
@ -498,7 +499,7 @@ public:
|
|||
// Rescale bitmaps for existing Items
|
||||
void Rescale();
|
||||
|
||||
wxBitmap GetVolumeIcon(const Slic3r::ModelVolumeType vol_type,
|
||||
wxBitmap GetVolumeIcon(const Slic3r::ModelVolumeType vol_type,
|
||||
const bool is_marked = false);
|
||||
void DeleteWarningIcon(const wxDataViewItem& item, const bool unmark_object = false);
|
||||
t_layer_height_range GetLayerRangeByItem(const wxDataViewItem& item) const;
|
||||
|
|
@ -547,12 +548,12 @@ public:
|
|||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
wxWindow* CreateEditorCtrl(wxWindow* parent,
|
||||
wxRect labelRect,
|
||||
wxWindow* CreateEditorCtrl(wxWindow* parent,
|
||||
wxRect labelRect,
|
||||
const wxVariant& value) override;
|
||||
bool GetValueFromEditorCtrl( wxWindow* ctrl,
|
||||
bool GetValueFromEditorCtrl( wxWindow* ctrl,
|
||||
wxVariant& value) override;
|
||||
bool WasCanceled() const { return m_was_unusable_symbol; }
|
||||
|
||||
|
|
@ -569,88 +570,88 @@ private:
|
|||
class MyCustomRenderer : public wxDataViewCustomRenderer
|
||||
{
|
||||
public:
|
||||
// This renderer can be either activatable or editable, for demonstration
|
||||
// purposes. In real programs, you should select whether the user should be
|
||||
// able to activate or edit the cell and it doesn't make sense to switch
|
||||
// between the two -- but this is just an example, so it doesn't stop us.
|
||||
explicit MyCustomRenderer(wxDataViewCellMode mode)
|
||||
: wxDataViewCustomRenderer("string", mode, wxALIGN_CENTER)
|
||||
{ }
|
||||
// This renderer can be either activatable or editable, for demonstration
|
||||
// purposes. In real programs, you should select whether the user should be
|
||||
// able to activate or edit the cell and it doesn't make sense to switch
|
||||
// between the two -- but this is just an example, so it doesn't stop us.
|
||||
explicit MyCustomRenderer(wxDataViewCellMode mode)
|
||||
: wxDataViewCustomRenderer("string", mode, wxALIGN_CENTER)
|
||||
{ }
|
||||
|
||||
virtual bool Render(wxRect rect, wxDC *dc, int state) override/*wxOVERRIDE*/
|
||||
{
|
||||
dc->SetBrush(*wxLIGHT_GREY_BRUSH);
|
||||
dc->SetPen(*wxTRANSPARENT_PEN);
|
||||
virtual bool Render(wxRect rect, wxDC *dc, int state) override/*wxOVERRIDE*/
|
||||
{
|
||||
dc->SetBrush(*wxLIGHT_GREY_BRUSH);
|
||||
dc->SetPen(*wxTRANSPARENT_PEN);
|
||||
|
||||
rect.Deflate(2);
|
||||
dc->DrawRoundedRectangle(rect, 5);
|
||||
rect.Deflate(2);
|
||||
dc->DrawRoundedRectangle(rect, 5);
|
||||
|
||||
RenderText(m_value,
|
||||
0, // no offset
|
||||
wxRect(dc->GetTextExtent(m_value)).CentreIn(rect),
|
||||
dc,
|
||||
state);
|
||||
return true;
|
||||
}
|
||||
RenderText(m_value,
|
||||
0, // no offset
|
||||
wxRect(dc->GetTextExtent(m_value)).CentreIn(rect),
|
||||
dc,
|
||||
state);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool ActivateCell(const wxRect& WXUNUSED(cell),
|
||||
wxDataViewModel *WXUNUSED(model),
|
||||
const wxDataViewItem &WXUNUSED(item),
|
||||
unsigned int WXUNUSED(col),
|
||||
const wxMouseEvent *mouseEvent) override/*wxOVERRIDE*/
|
||||
{
|
||||
wxString position;
|
||||
if (mouseEvent)
|
||||
position = wxString::Format("via mouse at %d, %d", mouseEvent->m_x, mouseEvent->m_y);
|
||||
else
|
||||
position = "from keyboard";
|
||||
virtual bool ActivateCell(const wxRect& WXUNUSED(cell),
|
||||
wxDataViewModel *WXUNUSED(model),
|
||||
const wxDataViewItem &WXUNUSED(item),
|
||||
unsigned int WXUNUSED(col),
|
||||
const wxMouseEvent *mouseEvent) override/*wxOVERRIDE*/
|
||||
{
|
||||
wxString position;
|
||||
if (mouseEvent)
|
||||
position = wxString::Format("via mouse at %d, %d", mouseEvent->m_x, mouseEvent->m_y);
|
||||
else
|
||||
position = "from keyboard";
|
||||
// wxLogMessage("MyCustomRenderer ActivateCell() %s", position);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual wxSize GetSize() const override/*wxOVERRIDE*/
|
||||
{
|
||||
return wxSize(60, 20);
|
||||
}
|
||||
virtual wxSize GetSize() const override/*wxOVERRIDE*/
|
||||
{
|
||||
return wxSize(60, 20);
|
||||
}
|
||||
|
||||
virtual bool SetValue(const wxVariant &value) override/*wxOVERRIDE*/
|
||||
{
|
||||
m_value = value.GetString();
|
||||
return true;
|
||||
}
|
||||
virtual bool SetValue(const wxVariant &value) override/*wxOVERRIDE*/
|
||||
{
|
||||
m_value = value.GetString();
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool GetValue(wxVariant &WXUNUSED(value)) const override/*wxOVERRIDE*/{ return true; }
|
||||
virtual bool GetValue(wxVariant &WXUNUSED(value)) const override/*wxOVERRIDE*/{ return true; }
|
||||
|
||||
virtual bool HasEditorCtrl() const override/*wxOVERRIDE*/{ return true; }
|
||||
virtual bool HasEditorCtrl() const override/*wxOVERRIDE*/{ return true; }
|
||||
|
||||
virtual wxWindow*
|
||||
CreateEditorCtrl(wxWindow* parent,
|
||||
wxRect labelRect,
|
||||
const wxVariant& value) override/*wxOVERRIDE*/
|
||||
{
|
||||
wxTextCtrl* text = new wxTextCtrl(parent, wxID_ANY, value,
|
||||
labelRect.GetPosition(),
|
||||
labelRect.GetSize(),
|
||||
wxTE_PROCESS_ENTER);
|
||||
text->SetInsertionPointEnd();
|
||||
virtual wxWindow*
|
||||
CreateEditorCtrl(wxWindow* parent,
|
||||
wxRect labelRect,
|
||||
const wxVariant& value) override/*wxOVERRIDE*/
|
||||
{
|
||||
wxTextCtrl* text = new wxTextCtrl(parent, wxID_ANY, value,
|
||||
labelRect.GetPosition(),
|
||||
labelRect.GetSize(),
|
||||
wxTE_PROCESS_ENTER);
|
||||
text->SetInsertionPointEnd();
|
||||
|
||||
return text;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
GetValueFromEditorCtrl(wxWindow* ctrl, wxVariant& value) override/*wxOVERRIDE*/
|
||||
{
|
||||
wxTextCtrl* text = wxDynamicCast(ctrl, wxTextCtrl);
|
||||
if (!text)
|
||||
return false;
|
||||
virtual bool
|
||||
GetValueFromEditorCtrl(wxWindow* ctrl, wxVariant& value) override/*wxOVERRIDE*/
|
||||
{
|
||||
wxTextCtrl* text = wxDynamicCast(ctrl, wxTextCtrl);
|
||||
if (!text)
|
||||
return false;
|
||||
|
||||
value = text->GetValue();
|
||||
value = text->GetValue();
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
wxString m_value;
|
||||
wxString m_value;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -662,7 +663,7 @@ class ScalableBitmap
|
|||
{
|
||||
public:
|
||||
ScalableBitmap() {};
|
||||
ScalableBitmap( wxWindow *parent,
|
||||
ScalableBitmap( wxWindow *parent,
|
||||
const std::string& icon_name = "",
|
||||
const int px_cnt = 16,
|
||||
const bool is_horizontal = false);
|
||||
|
|
@ -708,9 +709,9 @@ public:
|
|||
DoubleSlider(
|
||||
wxWindow *parent,
|
||||
wxWindowID id,
|
||||
int lowerValue,
|
||||
int higherValue,
|
||||
int minValue,
|
||||
int lowerValue,
|
||||
int higherValue,
|
||||
int minValue,
|
||||
int maxValue,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
|
|
@ -753,8 +754,8 @@ public:
|
|||
EnableTickManipulation(false);
|
||||
}
|
||||
|
||||
bool is_horizontal() const { return m_style == wxSL_HORIZONTAL; }
|
||||
bool is_one_layer() const { return m_is_one_layer; }
|
||||
bool is_horizontal() const { return m_style == wxSL_HORIZONTAL; }
|
||||
bool is_one_layer() const { return m_is_one_layer; }
|
||||
bool is_lower_at_min() const { return m_lower_value == m_min_value; }
|
||||
bool is_higher_at_max() const { return m_higher_value == m_max_value; }
|
||||
bool is_full_span() const { return this->is_lower_at_min() && this->is_higher_at_max(); }
|
||||
|
|
@ -773,7 +774,7 @@ public:
|
|||
void OnRightUp(wxMouseEvent& event);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
void render();
|
||||
void draw_focus_rect();
|
||||
void draw_action_icon(wxDC& dc, const wxPoint pt_beg, const wxPoint pt_end);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue