mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-24 17:21:11 -06:00
Merge branch 'dev' of https://github.com/prusa3d/Slic3r into dev
This commit is contained in:
commit
41c093a258
361 changed files with 132181 additions and 19 deletions
|
|
@ -11,11 +11,13 @@
|
|||
#include <ModelArrange.hpp>
|
||||
#include <slic3r/GUI/PresetBundle.hpp>
|
||||
|
||||
#include <Geometry.hpp>
|
||||
#include <PrintConfig.hpp>
|
||||
#include <Print.hpp>
|
||||
#include <PrintExport.hpp>
|
||||
#include <Geometry.hpp>
|
||||
#include <Model.hpp>
|
||||
#include <Utils.hpp>
|
||||
#include <SLABasePool.hpp>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
|
@ -256,6 +258,115 @@ void PrintController::slice()
|
|||
slice(pri);
|
||||
}
|
||||
|
||||
void PrintController::slice_to_png()
|
||||
{
|
||||
using Pointf3 = Vec3d;
|
||||
|
||||
auto exd = query_png_export_data();
|
||||
|
||||
if(exd.zippath.empty()) return;
|
||||
|
||||
auto presetbundle = GUI::get_preset_bundle();
|
||||
|
||||
assert(presetbundle);
|
||||
|
||||
auto conf = presetbundle->full_config();
|
||||
|
||||
conf.validate();
|
||||
|
||||
try {
|
||||
print_->apply_config(conf);
|
||||
print_->validate();
|
||||
} catch(std::exception& e) {
|
||||
report_issue(IssueType::ERR, e.what(), "Error");
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: copy the model and work with the copy only
|
||||
bool correction = false;
|
||||
if(exd.corr_x != 1.0 || exd.corr_y != 1.0 || exd.corr_z != 1.0) {
|
||||
correction = true;
|
||||
print_->invalidate_all_steps();
|
||||
|
||||
for(auto po : print_->objects) {
|
||||
po->model_object()->scale(
|
||||
Pointf3(exd.corr_x, exd.corr_y, exd.corr_z)
|
||||
);
|
||||
po->model_object()->invalidate_bounding_box();
|
||||
po->reload_model_instances();
|
||||
po->invalidate_all_steps();
|
||||
}
|
||||
}
|
||||
|
||||
// Turn back the correction scaling on the model.
|
||||
auto scale_back = [this, correction, exd]() {
|
||||
if(correction) { // scale the model back
|
||||
print_->invalidate_all_steps();
|
||||
for(auto po : print_->objects) {
|
||||
po->model_object()->scale(
|
||||
Pointf3(1.0/exd.corr_x, 1.0/exd.corr_y, 1.0/exd.corr_z)
|
||||
);
|
||||
po->model_object()->invalidate_bounding_box();
|
||||
po->reload_model_instances();
|
||||
po->invalidate_all_steps();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
auto print_bb = print_->bounding_box();
|
||||
Vec2d punsc = unscale(print_bb.size());
|
||||
|
||||
// If the print does not fit into the print area we should cry about it.
|
||||
if(px(punsc) > exd.width_mm || py(punsc) > exd.height_mm) {
|
||||
std::stringstream ss;
|
||||
|
||||
ss << _(L("Print will not fit and will be truncated!")) << "\n"
|
||||
<< _(L("Width needed: ")) << px(punsc) << " mm\n"
|
||||
<< _(L("Height needed: ")) << py(punsc) << " mm\n";
|
||||
|
||||
if(!report_issue(IssueType::WARN_Q, ss.str(), _(L("Warning")))) {
|
||||
scale_back();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// std::async(supports_asynch()? std::launch::async : std::launch::deferred,
|
||||
// [this, exd, scale_back]()
|
||||
// {
|
||||
|
||||
auto pri = create_progress_indicator(
|
||||
200, _(L("Slicing to zipped png files...")));
|
||||
|
||||
try {
|
||||
pri->update(0, _(L("Slicing...")));
|
||||
slice(pri);
|
||||
} catch (std::exception& e) {
|
||||
pri->cancel();
|
||||
report_issue(IssueType::ERR, e.what(), _(L("Exception occured")));
|
||||
scale_back();
|
||||
return;
|
||||
}
|
||||
|
||||
auto pbak = print_->progressindicator;
|
||||
print_->progressindicator = pri;
|
||||
|
||||
try {
|
||||
print_to<FilePrinterFormat::PNG>( *print_, exd.zippath,
|
||||
exd.width_mm, exd.height_mm,
|
||||
exd.width_px, exd.height_px,
|
||||
exd.exp_time_s, exd.exp_time_first_s);
|
||||
|
||||
} catch (std::exception& e) {
|
||||
pri->cancel();
|
||||
report_issue(IssueType::ERR, e.what(), _(L("Exception occured")));
|
||||
}
|
||||
|
||||
print_->progressindicator = pbak;
|
||||
scale_back();
|
||||
|
||||
// });
|
||||
}
|
||||
|
||||
void IProgressIndicator::message_fmt(
|
||||
const string &fmtstr, ...) {
|
||||
std::stringstream ss;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ class Print;
|
|||
class PrintObject;
|
||||
class PrintConfig;
|
||||
|
||||
|
||||
/**
|
||||
* @brief A boilerplate class for creating application logic. It should provide
|
||||
* features as issue reporting and progress indication, etc...
|
||||
|
|
@ -177,6 +176,25 @@ protected:
|
|||
void infill(PrintObject *pobj);
|
||||
void gen_support_material(PrintObject *pobj);
|
||||
|
||||
// Data structure with the png export input data
|
||||
struct PngExportData {
|
||||
std::string zippath; // output zip file
|
||||
unsigned long width_px = 1440; // resolution - rows
|
||||
unsigned long height_px = 2560; // resolution columns
|
||||
double width_mm = 68.0, height_mm = 120.0; // dimensions in mm
|
||||
double exp_time_first_s = 35.0; // first exposure time
|
||||
double exp_time_s = 8.0; // global exposure time
|
||||
double corr_x = 1.0; // offsetting in x
|
||||
double corr_y = 1.0; // offsetting in y
|
||||
double corr_z = 1.0; // offsetting in y
|
||||
};
|
||||
|
||||
// Should display a dialog with the input fields for printing to png
|
||||
PngExportData query_png_export_data();
|
||||
|
||||
// The previous export data, to pre-populate the dialog
|
||||
PngExportData prev_expdata_;
|
||||
|
||||
/**
|
||||
* @brief Slice one pront object.
|
||||
* @param pobj The print object.
|
||||
|
|
@ -204,6 +222,11 @@ public:
|
|||
*/
|
||||
void slice();
|
||||
|
||||
/**
|
||||
* @brief Slice the print into zipped png files.
|
||||
*/
|
||||
void slice_to_png();
|
||||
|
||||
const PrintConfig& config() const;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <future>
|
||||
|
||||
#include <slic3r/GUI/GUI.hpp>
|
||||
#include <slic3r/GUI/PngExportDialog.hpp>
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/filedlg.h>
|
||||
|
|
@ -304,7 +305,124 @@ void AppController::set_global_progress_indicator(
|
|||
wxStatusBar* sb = dynamic_cast<wxStatusBar*>(wxWindow::FindWindowById(sid));
|
||||
|
||||
if(gauge && sb) {
|
||||
global_progressind_ = std::make_shared<Wrapper>(gauge, sb, *this);
|
||||
global_progress_indicator(std::make_shared<Wrapper>(gauge, sb, *this));
|
||||
}
|
||||
}
|
||||
|
||||
PrintController::PngExportData PrintController::query_png_export_data()
|
||||
{
|
||||
|
||||
// Implement the logic of the PngExportDialog
|
||||
class PngExportView: public PngExportDialog {
|
||||
double ratio_, bs_ratio_;
|
||||
PrintController& ctl_;
|
||||
public:
|
||||
|
||||
PngExportView(PrintController& ctl):
|
||||
PngExportDialog(wxTheApp->GetTopWindow()), ctl_(ctl)
|
||||
{
|
||||
ratio_ = double(spin_reso_width_->GetValue()) /
|
||||
spin_reso_height_->GetValue();
|
||||
|
||||
bs_ratio_ = bed_width_spin_->GetValue() /
|
||||
bed_height_spin_->GetValue();
|
||||
}
|
||||
|
||||
PngExportData export_data() const {
|
||||
PrintController::PngExportData ret;
|
||||
ret.zippath = filepick_ctl_->GetPath();
|
||||
ret.width_px = spin_reso_width_->GetValue();
|
||||
ret.height_px = spin_reso_height_->GetValue();
|
||||
ret.width_mm = bed_width_spin_->GetValue();
|
||||
ret.height_mm = bed_height_spin_->GetValue();
|
||||
ret.exp_time_s = exptime_spin_->GetValue();
|
||||
ret.exp_time_first_s = exptime_first_spin_->GetValue();
|
||||
ret.corr_x = corr_spin_x_->GetValue();
|
||||
ret.corr_y = corr_spin_y_->GetValue();
|
||||
ret.corr_z = corr_spin_z_->GetValue();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void prefill(const PngExportData& data) {
|
||||
filepick_ctl_->SetPath(data.zippath);
|
||||
spin_reso_width_->SetValue(data.width_px);
|
||||
spin_reso_height_->SetValue(data.height_px);
|
||||
bed_width_spin_->SetValue(data.width_mm);
|
||||
bed_height_spin_->SetValue(data.height_mm);
|
||||
exptime_spin_->SetValue(data.exp_time_s);
|
||||
exptime_first_spin_->SetValue(data.exp_time_first_s);
|
||||
corr_spin_x_->SetValue(data.corr_x);
|
||||
corr_spin_y_->SetValue(data.corr_y);
|
||||
corr_spin_z_->SetValue(data.corr_z);
|
||||
if(data.zippath.empty()) export_btn_->Disable();
|
||||
else export_btn_->Enable();
|
||||
}
|
||||
|
||||
virtual void ResoLock( wxCommandEvent& /*event*/ ) override {
|
||||
ratio_ = double(spin_reso_width_->GetValue()) /
|
||||
double(spin_reso_height_->GetValue());
|
||||
}
|
||||
|
||||
virtual void BedsizeLock( wxCommandEvent& /*event*/ ) override {
|
||||
bs_ratio_ = bed_width_spin_->GetValue() /
|
||||
bed_height_spin_->GetValue();
|
||||
}
|
||||
|
||||
virtual void EvalResoSpin( wxCommandEvent& event ) override {
|
||||
if(reso_lock_btn_->GetValue()) {
|
||||
if(event.GetId() == spin_reso_width_->GetId()) {
|
||||
spin_reso_height_->SetValue(
|
||||
std::round(spin_reso_width_->GetValue()/ratio_));
|
||||
spin_reso_height_->Update();
|
||||
} else {
|
||||
spin_reso_width_->SetValue(
|
||||
std::round(spin_reso_height_->GetValue()*ratio_));
|
||||
spin_reso_width_->Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void EvalBedSpin( wxCommandEvent& event ) override {
|
||||
if(bedsize_lock_btn_->GetValue()) {
|
||||
if(event.GetId() == bed_width_spin_->GetId()) {
|
||||
bed_height_spin_->SetValue(
|
||||
std::round(bed_width_spin_->GetValue()/bs_ratio_));
|
||||
bed_height_spin_->Update();
|
||||
} else {
|
||||
bed_width_spin_->SetValue(
|
||||
std::round(bed_height_spin_->GetValue()*bs_ratio_));
|
||||
bed_width_spin_->Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onFileChanged( wxFileDirPickerEvent& event ) {
|
||||
if(filepick_ctl_->GetPath().IsEmpty()) export_btn_->Disable();
|
||||
else export_btn_->Enable();
|
||||
}
|
||||
|
||||
virtual void Close( wxCommandEvent& /*event*/ ) {
|
||||
auto ret = wxID_OK;
|
||||
|
||||
if(wxFileName(filepick_ctl_->GetPath()).Exists())
|
||||
if(!ctl_.report_issue(PrintController::IssueType::WARN_Q,
|
||||
_(L("File already exists. Overwrite?")),
|
||||
_(L("Warning")))) ret = wxID_CANCEL;
|
||||
EndModal(ret);
|
||||
}
|
||||
};
|
||||
|
||||
PngExportView exdlg(*this);
|
||||
|
||||
exdlg.prefill(prev_expdata_);
|
||||
|
||||
auto r = exdlg.ShowModal();
|
||||
|
||||
auto ret = exdlg.export_data();
|
||||
prev_expdata_ = ret;
|
||||
|
||||
if(r != wxID_OK) ret.zippath.clear();
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
286
xs/src/slic3r/GUI/PngExportDialog.cpp
Normal file
286
xs/src/slic3r/GUI/PngExportDialog.cpp
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
#include "PngExportDialog.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
PngExportDialog::PngExportDialog( wxWindow* parent, wxWindowID id,
|
||||
const wxString& title, const wxPoint& pos,
|
||||
const wxSize& size, long style ) :
|
||||
wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
auto top_layout = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
// Labels
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
auto labels_layout = new wxGridSizer(6, 1, 0, 0);
|
||||
|
||||
// Input File picker label
|
||||
auto filepick_text = new wxStaticText( this, wxID_ANY,
|
||||
_("Target zip file"),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
filepick_text->Wrap( -1 );
|
||||
labels_layout->Add( filepick_text, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
// Config file label
|
||||
auto confpick_text = new wxStaticText( this, wxID_ANY,
|
||||
_("Config file (optional)"),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
confpick_text->Wrap( -1 );
|
||||
labels_layout->Add( confpick_text, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
confpick_text->Disable();
|
||||
|
||||
// Resolution layout
|
||||
auto resotext = new wxStaticText( this, wxID_ANY,
|
||||
_("Resolution (w, h) [px]"),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
resotext->Wrap( -1 );
|
||||
labels_layout->Add( resotext, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
// Bed size label
|
||||
auto bed_size_text = new wxStaticText( this, wxID_ANY,
|
||||
_("Bed size (w, h) [mm]"),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
bed_size_text->Wrap( -1 );
|
||||
labels_layout->Add( bed_size_text, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
// Correction label
|
||||
auto corr_text = new wxStaticText( this, wxID_ANY, _("Scale (x, y, z)"),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
corr_text->Wrap( -1 );
|
||||
labels_layout->Add( corr_text, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
// Exp time label
|
||||
auto exp_text = new wxStaticText( this, wxID_ANY,
|
||||
_("Exposure time [s]"),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
exp_text->Wrap( -1 );
|
||||
labels_layout->Add( exp_text, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
top_layout->Add( labels_layout, 0, wxEXPAND, 5 );
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
// Body
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
auto body_layout = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
// Input file picker
|
||||
auto fpicklayout = new wxBoxSizer(wxHORIZONTAL);
|
||||
filepick_ctl_ = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString,
|
||||
_("Select a file"), wxT("*.zip"),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxFLP_USE_TEXTCTRL | wxFLP_SAVE,
|
||||
wxDefaultValidator,
|
||||
wxT("filepick_ctl") );
|
||||
fpicklayout->Add( filepick_ctl_, 1, wxALL | wxALIGN_CENTER, 5);
|
||||
body_layout->Add( fpicklayout, 1, wxEXPAND, 5 );
|
||||
|
||||
auto ctlpicklayout = new wxBoxSizer(wxHORIZONTAL);
|
||||
confpick_ctl_ = new wxFilePickerCtrl(
|
||||
this, wxID_ANY, wxEmptyString, _("Select a file"),
|
||||
wxT("*.json"), wxDefaultPosition, wxDefaultSize,
|
||||
wxFLP_USE_TEXTCTRL | wxFLP_DEFAULT_STYLE, wxDefaultValidator,
|
||||
wxT("filepick_ctl") );
|
||||
confpick_ctl_->Disable();
|
||||
ctlpicklayout->Add( confpick_ctl_, 1, wxALL | wxALIGN_CENTER, 5);
|
||||
body_layout->Add( ctlpicklayout, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
// Resolution controls /////////////////////////////////////////////////////
|
||||
|
||||
auto res_spins_layout = new wxBoxSizer( wxHORIZONTAL );
|
||||
spin_reso_width_ = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxSP_ARROW_KEYS, 0, 10000, 1440 );
|
||||
res_spins_layout->Add( spin_reso_width_, 1, wxALIGN_CENTER|wxALL, 5 );
|
||||
spin_reso_height_ = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxSP_ARROW_KEYS, 0, 10000, 2560 );
|
||||
res_spins_layout->Add( spin_reso_height_, 1, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
reso_lock_btn_ = new wxToggleButton( this, wxID_ANY, _("Lock"),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
reso_lock_btn_->SetValue(true);
|
||||
res_spins_layout->Add( reso_lock_btn_, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
body_layout->Add( res_spins_layout, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
// Bed size controls ///////////////////////////////////////////////////////
|
||||
|
||||
auto bed_spins_layout = new wxBoxSizer( wxHORIZONTAL );
|
||||
bed_width_spin_ = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxSP_ARROW_KEYS, 0, 1e6, 68.0 );
|
||||
|
||||
bed_spins_layout->Add( bed_width_spin_, 1, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
bed_height_spin_ = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxSP_ARROW_KEYS, 0, 1e6, 120.0 );
|
||||
bed_spins_layout->Add( bed_height_spin_, 1, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
bedsize_lock_btn_ = new wxToggleButton( this, wxID_ANY, _("Lock"),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
bedsize_lock_btn_->SetValue(true);
|
||||
bed_spins_layout->Add( bedsize_lock_btn_, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
body_layout->Add( bed_spins_layout, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
// Scale correction controls ///////////////////////////////////////////////
|
||||
|
||||
auto corr_layout = new wxBoxSizer( wxHORIZONTAL );
|
||||
corr_spin_x_ = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxSP_ARROW_KEYS, 0, 100, 1, 0.01 );
|
||||
corr_spin_x_->SetDigits(3);
|
||||
corr_spin_x_->SetMaxSize(wxSize(100, -1));
|
||||
corr_layout->Add( corr_spin_x_, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
corr_spin_y_ = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxSP_ARROW_KEYS, 0, 100, 1, 0.01 );
|
||||
corr_spin_y_->SetDigits(3);
|
||||
corr_spin_y_->SetMaxSize(wxSize(100, -1));
|
||||
corr_layout->Add( corr_spin_y_, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
corr_spin_z_ = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxSP_ARROW_KEYS, 0, 100, 1, 0.01 );
|
||||
corr_spin_z_->SetDigits(3);
|
||||
corr_spin_z_->SetMaxSize(wxSize(100, -1));
|
||||
corr_layout->Add( corr_spin_z_, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
corr_layout->Add( bedsize_lock_btn_->GetSize().GetWidth(), 0, 1, wxEXPAND, 5 );
|
||||
|
||||
body_layout->Add( corr_layout, 1, wxEXPAND, 5 );
|
||||
|
||||
// Exposure time controls /////////////////////////////////////////////////
|
||||
|
||||
auto exp_layout = new wxBoxSizer( wxHORIZONTAL );
|
||||
exptime_spin_ = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxSP_ARROW_KEYS, 0, 100, 1, 0.01 );
|
||||
exptime_spin_->SetDigits(3);
|
||||
exptime_spin_->SetMaxSize(wxSize(100, -1));
|
||||
|
||||
auto first_txt = new wxStaticText( this, wxID_ANY,
|
||||
_("First exp. time"),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize, wxALIGN_RIGHT );
|
||||
|
||||
exptime_first_spin_ = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize, wxSP_ARROW_KEYS,
|
||||
0, 100, 1, 0.01 );
|
||||
exptime_first_spin_->SetDigits(3);
|
||||
exptime_first_spin_->SetMaxSize(wxSize(100, -1));
|
||||
|
||||
exp_layout->Add( exptime_spin_, 1, wxALIGN_CENTER|wxALL, 5 );
|
||||
exp_layout->Add( first_txt, 1, wxALIGN_CENTER|wxALL, 5);
|
||||
exp_layout->Add( exptime_first_spin_, 1, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
export_btn_ = new wxButton( this, wxID_ANY, _("Export"), wxDefaultPosition,
|
||||
wxDefaultSize, 0, wxDefaultValidator,
|
||||
wxT("export_btn") );
|
||||
|
||||
exp_layout->Add( export_btn_, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
body_layout->Add( exp_layout, 1, wxEXPAND, 5 );
|
||||
|
||||
top_layout->Add( body_layout, 0, wxEXPAND, 5 );
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
// Finalize
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
this->SetSizer(top_layout);
|
||||
this->Layout();
|
||||
|
||||
this->Fit();
|
||||
this->SetMinSize(this->GetSize());
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
filepick_ctl_->Connect(
|
||||
wxEVT_COMMAND_FILEPICKER_CHANGED,
|
||||
wxFileDirPickerEventHandler( PngExportDialog::onFileChanged ),
|
||||
NULL, this );
|
||||
spin_reso_width_->Connect(
|
||||
wxEVT_COMMAND_TEXT_UPDATED,
|
||||
wxCommandEventHandler( PngExportDialog::EvalResoSpin ),
|
||||
NULL, this );
|
||||
spin_reso_height_->Connect(
|
||||
wxEVT_COMMAND_TEXT_UPDATED,
|
||||
wxCommandEventHandler( PngExportDialog::EvalResoSpin ),
|
||||
NULL, this );
|
||||
reso_lock_btn_->Connect(
|
||||
wxEVT_COMMAND_TOGGLEBUTTON_CLICKED,
|
||||
wxCommandEventHandler( PngExportDialog::ResoLock ),
|
||||
NULL, this );
|
||||
bed_width_spin_->Connect(
|
||||
wxEVT_COMMAND_TEXT_UPDATED,
|
||||
wxCommandEventHandler( PngExportDialog::EvalBedSpin ),
|
||||
NULL, this );
|
||||
bed_height_spin_->Connect(
|
||||
wxEVT_COMMAND_TEXT_UPDATED,
|
||||
wxCommandEventHandler( PngExportDialog::EvalBedSpin ),
|
||||
NULL, this );
|
||||
bedsize_lock_btn_->Connect(
|
||||
wxEVT_COMMAND_TOGGLEBUTTON_CLICKED,
|
||||
wxCommandEventHandler( PngExportDialog::BedsizeLock ),
|
||||
NULL, this );
|
||||
export_btn_->Connect(
|
||||
wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
wxCommandEventHandler( PngExportDialog::Close ), NULL, this );
|
||||
}
|
||||
|
||||
PngExportDialog::~PngExportDialog()
|
||||
{
|
||||
// Disconnect Events
|
||||
filepick_ctl_->Disconnect(
|
||||
wxEVT_COMMAND_FILEPICKER_CHANGED,
|
||||
wxFileDirPickerEventHandler( PngExportDialog::onFileChanged ),
|
||||
NULL, this );
|
||||
spin_reso_width_->Disconnect(
|
||||
wxEVT_COMMAND_TEXT_UPDATED,
|
||||
wxCommandEventHandler( PngExportDialog::EvalResoSpin ),
|
||||
NULL, this );
|
||||
spin_reso_height_->Disconnect(
|
||||
wxEVT_COMMAND_TEXT_UPDATED,
|
||||
wxCommandEventHandler( PngExportDialog::EvalResoSpin ),
|
||||
NULL, this );
|
||||
reso_lock_btn_->Disconnect(
|
||||
wxEVT_COMMAND_TOGGLEBUTTON_CLICKED,
|
||||
wxCommandEventHandler( PngExportDialog::ResoLock ),
|
||||
NULL, this );
|
||||
bed_width_spin_->Disconnect(
|
||||
wxEVT_COMMAND_TEXT_UPDATED,
|
||||
wxCommandEventHandler( PngExportDialog::EvalBedSpin ),
|
||||
NULL, this );
|
||||
bed_height_spin_->Disconnect(
|
||||
wxEVT_COMMAND_TEXT_UPDATED,
|
||||
wxCommandEventHandler( PngExportDialog::EvalBedSpin ),
|
||||
NULL, this );
|
||||
bedsize_lock_btn_->Disconnect(
|
||||
wxEVT_COMMAND_TOGGLEBUTTON_CLICKED,
|
||||
wxCommandEventHandler( PngExportDialog::BedsizeLock ),
|
||||
NULL, this );
|
||||
export_btn_->Disconnect(
|
||||
wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
wxCommandEventHandler( PngExportDialog::Close ), NULL, this );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
67
xs/src/slic3r/GUI/PngExportDialog.hpp
Normal file
67
xs/src/slic3r/GUI/PngExportDialog.hpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
#ifndef PNG_EXPORT_DIALOG_HPP
|
||||
#define PNG_EXPORT_DIALOG_HPP
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/filepicker.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/tglbtn.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
#include "GUI.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PngExportDialog
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class PngExportDialog : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxFilePickerCtrl* filepick_ctl_;
|
||||
wxFilePickerCtrl* confpick_ctl_;
|
||||
wxSpinCtrl* spin_reso_width_;
|
||||
wxSpinCtrl* spin_reso_height_;
|
||||
wxToggleButton* reso_lock_btn_;
|
||||
wxSpinCtrlDouble* bed_width_spin_;
|
||||
wxSpinCtrlDouble* bed_height_spin_;
|
||||
wxToggleButton* bedsize_lock_btn_;
|
||||
wxSpinCtrlDouble* exptime_spin_;
|
||||
wxSpinCtrlDouble* exptime_first_spin_;
|
||||
wxSpinCtrlDouble* corr_spin_x_;
|
||||
wxSpinCtrlDouble* corr_spin_y_;
|
||||
wxSpinCtrlDouble* corr_spin_z_;
|
||||
wxButton* export_btn_;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void onFileChanged( wxFileDirPickerEvent& event ) { event.Skip(); }
|
||||
virtual void EvalResoSpin( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void ResoLock( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void EvalBedSpin( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void BedsizeLock( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void Close( wxCommandEvent& /*event*/ ) { EndModal(wxID_OK); }
|
||||
|
||||
public:
|
||||
|
||||
PngExportDialog( wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||
const wxString& title = L("Slice to zipped PNG files"),
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxSize( 452,170 ),
|
||||
long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~PngExportDialog();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif //PNG_EXPORT_DIALOG_HPP
|
||||
|
|
@ -193,8 +193,8 @@ void Preset::normalize(DynamicPrintConfig &config)
|
|||
if (key == "compatible_printers")
|
||||
continue;
|
||||
auto *opt = config.option(key, false);
|
||||
assert(opt != nullptr);
|
||||
assert(opt->is_vector());
|
||||
/*assert(opt != nullptr);
|
||||
assert(opt->is_vector());*/
|
||||
if (opt != nullptr && opt->is_vector())
|
||||
static_cast<ConfigOptionVectorBase*>(opt)->resize(n, defaults.option(key));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue