mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-05 12:40:40 +08:00
Stubbed in Plater menu.
This commit is contained in:
parent
d72dc8e8e4
commit
148316f211
@ -118,11 +118,37 @@ void MainFrame::init_menubar()
|
||||
append_menu_item(menuFile, _(L"Open STL/OBJ/AMF/3MF…"), _("Open a model"), [=](wxCommandEvent& e) { if (this->plater != nullptr) this->plater->add();}, wxID_ANY, "brick_add.png", "Ctrl+O");
|
||||
}
|
||||
|
||||
wxMenu* menuPlater = new wxMenu();
|
||||
wxMenu* menuPlater = this->plater_menu = new wxMenu();
|
||||
{
|
||||
append_menu_item(menuPlater, _(L"Arrange…"), _("Arrange models on plater"), [this](wxCommandEvent& e) { if (this->plater != nullptr) this->plater->arrange();}, wxID_ANY, "bricks.png", "Ctrl+G");
|
||||
wxMenu* selectMenu = this->plater_select_menu = new wxMenu();
|
||||
append_submenu(menuPlater, _("Select"), _("Select an object in the plater"), selectMenu, wxID_ANY, "brick.png");
|
||||
append_menu_item(menuPlater, _("Undo"), _("Undo"), [this](wxCommandEvent& e) { this->plater->undo(); }, wxID_ANY, "arrow_undo.png", "Ctrl+Z");
|
||||
append_menu_item(menuPlater, _("Redo"), _("Redo"), [this](wxCommandEvent& e) { this->plater->redo(); }, wxID_ANY, "arrow_redo.png", "Ctrl+Shift+Z");
|
||||
append_menu_item(menuPlater, _("Select Next Object"), _("Select Next Object in the plater"),
|
||||
[this](wxCommandEvent& e) { this->plater->select_next(); }, wxID_ANY, "arrow_right.png", "Ctrl+Right");
|
||||
append_menu_item(menuPlater, _("Select Prev Object"), _("Select Previous Object in the plater"),
|
||||
[this](wxCommandEvent& e) { this->plater->select_prev(); }, wxID_ANY, "arrow_left.png", "Ctrl+Left");
|
||||
append_menu_item(menuPlater, _("Zoom In"), _("Zoom In"),
|
||||
[this](wxCommandEvent& e) { this->plater->zoom(Zoom::In); }, wxID_ANY, "zoom_in.png", "Ctrl+Up");
|
||||
append_menu_item(menuPlater, _("Zoom Out"), _("Zoom Out"),
|
||||
[this](wxCommandEvent& e) { this->plater->zoom(Zoom::In); }, wxID_ANY, "zoom_out.png", "Ctrl+Down");
|
||||
menuPlater->AppendSeparator();
|
||||
append_menu_item(menuPlater, _("Export G-code..."), _("Export current plate as G-code"),
|
||||
[this](wxCommandEvent& e) { this->plater->export_gcode(); }, wxID_ANY, "cog_go.png");
|
||||
append_menu_item(menuPlater, _("Export plate as STL..."), _("Export current plate as STL"),
|
||||
[this](wxCommandEvent& e) { this->plater->export_stl(); }, wxID_ANY, "brick_go.png");
|
||||
append_menu_item(menuPlater, _("Export plate with modifiers as AMF..."), _("Export current plate as AMF, including all modifier meshes"),
|
||||
[this](wxCommandEvent& e) { this->plater->export_amf(); }, wxID_ANY, "brick_go.png");
|
||||
append_menu_item(menuPlater, _("Export plate with modifiers as 3MF..."), _("Export current plate as 3MF, including all modifier meshes"),
|
||||
[this](wxCommandEvent& e) { this->plater->export_tmf(); }, wxID_ANY, "brick_go.png");
|
||||
|
||||
|
||||
|
||||
}
|
||||
wxMenu* menuObject = this->plater->object_menu();
|
||||
this->on_plater_object_list_changed(false);
|
||||
this->on_plater_selection_changed(false);
|
||||
|
||||
wxMenu* menuSettings = new wxMenu();
|
||||
{
|
||||
}
|
||||
|
@ -31,6 +31,9 @@ public:
|
||||
MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||
MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, std::shared_ptr<Settings> _gui_config);
|
||||
ProgressStatusBar* statusbar {new ProgressStatusBar(this, -1)};
|
||||
|
||||
bool has_plater_menu() { return this->plater_menu != nullptr; }
|
||||
wxMenu* plater_select_menu {nullptr};
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
|
||||
@ -45,10 +48,15 @@ private:
|
||||
Controller* controller;
|
||||
Plater* plater;
|
||||
|
||||
wxMenu* plater_menu {nullptr};
|
||||
|
||||
|
||||
std::shared_ptr<Settings> gui_config;
|
||||
std::map<wxWindowID, PresetEditor*> preset_editor_tabs;
|
||||
|
||||
void on_plater_object_list_changed(bool force) {};
|
||||
void on_plater_selection_changed(bool force) {};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -278,7 +278,7 @@ std::vector<int> Plater::load_file(const std::string file, const int obj_idx_to_
|
||||
}
|
||||
|
||||
progress_dialog->Destroy();
|
||||
this->redo = std::stack<UndoOperation>();
|
||||
this->_redo = std::stack<UndoOperation>();
|
||||
return obj_idx;
|
||||
}
|
||||
|
||||
@ -482,13 +482,15 @@ void Plater::selection_changed() {
|
||||
|
||||
auto obj = this->selected_object();
|
||||
bool have_sel {obj != this->objects.end()};
|
||||
/*
|
||||
if (my $menu = $self->GetFrame->{plater_select_menu}) {
|
||||
$_->Check(0) for $menu->GetMenuItems;
|
||||
if ($have_sel) {
|
||||
$menu->FindItemByPosition($obj_idx)->Check(1);
|
||||
auto* menu {this->GetFrame()->plater_select_menu};
|
||||
if (menu != nullptr) {
|
||||
for (auto* item : menu->GetMenuItems()) {
|
||||
item->Check(false);
|
||||
}
|
||||
if (have_sel)
|
||||
menu->FindItemByPosition(obj->identifier)->Check(true);
|
||||
}
|
||||
/*
|
||||
|
||||
my $method = $have_sel ? 'Enable' : 'Disable';
|
||||
$self->{"btn_$_"}->$method
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/toolbar.h>
|
||||
#include <wx/menu.h>
|
||||
|
||||
#include <stack>
|
||||
|
||||
@ -34,6 +35,10 @@ enum class UndoCmd {
|
||||
Remove, Add, Reset, Increase, Decrease, Rotate
|
||||
};
|
||||
|
||||
enum class Zoom {
|
||||
In, Out
|
||||
};
|
||||
|
||||
using ObjIdx = unsigned int;
|
||||
using ObjRef = std::vector<PlaterObject>::iterator;
|
||||
|
||||
@ -76,6 +81,17 @@ public:
|
||||
/// Create menu for object.
|
||||
wxMenu* object_menu();
|
||||
|
||||
void undo() {};
|
||||
void redo() {};
|
||||
|
||||
void select_next() {};
|
||||
void select_prev() {};
|
||||
void zoom(Zoom dir) {};
|
||||
|
||||
void export_gcode() {};
|
||||
void export_amf() {};
|
||||
void export_tmf() {};
|
||||
void export_stl() {};
|
||||
private:
|
||||
std::shared_ptr<Slic3r::Print> print {std::make_shared<Print>(Slic3r::Print())};
|
||||
std::shared_ptr<Slic3r::Model> model {std::make_shared<Model>(Slic3r::Model())};
|
||||
@ -92,8 +108,8 @@ private:
|
||||
|
||||
size_t object_identifier {0U}; //< Counter for adding objects to Slic3r. Increment after adding each object.
|
||||
|
||||
std::stack<UndoOperation> undo {};
|
||||
std::stack<UndoOperation> redo {};
|
||||
std::stack<UndoOperation> _undo {};
|
||||
std::stack<UndoOperation> _redo {};
|
||||
|
||||
wxNotebook* preview_notebook {new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(335,335), wxNB_BOTTOM)};
|
||||
wxBoxSizer* right_sizer {new wxBoxSizer(wxVERTICAL)};
|
||||
|
Loading…
x
Reference in New Issue
Block a user