mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-04 15:40:39 +08:00
added info box
This commit is contained in:
parent
af041564fa
commit
910f95f01a
@ -144,8 +144,63 @@ Plater::Plater(wxWindow* parent, const wxString& title, std::shared_ptr<Settings
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
wxStaticBoxSizer* object_info_sizer {nullptr};
|
||||||
|
{
|
||||||
|
auto* box {new wxStaticBox(this, wxID_ANY, _("Info"))};
|
||||||
|
object_info_sizer = new wxStaticBoxSizer(box, wxVERTICAL);
|
||||||
|
object_info_sizer->SetMinSize(wxSize(350, -1));
|
||||||
|
{
|
||||||
|
auto* sizer {new wxBoxSizer(wxHORIZONTAL)};
|
||||||
|
object_info_sizer->Add(sizer, 0, wxEXPAND | wxBOTTOM, 5);
|
||||||
|
auto* text {new wxStaticText(this, wxID_ANY, _("Object:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT)};
|
||||||
|
text->SetFont(small_font);
|
||||||
|
sizer->Add(text, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
|
|
||||||
|
/* We supply a bogus width to wxChoice (sizer will override it and stretch
|
||||||
|
* the control anyway), because if we leave the default (-1) it will stretch
|
||||||
|
* too much according to the contents, and this is bad with long file names.
|
||||||
|
*/
|
||||||
|
this->object_info.choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxSize(100, -1));
|
||||||
|
this->object_info.choice->SetFont(small_font);
|
||||||
|
sizer->Add(this->object_info.choice, 1, wxALIGN_CENTER_VERTICAL);
|
||||||
|
|
||||||
|
// Select object on change.
|
||||||
|
this->Bind(wxEVT_CHOICE, [this](wxCommandEvent& e) { this->select_object(this->object_info.choice->GetSelection()); this->refresh_canvases();});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
auto* grid_sizer { new wxFlexGridSizer(3, 4, 5, 5)};
|
||||||
|
grid_sizer->SetFlexibleDirection(wxHORIZONTAL);
|
||||||
|
grid_sizer->AddGrowableCol(1, 1);
|
||||||
|
grid_sizer->AddGrowableCol(3, 1);
|
||||||
|
|
||||||
|
add_info_field(this, this->object_info.copies, _("Copies"), grid_sizer);
|
||||||
|
add_info_field(this, this->object_info.size, _("Size"), grid_sizer);
|
||||||
|
add_info_field(this, this->object_info.volume, _("Volume"), grid_sizer);
|
||||||
|
add_info_field(this, this->object_info.facets, _("Facets"), grid_sizer);
|
||||||
|
add_info_field(this, this->object_info.materials, _("Materials"), grid_sizer);
|
||||||
|
{
|
||||||
|
wxString name {"Manifold:"};
|
||||||
|
auto* text {new wxStaticText(parent, wxID_ANY, name, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT)};
|
||||||
|
text->SetFont(small_font);
|
||||||
|
grid_sizer->Add(text, 0);
|
||||||
|
|
||||||
|
this->object_info.manifold = new wxStaticText(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
|
||||||
|
this->object_info.manifold->SetFont(small_font);
|
||||||
|
|
||||||
|
this->object_info.manifold_warning_icon = new wxStaticBitmap(this, wxID_ANY, wxBitmap(var("error.png"), wxBITMAP_TYPE_PNG));
|
||||||
|
this->object_info.manifold_warning_icon->Hide();
|
||||||
|
|
||||||
|
auto* h_sizer {new wxBoxSizer(wxHORIZONTAL)};
|
||||||
|
h_sizer->Add(this->object_info.manifold_warning_icon, 0);
|
||||||
|
h_sizer->Add(this->object_info.manifold, 0);
|
||||||
|
|
||||||
|
grid_sizer->Add(h_sizer, 0, wxEXPAND);
|
||||||
|
}
|
||||||
|
|
||||||
|
object_info_sizer->Add(grid_sizer, 0, wxEXPAND);
|
||||||
|
}
|
||||||
|
this->selection_changed();
|
||||||
this->canvas2D->update_bed_size();
|
this->canvas2D->update_bed_size();
|
||||||
|
|
||||||
// Toolbar
|
// Toolbar
|
||||||
@ -156,10 +211,11 @@ Plater::Plater(wxWindow* parent, const wxString& title, std::shared_ptr<Settings
|
|||||||
// export/print/send/export buttons
|
// export/print/send/export buttons
|
||||||
|
|
||||||
// right panel sizer
|
// right panel sizer
|
||||||
auto right_sizer = this->right_sizer;
|
auto* right_sizer {this->right_sizer};
|
||||||
// $right_sizer->Add($presets, 0, wxEXPAND | wxTOP, 10) if defined $presets;
|
// $right_sizer->Add($presets, 0, wxEXPAND | wxTOP, 10) if defined $presets;
|
||||||
// $right_sizer->Add($buttons_sizer, 0, wxEXPAND | wxBOTTOM, 5);
|
// $right_sizer->Add($buttons_sizer, 0, wxEXPAND | wxBOTTOM, 5);
|
||||||
// $right_sizer->Add($self->{settings_override_panel}, 1, wxEXPAND, 5);
|
// $right_sizer->Add($self->{settings_override_panel}, 1, wxEXPAND, 5);
|
||||||
|
right_sizer->Add(object_info_sizer, 0, wxEXPAND, 0);
|
||||||
// $right_sizer->Add($object_info_sizer, 0, wxEXPAND, 0);
|
// $right_sizer->Add($object_info_sizer, 0, wxEXPAND, 0);
|
||||||
// $right_sizer->Add($print_info_sizer, 0, wxEXPAND, 0);
|
// $right_sizer->Add($print_info_sizer, 0, wxEXPAND, 0);
|
||||||
// $right_sizer->Hide($print_info_sizer);
|
// $right_sizer->Hide($print_info_sizer);
|
||||||
@ -524,11 +580,6 @@ void Plater::selection_changed() {
|
|||||||
$self->{"btn_$_"}->$method
|
$self->{"btn_$_"}->$method
|
||||||
for grep $self->{"btn_$_"}, qw(remove increase decrease rotate45cw rotate45ccw changescale split cut layers settings);
|
for grep $self->{"btn_$_"}, qw(remove increase decrease rotate45cw rotate45ccw changescale split cut layers settings);
|
||||||
|
|
||||||
if ($self->{htoolbar}) {
|
|
||||||
$self->{htoolbar}->EnableTool($_, $have_sel)
|
|
||||||
for (TB_REMOVE, TB_MORE, TB_FEWER, TB_45CW, TB_45CCW, TB_SCALE, TB_SPLIT, TB_CUT, TB_LAYERS, TB_SETTINGS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($self->{object_info_size}) { # have we already loaded the info pane?
|
if ($self->{object_info_size}) { # have we already loaded the info pane?
|
||||||
|
|
||||||
if ($have_sel) {
|
if ($have_sel) {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "Model.hpp"
|
#include "Model.hpp"
|
||||||
#include "Print.hpp"
|
#include "Print.hpp"
|
||||||
#include "Config.hpp"
|
#include "Config.hpp"
|
||||||
|
#include "misc_ui.hpp"
|
||||||
|
|
||||||
#include "Plater/PlaterObject.hpp"
|
#include "Plater/PlaterObject.hpp"
|
||||||
#include "Plater/Plate2D.hpp"
|
#include "Plater/Plate2D.hpp"
|
||||||
@ -46,6 +47,18 @@ class PlaterObject;
|
|||||||
class Plate2D;
|
class Plate2D;
|
||||||
class MainFrame;
|
class MainFrame;
|
||||||
|
|
||||||
|
/// Struct to group object info text fields together
|
||||||
|
struct info_fields {
|
||||||
|
wxChoice* choice {nullptr};
|
||||||
|
wxStaticText* copies {nullptr};
|
||||||
|
wxStaticText* size {nullptr};
|
||||||
|
wxStaticText* volume {nullptr};
|
||||||
|
wxStaticText* facets {nullptr};
|
||||||
|
wxStaticText* materials {nullptr};
|
||||||
|
wxStaticText* manifold {nullptr};
|
||||||
|
wxStaticBitmap* manifold_warning_icon {nullptr};
|
||||||
|
};
|
||||||
|
|
||||||
/// Extension of wxPanel class to handle the main plater.
|
/// Extension of wxPanel class to handle the main plater.
|
||||||
/// 2D, 3D, preview, etc tabs.
|
/// 2D, 3D, preview, etc tabs.
|
||||||
class Plater : public wxPanel
|
class Plater : public wxPanel
|
||||||
@ -125,6 +138,8 @@ private:
|
|||||||
|
|
||||||
PreviewDLP* previewDLP {nullptr}; //< DLP/SLA Preview canvas
|
PreviewDLP* previewDLP {nullptr}; //< DLP/SLA Preview canvas
|
||||||
|
|
||||||
|
wxStaticBoxSizer* object_info_size {nullptr};
|
||||||
|
|
||||||
/// Handles the actual load of the file from the dialog handoff.
|
/// Handles the actual load of the file from the dialog handoff.
|
||||||
std::vector<int> load_file(const std::string file, const int obj_idx_to_load = -1);
|
std::vector<int> load_file(const std::string file, const int obj_idx_to_load = -1);
|
||||||
|
|
||||||
@ -223,9 +238,23 @@ private:
|
|||||||
void center_selected_object_on_bed();
|
void center_selected_object_on_bed();
|
||||||
|
|
||||||
void set_number_of_copies();
|
void set_number_of_copies();
|
||||||
|
|
||||||
|
/// Struct containing various object info fields.
|
||||||
|
info_fields object_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
static void add_info_field(wxWindow* parent, T*& field, wxString name, wxGridSizer* sizer) {
|
||||||
|
name << ":";
|
||||||
|
auto* text {new wxStaticText(parent, wxID_ANY, name, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT)};
|
||||||
|
text->SetFont(small_font);
|
||||||
|
sizer->Add(text, 0);
|
||||||
|
|
||||||
|
field = new wxStaticText(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);
|
||||||
|
field->SetFont(small_font);
|
||||||
|
sizer->Add(field, 0);
|
||||||
|
}
|
||||||
|
|
||||||
} } // Namespace Slic3r::GUI
|
} } // Namespace Slic3r::GUI
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <wx/settings.h>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -50,6 +51,9 @@ constexpr bool isDev = false;
|
|||||||
|
|
||||||
constexpr bool threaded = false;
|
constexpr bool threaded = false;
|
||||||
|
|
||||||
|
const wxFont small_font { wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) };
|
||||||
|
|
||||||
|
|
||||||
// hopefully the compiler is smart enough to figure this out
|
// hopefully the compiler is smart enough to figure this out
|
||||||
const std::map<const std::string, const std::string> FILE_WILDCARDS {
|
const std::map<const std::string, const std::string> FILE_WILDCARDS {
|
||||||
std::make_pair("known", "Known files (*.stl, *.obj, *.amf, *.xml, *.3mf)|*.3mf;*.3MF;*.stl;*.STL;*.obj;*.OBJ;*.amf;*.AMF;*.xml;*.XML"),
|
std::make_pair("known", "Known files (*.stl, *.obj, *.amf, *.xml, *.3mf)|*.3mf;*.3MF;*.stl;*.STL;*.obj;*.OBJ;*.amf;*.AMF;*.xml;*.XML"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user