mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-31 02:22:01 +08:00
Stubbed Plater constructor.
This commit is contained in:
parent
31ed51de00
commit
48b13aa1c7
@ -3,7 +3,96 @@
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
Plater::Plater(wxWindow* parent, const wxString& title) :
|
||||
wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title) { }
|
||||
wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, title),
|
||||
print(Slic3r::Print())
|
||||
{
|
||||
|
||||
auto on_select_object { [=](uint32_t& obj_idx) {
|
||||
// this->select_object(obj_idx);
|
||||
} };
|
||||
/*
|
||||
# Initialize handlers for canvases
|
||||
my $on_select_object = sub {
|
||||
my ($obj_idx) = @_;
|
||||
$self->select_object($obj_idx);
|
||||
};
|
||||
my $on_double_click = sub {
|
||||
$self->object_settings_dialog if $self->selected_object;
|
||||
};
|
||||
my $on_right_click = sub {
|
||||
my ($canvas, $click_pos) = @_;
|
||||
|
||||
my ($obj_idx, $object) = $self->selected_object;
|
||||
return if !defined $obj_idx;
|
||||
|
||||
my $menu = $self->object_menu;
|
||||
$canvas->PopupMenu($menu, $click_pos);
|
||||
$menu->Destroy;
|
||||
};
|
||||
my $on_instances_moved = sub {
|
||||
$self->on_model_change;
|
||||
};
|
||||
# Initialize 3D plater
|
||||
if ($Slic3r::GUI::have_OpenGL) {
|
||||
$self->{canvas3D} = Slic3r::GUI::Plater::3D->new($self->{preview_notebook}, $self->{objects}, $self->{model}, $self->{config});
|
||||
$self->{preview_notebook}->AddPage($self->{canvas3D}, '3D');
|
||||
$self->{canvas3D}->set_on_select_object($on_select_object);
|
||||
$self->{canvas3D}->set_on_double_click($on_double_click);
|
||||
$self->{canvas3D}->set_on_right_click(sub { $on_right_click->($self->{canvas3D}, @_); });
|
||||
$self->{canvas3D}->set_on_instances_moved($on_instances_moved);
|
||||
$self->{canvas3D}->on_viewport_changed(sub {
|
||||
$self->{preview3D}->canvas->set_viewport_from_scene($self->{canvas3D});
|
||||
});
|
||||
}
|
||||
# Initialize 2D preview canvas
|
||||
$self->{canvas} = Slic3r::GUI::Plater::2D->new($self->{preview_notebook}, wxDefaultSize, $self->{objects}, $self->{model}, $self->{config});
|
||||
$self->{preview_notebook}->AddPage($self->{canvas}, '2D');
|
||||
$self->{canvas}->on_select_object($on_select_object);
|
||||
$self->{canvas}->on_double_click($on_double_click);
|
||||
$self->{canvas}->on_right_click(sub { $on_right_click->($self->{canvas}, @_); });
|
||||
$self->{canvas}->on_instances_moved($on_instances_moved);
|
||||
|
||||
# Initialize 3D toolpaths preview
|
||||
$self->{preview3D_page_idx} = -1;
|
||||
if ($Slic3r::GUI::have_OpenGL) {
|
||||
$self->{preview3D} = Slic3r::GUI::Plater::3DPreview->new($self->{preview_notebook}, $self->{print});
|
||||
$self->{preview3D}->canvas->on_viewport_changed(sub {
|
||||
$self->{canvas3D}->set_viewport_from_scene($self->{preview3D}->canvas);
|
||||
});
|
||||
$self->{preview_notebook}->AddPage($self->{preview3D}, 'Preview');
|
||||
$self->{preview3D_page_idx} = $self->{preview_notebook}->GetPageCount-1;
|
||||
}
|
||||
|
||||
# Initialize toolpaths preview
|
||||
$self->{toolpaths2D_page_idx} = -1;
|
||||
if ($Slic3r::GUI::have_OpenGL) {
|
||||
$self->{toolpaths2D} = Slic3r::GUI::Plater::2DToolpaths->new($self->{preview_notebook}, $self->{print});
|
||||
$self->{preview_notebook}->AddPage($self->{toolpaths2D}, 'Layers');
|
||||
$self->{toolpaths2D_page_idx} = $self->{preview_notebook}->GetPageCount-1;
|
||||
}
|
||||
|
||||
EVT_NOTEBOOK_PAGE_CHANGED($self, $self->{preview_notebook}, sub {
|
||||
wxTheApp->CallAfter(sub {
|
||||
my $sel = $self->{preview_notebook}->GetSelection;
|
||||
if ($sel == $self->{preview3D_page_idx} || $sel == $self->{toolpaths2D_page_idx}) {
|
||||
if (!$Slic3r::GUI::Settings->{_}{background_processing} && !$self->{processed}) {
|
||||
$self->statusbar->SetCancelCallback(sub {
|
||||
$self->stop_background_process;
|
||||
$self->statusbar->SetStatusText("Slicing cancelled");
|
||||
$self->{preview_notebook}->SetSelection(0);
|
||||
|
||||
});
|
||||
$self->start_background_process;
|
||||
} else {
|
||||
$self->{preview3D}->load_print
|
||||
if $sel == $self->{preview3D_page_idx};
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
}
|
||||
void Plater::add() {
|
||||
|
||||
}
|
||||
|
@ -5,14 +5,48 @@
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
#include <wx/notebook.h>
|
||||
|
||||
#include <stack>
|
||||
|
||||
#include "libslic3r.h"
|
||||
#include "Model.hpp"
|
||||
#include "Print.hpp"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
using UndoOperation = int;
|
||||
|
||||
class Plater2DObject;
|
||||
|
||||
class Plater : public wxPanel
|
||||
{
|
||||
public:
|
||||
Plater(wxWindow* parent, const wxString& title);
|
||||
void add();
|
||||
|
||||
private:
|
||||
Print print;
|
||||
Model model;
|
||||
|
||||
bool processed {false};
|
||||
|
||||
std::vector<Plater2DObject> objects;
|
||||
|
||||
std::stack<UndoOperation> undo {};
|
||||
std::stack<UndoOperation> redo {};
|
||||
|
||||
wxNotebook* preview_notebook {new wxNotebook(this, -1, wxDefaultPosition, wxSize(335,335), wxNB_BOTTOM)};
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 2D Preview of an object
|
||||
class Plater2DObject {
|
||||
public:
|
||||
std::string name {""};
|
||||
std::string identifier {""};
|
||||
bool selected {false};
|
||||
};
|
||||
|
||||
} } // Namespace Slic3r::GUI
|
||||
|
Loading…
x
Reference in New Issue
Block a user