Merge remote-tracking branch 'origin/master' into feature_slice_to_png
This commit is contained in:
commit
d337b69407
@ -186,7 +186,6 @@ sub new {
|
|||||||
# Initialize 3D toolpaths preview
|
# Initialize 3D toolpaths preview
|
||||||
if ($Slic3r::GUI::have_OpenGL) {
|
if ($Slic3r::GUI::have_OpenGL) {
|
||||||
$self->{preview3D} = Slic3r::GUI::Plater::3DPreview->new($self->{preview_notebook}, $self->{print}, $self->{gcode_preview_data}, $self->{config});
|
$self->{preview3D} = Slic3r::GUI::Plater::3DPreview->new($self->{preview_notebook}, $self->{print}, $self->{gcode_preview_data}, $self->{config});
|
||||||
Slic3r::GUI::_3DScene::set_active($self->{preview3D}->canvas, 0);
|
|
||||||
Slic3r::GUI::_3DScene::enable_legend_texture($self->{preview3D}->canvas, 1);
|
Slic3r::GUI::_3DScene::enable_legend_texture($self->{preview3D}->canvas, 1);
|
||||||
Slic3r::GUI::_3DScene::register_on_viewport_changed_callback($self->{preview3D}->canvas, sub { Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{canvas3D}, $self->{preview3D}->canvas); });
|
Slic3r::GUI::_3DScene::register_on_viewport_changed_callback($self->{preview3D}->canvas, sub { Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{canvas3D}, $self->{preview3D}->canvas); });
|
||||||
$self->{preview_notebook}->AddPage($self->{preview3D}, L('Preview'));
|
$self->{preview_notebook}->AddPage($self->{preview3D}, L('Preview'));
|
||||||
@ -202,19 +201,12 @@ sub new {
|
|||||||
EVT_NOTEBOOK_PAGE_CHANGED($self, $self->{preview_notebook}, sub {
|
EVT_NOTEBOOK_PAGE_CHANGED($self, $self->{preview_notebook}, sub {
|
||||||
my $preview = $self->{preview_notebook}->GetCurrentPage;
|
my $preview = $self->{preview_notebook}->GetCurrentPage;
|
||||||
if (($preview != $self->{preview3D}) && ($preview != $self->{canvas3D})) {
|
if (($preview != $self->{preview3D}) && ($preview != $self->{canvas3D})) {
|
||||||
Slic3r::GUI::_3DScene::set_active($self->{preview3D}->canvas, 0);
|
|
||||||
Slic3r::GUI::_3DScene::set_active($self->{canvas3D}, 0);
|
|
||||||
Slic3r::GUI::_3DScene::reset_current_canvas();
|
|
||||||
$preview->OnActivate if $preview->can('OnActivate');
|
$preview->OnActivate if $preview->can('OnActivate');
|
||||||
} elsif ($preview == $self->{preview3D}) {
|
} elsif ($preview == $self->{preview3D}) {
|
||||||
Slic3r::GUI::_3DScene::set_active($self->{preview3D}->canvas, 1);
|
|
||||||
Slic3r::GUI::_3DScene::set_active($self->{canvas3D}, 0);
|
|
||||||
$self->{preview3D}->load_print;
|
$self->{preview3D}->load_print;
|
||||||
# sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably)
|
# sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably)
|
||||||
Slic3r::GUI::_3DScene::set_as_dirty($self->{preview3D}->canvas);
|
Slic3r::GUI::_3DScene::set_as_dirty($self->{preview3D}->canvas);
|
||||||
} elsif ($preview == $self->{canvas3D}) {
|
} elsif ($preview == $self->{canvas3D}) {
|
||||||
Slic3r::GUI::_3DScene::set_active($self->{canvas3D}, 1);
|
|
||||||
Slic3r::GUI::_3DScene::set_active($self->{preview3D}->canvas, 0);
|
|
||||||
if (Slic3r::GUI::_3DScene::is_reload_delayed($self->{canvas3D})) {
|
if (Slic3r::GUI::_3DScene::is_reload_delayed($self->{canvas3D})) {
|
||||||
my $selections = $self->collect_selections;
|
my $selections = $self->collect_selections;
|
||||||
Slic3r::GUI::_3DScene::set_objects_selections($self->{canvas3D}, \@$selections);
|
Slic3r::GUI::_3DScene::set_objects_selections($self->{canvas3D}, \@$selections);
|
||||||
|
@ -279,7 +279,6 @@ sub reload_print {
|
|||||||
my ($self, $force) = @_;
|
my ($self, $force) = @_;
|
||||||
|
|
||||||
Slic3r::GUI::_3DScene::reset_volumes($self->canvas);
|
Slic3r::GUI::_3DScene::reset_volumes($self->canvas);
|
||||||
Slic3r::GUI::_3DScene::reset_current_canvas();
|
|
||||||
$self->_loaded(0);
|
$self->_loaded(0);
|
||||||
|
|
||||||
if (! $self->IsShown && ! $force) {
|
if (! $self->IsShown && ! $force) {
|
||||||
|
@ -1754,21 +1754,6 @@ bool _3DScene::init(wxGLCanvas* canvas)
|
|||||||
return s_canvas_mgr.init(canvas);
|
return s_canvas_mgr.init(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _3DScene::set_current(wxGLCanvas* canvas, bool force)
|
|
||||||
{
|
|
||||||
return s_canvas_mgr.set_current(canvas, force);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _3DScene::reset_current_canvas()
|
|
||||||
{
|
|
||||||
s_canvas_mgr.set_current(nullptr, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _3DScene::set_active(wxGLCanvas* canvas, bool active)
|
|
||||||
{
|
|
||||||
s_canvas_mgr.set_active(canvas, active);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _3DScene::set_as_dirty(wxGLCanvas* canvas)
|
void _3DScene::set_as_dirty(wxGLCanvas* canvas)
|
||||||
{
|
{
|
||||||
s_canvas_mgr.set_as_dirty(canvas);
|
s_canvas_mgr.set_as_dirty(canvas);
|
||||||
|
@ -516,10 +516,6 @@ public:
|
|||||||
|
|
||||||
static bool init(wxGLCanvas* canvas);
|
static bool init(wxGLCanvas* canvas);
|
||||||
|
|
||||||
static bool set_current(wxGLCanvas* canvas, bool force);
|
|
||||||
static void reset_current_canvas();
|
|
||||||
|
|
||||||
static void set_active(wxGLCanvas* canvas, bool active);
|
|
||||||
static void set_as_dirty(wxGLCanvas* canvas);
|
static void set_as_dirty(wxGLCanvas* canvas);
|
||||||
|
|
||||||
static unsigned int get_volumes_count(wxGLCanvas* canvas);
|
static unsigned int get_volumes_count(wxGLCanvas* canvas);
|
||||||
|
@ -83,8 +83,11 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, cons
|
|||||||
|
|
||||||
const auto model_id = model.id;
|
const auto model_id = model.id;
|
||||||
|
|
||||||
|
bool default_variant = true; // Mark the first variant as default in the GUI
|
||||||
for (const auto &variant : model.variants) {
|
for (const auto &variant : model.variants) {
|
||||||
const auto label = wxString::Format("%s %s %s", variant.name, _(L("mm")), _(L("nozzle")));
|
const auto label = wxString::Format("%s %s %s %s", variant.name, _(L("mm")), _(L("nozzle")),
|
||||||
|
(default_variant ? _(L("(default)")) : wxString()));
|
||||||
|
default_variant = false;
|
||||||
auto *cbox = new Checkbox(panel, label, model_id, variant.name);
|
auto *cbox = new Checkbox(panel, label, model_id, variant.name);
|
||||||
const size_t idx = cboxes.size();
|
const size_t idx = cboxes.size();
|
||||||
cboxes.push_back(cbox);
|
cboxes.push_back(cbox);
|
||||||
@ -113,11 +116,6 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, cons
|
|||||||
sizer->Add(all_none_sizer, 0, wxEXPAND);
|
sizer->Add(all_none_sizer, 0, wxEXPAND);
|
||||||
|
|
||||||
SetSizer(sizer);
|
SetSizer(sizer);
|
||||||
|
|
||||||
if (cboxes.size() > 0) {
|
|
||||||
cboxes[0]->SetValue(true);
|
|
||||||
on_checkbox(cboxes[0], true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrinterPicker::select_all(bool select)
|
void PrinterPicker::select_all(bool select)
|
||||||
@ -130,6 +128,14 @@ void PrinterPicker::select_all(bool select)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrinterPicker::select_one(size_t i, bool select)
|
||||||
|
{
|
||||||
|
if (i < cboxes.size() && cboxes[i]->GetValue() != select) {
|
||||||
|
cboxes[i]->SetValue(select);
|
||||||
|
on_checkbox(cboxes[i], select);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PrinterPicker::on_checkbox(const Checkbox *cbox, bool checked)
|
void PrinterPicker::on_checkbox(const Checkbox *cbox, bool checked)
|
||||||
{
|
{
|
||||||
variants_checked += checked ? 1 : -1;
|
variants_checked += checked ? 1 : -1;
|
||||||
@ -232,6 +238,7 @@ PageWelcome::PageWelcome(ConfigWizard *parent) :
|
|||||||
AppConfig &appconfig_vendors = this->wizard_p()->appconfig_vendors;
|
AppConfig &appconfig_vendors = this->wizard_p()->appconfig_vendors;
|
||||||
|
|
||||||
printer_picker = new PrinterPicker(this, vendor_prusa->second, appconfig_vendors);
|
printer_picker = new PrinterPicker(this, vendor_prusa->second, appconfig_vendors);
|
||||||
|
printer_picker->select_one(0, true); // Select the default (first) model/variant on the Prusa vendor
|
||||||
printer_picker->Bind(EVT_PRINTER_PICK, [this, &appconfig_vendors](const PrinterPickerEvent &evt) {
|
printer_picker->Bind(EVT_PRINTER_PICK, [this, &appconfig_vendors](const PrinterPickerEvent &evt) {
|
||||||
appconfig_vendors.set_variant(evt.vendor_id, evt.model_id, evt.variant_name, evt.enable);
|
appconfig_vendors.set_variant(evt.vendor_id, evt.model_id, evt.variant_name, evt.enable);
|
||||||
this->on_variant_checked();
|
this->on_variant_checked();
|
||||||
|
@ -56,6 +56,7 @@ struct PrinterPicker: wxPanel
|
|||||||
PrinterPicker(wxWindow *parent, const VendorProfile &vendor, const AppConfig &appconfig_vendors);
|
PrinterPicker(wxWindow *parent, const VendorProfile &vendor, const AppConfig &appconfig_vendors);
|
||||||
|
|
||||||
void select_all(bool select);
|
void select_all(bool select);
|
||||||
|
void select_one(size_t i, bool select);
|
||||||
void on_checkbox(const Checkbox *cbox, bool checked);
|
void on_checkbox(const Checkbox *cbox, bool checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1408,15 +1408,14 @@ GLGizmoBase* GLCanvas3D::Gizmos::_get_current() const
|
|||||||
return (it != m_gizmos.end()) ? it->second : nullptr;
|
return (it != m_gizmos.end()) ? it->second : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context)
|
GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
|
||||||
: m_canvas(canvas)
|
: m_canvas(canvas)
|
||||||
, m_context(context)
|
, m_context(nullptr)
|
||||||
, m_timer(nullptr)
|
, m_timer(nullptr)
|
||||||
, m_config(nullptr)
|
, m_config(nullptr)
|
||||||
, m_print(nullptr)
|
, m_print(nullptr)
|
||||||
, m_model(nullptr)
|
, m_model(nullptr)
|
||||||
, m_dirty(true)
|
, m_dirty(true)
|
||||||
, m_active(true)
|
|
||||||
, m_initialized(false)
|
, m_initialized(false)
|
||||||
, m_use_VBOs(false)
|
, m_use_VBOs(false)
|
||||||
, m_force_zoom_to_bed_enabled(false)
|
, m_force_zoom_to_bed_enabled(false)
|
||||||
@ -1434,8 +1433,11 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context)
|
|||||||
, m_reload_delayed(false)
|
, m_reload_delayed(false)
|
||||||
{
|
{
|
||||||
if (m_canvas != nullptr)
|
if (m_canvas != nullptr)
|
||||||
|
{
|
||||||
|
m_context = new wxGLContext(m_canvas);
|
||||||
m_timer = new wxTimer(m_canvas);
|
m_timer = new wxTimer(m_canvas);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GLCanvas3D::~GLCanvas3D()
|
GLCanvas3D::~GLCanvas3D()
|
||||||
{
|
{
|
||||||
@ -1447,6 +1449,12 @@ GLCanvas3D::~GLCanvas3D()
|
|||||||
m_timer = nullptr;
|
m_timer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_context != nullptr)
|
||||||
|
{
|
||||||
|
delete m_context;
|
||||||
|
m_context = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
_deregister_callbacks();
|
_deregister_callbacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1455,6 +1463,9 @@ bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl)
|
|||||||
if (m_initialized)
|
if (m_initialized)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if ((m_canvas == nullptr) || (m_context == nullptr))
|
||||||
|
return false;
|
||||||
|
|
||||||
::glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
::glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
::glClearDepth(1.0f);
|
::glClearDepth(1.0f);
|
||||||
|
|
||||||
@ -1520,19 +1531,14 @@ bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLCanvas3D::set_current(bool force)
|
bool GLCanvas3D::set_current()
|
||||||
{
|
{
|
||||||
if ((force || m_active) && (m_canvas != nullptr) && (m_context != nullptr))
|
if ((m_canvas != nullptr) && (m_context != nullptr))
|
||||||
return m_canvas->SetCurrent(*m_context);
|
return m_canvas->SetCurrent(*m_context);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::set_active(bool active)
|
|
||||||
{
|
|
||||||
m_active = active;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GLCanvas3D::set_as_dirty()
|
void GLCanvas3D::set_as_dirty()
|
||||||
{
|
{
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
@ -1549,7 +1555,7 @@ void GLCanvas3D::reset_volumes()
|
|||||||
if (!m_volumes.empty())
|
if (!m_volumes.empty())
|
||||||
{
|
{
|
||||||
// ensures this canvas is current
|
// ensures this canvas is current
|
||||||
if ((m_canvas == nullptr) || !_3DScene::set_current(m_canvas, true))
|
if (!set_current())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_volumes.release_geometry();
|
m_volumes.release_geometry();
|
||||||
@ -1655,6 +1661,8 @@ void GLCanvas3D::set_bed_shape(const Pointfs& shape)
|
|||||||
// Set the origin and size for painting of the coordinate system axes.
|
// Set the origin and size for painting of the coordinate system axes.
|
||||||
m_axes.origin = Pointf3(0.0, 0.0, (coordf_t)GROUND_Z);
|
m_axes.origin = Pointf3(0.0, 0.0, (coordf_t)GROUND_Z);
|
||||||
set_axes_length(0.3f * (float)m_bed.get_bounding_box().max_size());
|
set_axes_length(0.3f * (float)m_bed.get_bounding_box().max_size());
|
||||||
|
|
||||||
|
m_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::set_auto_bed_shape()
|
void GLCanvas3D::set_auto_bed_shape()
|
||||||
@ -1850,7 +1858,7 @@ void GLCanvas3D::render()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// ensures this canvas is current and initialized
|
// ensures this canvas is current and initialized
|
||||||
if (!_3DScene::set_current(m_canvas, false) || !_3DScene::init(m_canvas))
|
if (!set_current() || !_3DScene::init(m_canvas))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_force_zoom_to_bed_enabled)
|
if (m_force_zoom_to_bed_enabled)
|
||||||
@ -1933,7 +1941,7 @@ void GLCanvas3D::reload_scene(bool force)
|
|||||||
reset_volumes();
|
reset_volumes();
|
||||||
|
|
||||||
// ensures this canvas is current
|
// ensures this canvas is current
|
||||||
if (!_3DScene::set_current(m_canvas, true))
|
if (!set_current())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
set_bed_shape(dynamic_cast<const ConfigOptionPoints*>(m_config->option("bed_shape"))->values);
|
set_bed_shape(dynamic_cast<const ConfigOptionPoints*>(m_config->option("bed_shape"))->values);
|
||||||
@ -2008,7 +2016,7 @@ void GLCanvas3D::reload_scene(bool force)
|
|||||||
void GLCanvas3D::load_print_toolpaths()
|
void GLCanvas3D::load_print_toolpaths()
|
||||||
{
|
{
|
||||||
// ensures this canvas is current
|
// ensures this canvas is current
|
||||||
if (!_3DScene::set_current(m_canvas, true))
|
if (!set_current())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_print == nullptr)
|
if (m_print == nullptr)
|
||||||
@ -2376,7 +2384,7 @@ void GLCanvas3D::load_gcode_preview(const GCodePreviewData& preview_data, const
|
|||||||
if ((m_canvas != nullptr) && (m_print != nullptr))
|
if ((m_canvas != nullptr) && (m_print != nullptr))
|
||||||
{
|
{
|
||||||
// ensures that this canvas is current
|
// ensures that this canvas is current
|
||||||
if (!_3DScene::set_current(m_canvas, true))
|
if (!set_current())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_volumes.empty())
|
if (m_volumes.empty())
|
||||||
@ -2693,11 +2701,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (evt.LeftDClick() && (m_hover_volume_id != -1))
|
else if (evt.LeftDClick() && (m_hover_volume_id != -1))
|
||||||
{
|
|
||||||
m_active = false;
|
|
||||||
m_on_double_click_callback.call();
|
m_on_double_click_callback.call();
|
||||||
m_active = true;
|
|
||||||
}
|
|
||||||
else if (evt.LeftDown() || evt.RightDown())
|
else if (evt.LeftDown() || evt.RightDown())
|
||||||
{
|
{
|
||||||
// If user pressed left or right button we first check whether this happened
|
// If user pressed left or right button we first check whether this happened
|
||||||
@ -2793,11 +2797,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
{
|
{
|
||||||
// if right clicking on volume, propagate event through callback
|
// if right clicking on volume, propagate event through callback
|
||||||
if (m_volumes.volumes[volume_idx]->hover)
|
if (m_volumes.volumes[volume_idx]->hover)
|
||||||
{
|
|
||||||
m_active = false;
|
|
||||||
m_on_right_click_callback.call(pos.x, pos.y);
|
m_on_right_click_callback.call(pos.x, pos.y);
|
||||||
m_active = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3004,7 +3004,7 @@ Point GLCanvas3D::get_local_mouse_position() const
|
|||||||
|
|
||||||
bool GLCanvas3D::_is_shown_on_screen() const
|
bool GLCanvas3D::_is_shown_on_screen() const
|
||||||
{
|
{
|
||||||
return (m_canvas != nullptr) ? m_active && m_canvas->IsShownOnScreen() : false;
|
return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::_force_zoom_to_bed()
|
void GLCanvas3D::_force_zoom_to_bed()
|
||||||
@ -3019,7 +3019,7 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// ensures that this canvas is current
|
// ensures that this canvas is current
|
||||||
_3DScene::set_current(m_canvas, false);
|
set_current();
|
||||||
::glViewport(0, 0, w, h);
|
::glViewport(0, 0, w, h);
|
||||||
|
|
||||||
::glMatrixMode(GL_PROJECTION);
|
::glMatrixMode(GL_PROJECTION);
|
||||||
|
@ -401,9 +401,6 @@ private:
|
|||||||
Model* m_model;
|
Model* m_model;
|
||||||
|
|
||||||
bool m_dirty;
|
bool m_dirty;
|
||||||
// the active member has been introduced to overcome a bug in wxWidgets method IsShownOnScreen() which always return true
|
|
||||||
// when a window is inside a wxNotebook
|
|
||||||
bool m_active;
|
|
||||||
bool m_initialized;
|
bool m_initialized;
|
||||||
bool m_use_VBOs;
|
bool m_use_VBOs;
|
||||||
bool m_force_zoom_to_bed_enabled;
|
bool m_force_zoom_to_bed_enabled;
|
||||||
@ -444,14 +441,13 @@ private:
|
|||||||
PerlCallback m_on_gizmo_scale_uniformly_callback;
|
PerlCallback m_on_gizmo_scale_uniformly_callback;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context);
|
GLCanvas3D(wxGLCanvas* canvas);
|
||||||
~GLCanvas3D();
|
~GLCanvas3D();
|
||||||
|
|
||||||
bool init(bool useVBOs, bool use_legacy_opengl);
|
bool init(bool useVBOs, bool use_legacy_opengl);
|
||||||
|
|
||||||
bool set_current(bool force);
|
bool set_current();
|
||||||
|
|
||||||
void set_active(bool active);
|
|
||||||
void set_as_dirty();
|
void set_as_dirty();
|
||||||
|
|
||||||
unsigned int get_volumes_count() const;
|
unsigned int get_volumes_count() const;
|
||||||
|
@ -114,20 +114,13 @@ std::string GLCanvas3DManager::GLInfo::to_string(bool format_as_html, bool exten
|
|||||||
}
|
}
|
||||||
|
|
||||||
GLCanvas3DManager::GLCanvas3DManager()
|
GLCanvas3DManager::GLCanvas3DManager()
|
||||||
: m_context(nullptr)
|
: m_current(nullptr)
|
||||||
, m_current(nullptr)
|
|
||||||
, m_gl_initialized(false)
|
, m_gl_initialized(false)
|
||||||
, m_use_legacy_opengl(false)
|
, m_use_legacy_opengl(false)
|
||||||
, m_use_VBOs(false)
|
, m_use_VBOs(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
GLCanvas3DManager::~GLCanvas3DManager()
|
|
||||||
{
|
|
||||||
if (m_context != nullptr)
|
|
||||||
delete m_context;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GLCanvas3DManager::add(wxGLCanvas* canvas)
|
bool GLCanvas3DManager::add(wxGLCanvas* canvas)
|
||||||
{
|
{
|
||||||
if (canvas == nullptr)
|
if (canvas == nullptr)
|
||||||
@ -136,14 +129,7 @@ bool GLCanvas3DManager::add(wxGLCanvas* canvas)
|
|||||||
if (_get_canvas(canvas) != m_canvases.end())
|
if (_get_canvas(canvas) != m_canvases.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_context == nullptr)
|
GLCanvas3D* canvas3D = new GLCanvas3D(canvas);
|
||||||
{
|
|
||||||
m_context = new wxGLContext(canvas);
|
|
||||||
if (m_context == nullptr)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLCanvas3D* canvas3D = new GLCanvas3D(canvas, m_context);
|
|
||||||
if (canvas3D == nullptr)
|
if (canvas3D == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -213,41 +199,6 @@ bool GLCanvas3DManager::init(wxGLCanvas* canvas)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLCanvas3DManager::set_current(wxGLCanvas* canvas, bool force)
|
|
||||||
{
|
|
||||||
// given canvas is already current, return
|
|
||||||
if (m_current == canvas)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (canvas == nullptr)
|
|
||||||
{
|
|
||||||
m_current = nullptr;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set given canvas as current
|
|
||||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
|
||||||
if (it != m_canvases.end())
|
|
||||||
{
|
|
||||||
bool res = it->second->set_current(force);
|
|
||||||
if (res)
|
|
||||||
{
|
|
||||||
m_current = canvas;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_current = nullptr;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GLCanvas3DManager::set_active(wxGLCanvas* canvas, bool active)
|
|
||||||
{
|
|
||||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
|
||||||
if (it != m_canvases.end())
|
|
||||||
it->second->set_active(active);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GLCanvas3DManager::set_as_dirty(wxGLCanvas* canvas)
|
void GLCanvas3DManager::set_as_dirty(wxGLCanvas* canvas)
|
||||||
{
|
{
|
||||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||||
|
@ -43,7 +43,6 @@ class GLCanvas3DManager
|
|||||||
|
|
||||||
typedef std::map<wxGLCanvas*, GLCanvas3D*> CanvasesMap;
|
typedef std::map<wxGLCanvas*, GLCanvas3D*> CanvasesMap;
|
||||||
|
|
||||||
wxGLContext* m_context;
|
|
||||||
CanvasesMap m_canvases;
|
CanvasesMap m_canvases;
|
||||||
wxGLCanvas* m_current;
|
wxGLCanvas* m_current;
|
||||||
GLInfo m_gl_info;
|
GLInfo m_gl_info;
|
||||||
@ -53,7 +52,6 @@ class GLCanvas3DManager
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
GLCanvas3DManager();
|
GLCanvas3DManager();
|
||||||
~GLCanvas3DManager();
|
|
||||||
|
|
||||||
bool add(wxGLCanvas* canvas);
|
bool add(wxGLCanvas* canvas);
|
||||||
bool remove(wxGLCanvas* canvas);
|
bool remove(wxGLCanvas* canvas);
|
||||||
@ -70,8 +68,6 @@ public:
|
|||||||
|
|
||||||
bool init(wxGLCanvas* canvas);
|
bool init(wxGLCanvas* canvas);
|
||||||
|
|
||||||
bool set_current(wxGLCanvas* canvas, bool force);
|
|
||||||
void set_active(wxGLCanvas* canvas, bool active);
|
|
||||||
void set_as_dirty(wxGLCanvas* canvas);
|
void set_as_dirty(wxGLCanvas* canvas);
|
||||||
|
|
||||||
unsigned int get_volumes_count(wxGLCanvas* canvas) const;
|
unsigned int get_volumes_count(wxGLCanvas* canvas) const;
|
||||||
|
@ -71,6 +71,7 @@ Http::priv::priv(const std::string &url) :
|
|||||||
form(nullptr),
|
form(nullptr),
|
||||||
form_end(nullptr),
|
form_end(nullptr),
|
||||||
headerlist(nullptr),
|
headerlist(nullptr),
|
||||||
|
limit(0),
|
||||||
cancel(false)
|
cancel(false)
|
||||||
{
|
{
|
||||||
if (curl == nullptr) {
|
if (curl == nullptr) {
|
||||||
|
@ -46,7 +46,8 @@ public:
|
|||||||
Http& operator=(const Http &) = delete;
|
Http& operator=(const Http &) = delete;
|
||||||
Http& operator=(Http &&) = delete;
|
Http& operator=(Http &&) = delete;
|
||||||
|
|
||||||
// Sets a maximum size of the data that can be received. The default is 5MB.
|
// Sets a maximum size of the data that can be received.
|
||||||
|
// A value of zero sets the default limit, which is is 5MB.
|
||||||
Http& size_limit(size_t sizeLimit);
|
Http& size_limit(size_t sizeLimit);
|
||||||
// Sets a HTTP header field.
|
// Sets a HTTP header field.
|
||||||
Http& header(std::string name, const std::string &value);
|
Http& header(std::string name, const std::string &value);
|
||||||
|
@ -537,15 +537,15 @@ bool PresetUpdater::config_update() const
|
|||||||
incompats_map.emplace(std::make_pair(std::move(vendor), std::move(restrictions)));
|
incompats_map.emplace(std::make_pair(std::move(vendor), std::move(restrictions)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p->had_config_update = true; // This needs to be done before a dialog is shown because of OnIdle() + CallAfter() in Perl
|
||||||
|
|
||||||
GUI::MsgDataIncompatible dlg(std::move(incompats_map));
|
GUI::MsgDataIncompatible dlg(std::move(incompats_map));
|
||||||
const auto res = dlg.ShowModal();
|
const auto res = dlg.ShowModal();
|
||||||
if (res == wxID_REPLACE) {
|
if (res == wxID_REPLACE) {
|
||||||
BOOST_LOG_TRIVIAL(info) << "User wants to re-configure...";
|
BOOST_LOG_TRIVIAL(info) << "User wants to re-configure...";
|
||||||
p->perform_updates(std::move(updates));
|
p->perform_updates(std::move(updates));
|
||||||
GUI::ConfigWizard wizard(nullptr, GUI::ConfigWizard::RR_DATA_INCOMPAT);
|
GUI::ConfigWizard wizard(nullptr, GUI::ConfigWizard::RR_DATA_INCOMPAT);
|
||||||
if (wizard.run(GUI::get_preset_bundle(), this)) {
|
if (! wizard.run(GUI::get_preset_bundle(), this)) {
|
||||||
p->had_config_update = true;
|
|
||||||
} else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -566,6 +566,8 @@ bool PresetUpdater::config_update() const
|
|||||||
updates_map.emplace(std::make_pair(std::move(vendor), std::move(ver_str)));
|
updates_map.emplace(std::make_pair(std::move(vendor), std::move(ver_str)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p->had_config_update = true; // Ditto, see above
|
||||||
|
|
||||||
GUI::MsgUpdateConfig dlg(std::move(updates_map));
|
GUI::MsgUpdateConfig dlg(std::move(updates_map));
|
||||||
|
|
||||||
const auto res = dlg.ShowModal();
|
const auto res = dlg.ShowModal();
|
||||||
@ -581,8 +583,6 @@ bool PresetUpdater::config_update() const
|
|||||||
} else {
|
} else {
|
||||||
BOOST_LOG_TRIVIAL(info) << "User refused the update";
|
BOOST_LOG_TRIVIAL(info) << "User refused the update";
|
||||||
}
|
}
|
||||||
|
|
||||||
p->had_config_update = true;
|
|
||||||
} else {
|
} else {
|
||||||
BOOST_LOG_TRIVIAL(info) << "No configuration updates available.";
|
BOOST_LOG_TRIVIAL(info) << "No configuration updates available.";
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
try {
|
try {
|
||||||
THIS->do_export(print, path, preview_data);
|
THIS->do_export(print, path, preview_data);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
croak(e.what());
|
croak("%s\n", e.what());
|
||||||
}
|
}
|
||||||
%};
|
%};
|
||||||
|
|
||||||
|
@ -190,18 +190,6 @@ remove_all_canvases()
|
|||||||
CODE:
|
CODE:
|
||||||
_3DScene::remove_all_canvases();
|
_3DScene::remove_all_canvases();
|
||||||
|
|
||||||
void
|
|
||||||
reset_current_canvas()
|
|
||||||
CODE:
|
|
||||||
_3DScene::reset_current_canvas();
|
|
||||||
|
|
||||||
void
|
|
||||||
set_active(canvas, active)
|
|
||||||
SV *canvas;
|
|
||||||
bool active;
|
|
||||||
CODE:
|
|
||||||
_3DScene::set_active((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), active);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
set_as_dirty(canvas)
|
set_as_dirty(canvas)
|
||||||
SV *canvas;
|
SV *canvas;
|
||||||
|
Loading…
Reference in New Issue
Block a user