Merge remote-tracking branch 'origin/cpp_progress_status_bar' into dev
# Conflicts: # lib/Slic3r/GUI/MainFrame.pm # xs/src/slic3r/AppController.cpp # xs/src/slic3r/AppControllerWx.cpp # xs/src/slic3r/GUI/GUI.hpp
This commit is contained in:
commit
4f53fc2a5f
@ -166,6 +166,7 @@ sub thread_cleanup {
|
|||||||
*Slic3r::GUI::Tab::DESTROY = sub {};
|
*Slic3r::GUI::Tab::DESTROY = sub {};
|
||||||
*Slic3r::GUI::PresetHints::DESTROY = sub {};
|
*Slic3r::GUI::PresetHints::DESTROY = sub {};
|
||||||
*Slic3r::GUI::TabIface::DESTROY = sub {};
|
*Slic3r::GUI::TabIface::DESTROY = sub {};
|
||||||
|
*Slic3r::GUI::ProgressStatusBar::DESTROY= sub {};
|
||||||
*Slic3r::OctoPrint::DESTROY = sub {};
|
*Slic3r::OctoPrint::DESTROY = sub {};
|
||||||
*Slic3r::Duet::DESTROY = sub {};
|
*Slic3r::Duet::DESTROY = sub {};
|
||||||
*Slic3r::PresetUpdater::DESTROY = sub {};
|
*Slic3r::PresetUpdater::DESTROY = sub {};
|
||||||
|
@ -70,24 +70,11 @@ sub new {
|
|||||||
eval { Wx::ToolTip::SetAutoPop(32767) };
|
eval { Wx::ToolTip::SetAutoPop(32767) };
|
||||||
|
|
||||||
# initialize status bar
|
# initialize status bar
|
||||||
$self->{statusbar} = Slic3r::GUI::ProgressStatusBar->new($self, Wx::NewId);
|
$self->{statusbar} = Slic3r::GUI::ProgressStatusBar->new();
|
||||||
|
$self->{statusbar}->Embed;
|
||||||
$self->{statusbar}->SetStatusText(L("Version ").$Slic3r::VERSION.L(" - Remember to check for updates at http://github.com/prusa3d/slic3r/releases"));
|
$self->{statusbar}->SetStatusText(L("Version ").$Slic3r::VERSION.L(" - Remember to check for updates at http://github.com/prusa3d/slic3r/releases"));
|
||||||
$self->SetStatusBar($self->{statusbar});
|
|
||||||
|
|
||||||
# Make the global status bar and its progress indicator available in C++
|
# Make the global status bar and its progress indicator available in C++
|
||||||
$appController->set_global_progress_indicator(
|
$appController->set_global_progress_indicator($self->{statusbar});
|
||||||
$self->{statusbar}->{prog}->GetId(),
|
|
||||||
$self->{statusbar}->GetId(),
|
|
||||||
);
|
|
||||||
|
|
||||||
$appController->set_model($self->{plater}->{model});
|
|
||||||
$appController->set_print($self->{plater}->{print});
|
|
||||||
|
|
||||||
# Make the global status bar and its progress indicator available in C++
|
|
||||||
$appController->set_global_progress_indicator(
|
|
||||||
$self->{statusbar}->{prog}->GetId(),
|
|
||||||
$self->{statusbar}->GetId(),
|
|
||||||
);
|
|
||||||
|
|
||||||
$appController->set_model($self->{plater}->{model});
|
$appController->set_model($self->{plater}->{model});
|
||||||
$appController->set_print($self->{plater}->{print});
|
$appController->set_print($self->{plater}->{print});
|
||||||
|
@ -1656,7 +1656,9 @@ sub on_progress_event {
|
|||||||
my ($self, $percent, $message) = @_;
|
my ($self, $percent, $message) = @_;
|
||||||
|
|
||||||
$self->statusbar->SetProgress($percent);
|
$self->statusbar->SetProgress($percent);
|
||||||
$self->statusbar->SetStatusText("$message…");
|
# TODO: three dot character is not properly translated into C++
|
||||||
|
# $self->statusbar->SetStatusText("$message…");
|
||||||
|
$self->statusbar->SetStatusText("$message...");
|
||||||
}
|
}
|
||||||
|
|
||||||
# Called when the G-code export finishes, either successfully or with an error.
|
# Called when the G-code export finishes, either successfully or with an error.
|
||||||
|
@ -1,144 +1,18 @@
|
|||||||
# Status bar at the bottom of the main screen.
|
# Status bar at the bottom of the main screen.
|
||||||
|
# Now it just implements cancel cb on perl side, every other functionality is
|
||||||
|
# in C++
|
||||||
|
|
||||||
package Slic3r::GUI::ProgressStatusBar;
|
package Slic3r::GUI::ProgressStatusBar;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Wx qw(:gauge :misc);
|
our $cancel_cb;
|
||||||
use base 'Wx::StatusBar';
|
|
||||||
|
|
||||||
sub new {
|
|
||||||
my $class = shift;
|
|
||||||
my $self = $class->SUPER::new(@_);
|
|
||||||
|
|
||||||
$self->{busy} = 0;
|
|
||||||
$self->{timer} = Wx::Timer->new($self);
|
|
||||||
$self->{prog} = Wx::Gauge->new($self, wxGA_HORIZONTAL, 100, wxDefaultPosition, wxDefaultSize);
|
|
||||||
$self->{prog}->Hide;
|
|
||||||
$self->{cancelbutton} = Wx::Button->new($self, -1, "Cancel", wxDefaultPosition, wxDefaultSize);
|
|
||||||
$self->{cancelbutton}->Hide;
|
|
||||||
|
|
||||||
$self->SetFieldsCount(3);
|
|
||||||
$self->SetStatusWidths(-1, 150, 155);
|
|
||||||
|
|
||||||
Wx::Event::EVT_TIMER($self, \&OnTimer, $self->{timer});
|
|
||||||
Wx::Event::EVT_SIZE($self, \&OnSize);
|
|
||||||
Wx::Event::EVT_BUTTON($self, $self->{cancelbutton}, sub {
|
|
||||||
$self->{cancel_cb}->();
|
|
||||||
$self->{cancelbutton}->Hide;
|
|
||||||
});
|
|
||||||
|
|
||||||
return $self;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub DESTROY {
|
|
||||||
my $self = shift;
|
|
||||||
$self->{timer}->Stop if $self->{timer} && $self->{timer}->IsRunning;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub OnSize {
|
|
||||||
my ($self, $event) = @_;
|
|
||||||
|
|
||||||
my %fields = (
|
|
||||||
# 0 is reserved for status text
|
|
||||||
1 => $self->{cancelbutton},
|
|
||||||
2 => $self->{prog},
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach (keys %fields) {
|
|
||||||
my $rect = $self->GetFieldRect($_);
|
|
||||||
my $offset = &Wx::wxGTK ? 1 : 0; # add a cosmetic 1 pixel offset on wxGTK
|
|
||||||
my $pos = [$rect->GetX + $offset, $rect->GetY + $offset];
|
|
||||||
$fields{$_}->Move($pos);
|
|
||||||
$fields{$_}->SetSize($rect->GetWidth - $offset, $rect->GetHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
$event->Skip;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub OnTimer {
|
|
||||||
my ($self, $event) = @_;
|
|
||||||
|
|
||||||
if ($self->{prog}->IsShown) {
|
|
||||||
$self->{timer}->Stop;
|
|
||||||
}
|
|
||||||
$self->{prog}->Pulse if $self->{_busy};
|
|
||||||
}
|
|
||||||
|
|
||||||
sub SetCancelCallback {
|
sub SetCancelCallback {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($cb) = @_;
|
my ($cb) = @_;
|
||||||
$self->{cancel_cb} = $cb;
|
$cancel_cb = $cb;
|
||||||
$cb ? $self->{cancelbutton}->Show : $self->{cancelbutton}->Hide;
|
$cb ? $self->ShowCancelButton : $self->HideCancelButton;
|
||||||
}
|
|
||||||
|
|
||||||
sub Run {
|
|
||||||
my $self = shift;
|
|
||||||
my $rate = shift || 100;
|
|
||||||
if (!$self->{timer}->IsRunning) {
|
|
||||||
$self->{timer}->Start($rate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub GetProgress {
|
|
||||||
my $self = shift;
|
|
||||||
return $self->{prog}->GetValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub SetProgress {
|
|
||||||
my $self = shift;
|
|
||||||
my ($val) = @_;
|
|
||||||
if (!$self->{prog}->IsShown) {
|
|
||||||
$self->ShowProgress(1);
|
|
||||||
}
|
|
||||||
if ($val == $self->{prog}->GetRange) {
|
|
||||||
$self->{prog}->SetValue(0);
|
|
||||||
$self->ShowProgress(0);
|
|
||||||
} else {
|
|
||||||
$self->{prog}->SetValue($val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub SetRange {
|
|
||||||
my $self = shift;
|
|
||||||
my ($val) = @_;
|
|
||||||
|
|
||||||
if ($val != $self->{prog}->GetRange) {
|
|
||||||
$self->{prog}->SetRange($val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub ShowProgress {
|
|
||||||
my $self = shift;
|
|
||||||
my ($show) = @_;
|
|
||||||
|
|
||||||
$self->{prog}->Show($show);
|
|
||||||
$self->{prog}->Pulse;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub StartBusy {
|
|
||||||
my $self = shift;
|
|
||||||
my $rate = shift || 100;
|
|
||||||
|
|
||||||
$self->{_busy} = 1;
|
|
||||||
$self->ShowProgress(1);
|
|
||||||
if (!$self->{timer}->IsRunning) {
|
|
||||||
$self->{timer}->Start($rate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub StopBusy {
|
|
||||||
my $self = shift;
|
|
||||||
|
|
||||||
$self->{timer}->Stop;
|
|
||||||
$self->ShowProgress(0);
|
|
||||||
$self->{prog}->SetValue(0);
|
|
||||||
$self->{_busy} = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub IsBusy {
|
|
||||||
my $self = shift;
|
|
||||||
return $self->{_busy};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -261,6 +261,8 @@ add_library(libslic3r_gui STATIC
|
|||||||
${LIBDIR}/slic3r/GUI/UpdateDialogs.hpp
|
${LIBDIR}/slic3r/GUI/UpdateDialogs.hpp
|
||||||
${LIBDIR}/slic3r/GUI/FirmwareDialog.cpp
|
${LIBDIR}/slic3r/GUI/FirmwareDialog.cpp
|
||||||
${LIBDIR}/slic3r/GUI/FirmwareDialog.hpp
|
${LIBDIR}/slic3r/GUI/FirmwareDialog.hpp
|
||||||
|
${LIBDIR}/slic3r/GUI/ProgressStatusBar.hpp
|
||||||
|
${LIBDIR}/slic3r/GUI/ProgressStatusBar.cpp
|
||||||
${LIBDIR}/slic3r/Utils/Http.cpp
|
${LIBDIR}/slic3r/Utils/Http.cpp
|
||||||
${LIBDIR}/slic3r/Utils/Http.hpp
|
${LIBDIR}/slic3r/Utils/Http.hpp
|
||||||
${LIBDIR}/slic3r/Utils/FixModelByWin10.cpp
|
${LIBDIR}/slic3r/Utils/FixModelByWin10.cpp
|
||||||
@ -279,11 +281,9 @@ add_library(libslic3r_gui STATIC
|
|||||||
${LIBDIR}/slic3r/Utils/PresetUpdater.hpp
|
${LIBDIR}/slic3r/Utils/PresetUpdater.hpp
|
||||||
${LIBDIR}/slic3r/Utils/Time.cpp
|
${LIBDIR}/slic3r/Utils/Time.cpp
|
||||||
${LIBDIR}/slic3r/Utils/Time.hpp
|
${LIBDIR}/slic3r/Utils/Time.hpp
|
||||||
${LIBDIR}/slic3r/GUI/PngExportDialog.hpp
|
|
||||||
${LIBDIR}/slic3r/GUI/PngExportDialog.cpp
|
|
||||||
${LIBDIR}/slic3r/Utils/HexFile.cpp
|
${LIBDIR}/slic3r/Utils/HexFile.cpp
|
||||||
${LIBDIR}/slic3r/Utils/HexFile.hpp
|
${LIBDIR}/slic3r/Utils/HexFile.hpp
|
||||||
${LIBDIR}/slic3r/IProgressIndicator.hpp
|
${LIBDIR}/slic3r/ProgressIndicator.hpp
|
||||||
${LIBDIR}/slic3r/AppController.hpp
|
${LIBDIR}/slic3r/AppController.hpp
|
||||||
${LIBDIR}/slic3r/AppController.cpp
|
${LIBDIR}/slic3r/AppController.cpp
|
||||||
${LIBDIR}/slic3r/AppControllerWx.cpp
|
${LIBDIR}/slic3r/AppControllerWx.cpp
|
||||||
@ -479,6 +479,7 @@ set(XS_XSP_FILES
|
|||||||
${XSP_DIR}/Utils_PrintHost.xsp
|
${XSP_DIR}/Utils_PrintHost.xsp
|
||||||
${XSP_DIR}/Utils_PresetUpdater.xsp
|
${XSP_DIR}/Utils_PresetUpdater.xsp
|
||||||
${XSP_DIR}/AppController.xsp
|
${XSP_DIR}/AppController.xsp
|
||||||
|
${XSP_DIR}/ProgressStatusBar.xsp
|
||||||
${XSP_DIR}/XS.xsp
|
${XSP_DIR}/XS.xsp
|
||||||
)
|
)
|
||||||
foreach (file ${XS_XSP_FILES})
|
foreach (file ${XS_XSP_FILES})
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <boost/log/trivial.hpp>
|
#include <boost/log/trivial.hpp>
|
||||||
|
|
||||||
#include "slic3r/IProgressIndicator.hpp"
|
#include "slic3r/ProgressIndicator.hpp"
|
||||||
#include "PrintExport.hpp"
|
#include "PrintExport.hpp"
|
||||||
|
|
||||||
//! macro used to mark string used at localization,
|
//! macro used to mark string used at localization,
|
||||||
|
@ -227,8 +227,8 @@ private:
|
|||||||
typedef std::vector<PrintObject*> PrintObjectPtrs;
|
typedef std::vector<PrintObject*> PrintObjectPtrs;
|
||||||
typedef std::vector<PrintRegion*> PrintRegionPtrs;
|
typedef std::vector<PrintRegion*> PrintRegionPtrs;
|
||||||
|
|
||||||
class IProgressIndicator;
|
class ProgressIndicator;
|
||||||
using ProgressIndicatorPtr = std::shared_ptr<IProgressIndicator>;
|
using ProgressIndicatorPtr = std::shared_ptr<ProgressIndicator>;
|
||||||
|
|
||||||
// The complete print tray with possibly multiple objects.
|
// The complete print tray with possibly multiple objects.
|
||||||
class Print
|
class Print
|
||||||
|
@ -62,6 +62,7 @@ REGISTER_CLASS(Preset, "GUI::Preset");
|
|||||||
REGISTER_CLASS(PresetCollection, "GUI::PresetCollection");
|
REGISTER_CLASS(PresetCollection, "GUI::PresetCollection");
|
||||||
REGISTER_CLASS(PresetBundle, "GUI::PresetBundle");
|
REGISTER_CLASS(PresetBundle, "GUI::PresetBundle");
|
||||||
REGISTER_CLASS(TabIface, "GUI::Tab");
|
REGISTER_CLASS(TabIface, "GUI::Tab");
|
||||||
|
REGISTER_CLASS(ProgressStatusBar, "GUI::ProgressStatusBar");
|
||||||
REGISTER_CLASS(PresetUpdater, "PresetUpdater");
|
REGISTER_CLASS(PresetUpdater, "PresetUpdater");
|
||||||
REGISTER_CLASS(AppController, "AppController");
|
REGISTER_CLASS(AppController, "AppController");
|
||||||
REGISTER_CLASS(PrintController, "PrintController");
|
REGISTER_CLASS(PrintController, "PrintController");
|
||||||
|
@ -401,7 +401,7 @@ void PrintController::slice_to_png()
|
|||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
void IProgressIndicator::message_fmt(
|
void ProgressIndicator::message_fmt(
|
||||||
const string &fmtstr, ...) {
|
const string &fmtstr, ...) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
va_list args;
|
va_list args;
|
||||||
@ -435,10 +435,6 @@ const PrintConfig &PrintController::config() const
|
|||||||
|
|
||||||
void AppController::arrange_model()
|
void AppController::arrange_model()
|
||||||
{
|
{
|
||||||
auto ftr = std::async(
|
|
||||||
supports_asynch()? std::launch::async : std::launch::deferred,
|
|
||||||
[this]()
|
|
||||||
{
|
|
||||||
using Coord = libnest2d::TCoord<libnest2d::PointImpl>;
|
using Coord = libnest2d::TCoord<libnest2d::PointImpl>;
|
||||||
|
|
||||||
unsigned count = 0;
|
unsigned count = 0;
|
||||||
@ -454,6 +450,9 @@ void AppController::arrange_model()
|
|||||||
// Set the range of the progress to the object count
|
// Set the range of the progress to the object count
|
||||||
pind->max(count);
|
pind->max(count);
|
||||||
|
|
||||||
|
pind->on_cancel([](){
|
||||||
|
std::cout << "Cannot be cancelled!" << std::endl;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dist = print_ctl()->config().min_object_distance();
|
auto dist = print_ctl()->config().min_object_distance();
|
||||||
@ -474,7 +473,7 @@ void AppController::arrange_model()
|
|||||||
bed,
|
bed,
|
||||||
arr::BOX,
|
arr::BOX,
|
||||||
false, // create many piles not just one pile
|
false, // create many piles not just one pile
|
||||||
[pind, count](unsigned rem) {
|
[this, pind, count](unsigned rem) {
|
||||||
if(pind)
|
if(pind)
|
||||||
pind->update(count - rem, _(L("Arranging objects...")));
|
pind->update(count - rem, _(L("Arranging objects...")));
|
||||||
});
|
});
|
||||||
@ -490,12 +489,7 @@ void AppController::arrange_model()
|
|||||||
if(pind) {
|
if(pind) {
|
||||||
pind->max(pmax);
|
pind->max(pmax);
|
||||||
pind->update(0, _(L("Arranging done.")));
|
pind->update(0, _(L("Arranging done.")));
|
||||||
}
|
pind->on_cancel(/*remove cancel function*/);
|
||||||
});
|
|
||||||
|
|
||||||
while( ftr.wait_for(std::chrono::milliseconds(10))
|
|
||||||
!= std::future_status::ready) {
|
|
||||||
process_events();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "IProgressIndicator.hpp"
|
#include "ProgressIndicator.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
@ -15,6 +15,7 @@ class Model;
|
|||||||
class Print;
|
class Print;
|
||||||
class PrintObject;
|
class PrintObject;
|
||||||
class PrintConfig;
|
class PrintConfig;
|
||||||
|
class ProgressStatusBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A boilerplate class for creating application logic. It should provide
|
* @brief A boilerplate class for creating application logic. It should provide
|
||||||
@ -32,7 +33,7 @@ class AppControllerBoilerplate {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/// A Progress indicator object smart pointer
|
/// A Progress indicator object smart pointer
|
||||||
using ProgresIndicatorPtr = std::shared_ptr<IProgressIndicator>;
|
using ProgresIndicatorPtr = std::shared_ptr<ProgressIndicator>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class PriData; // Some structure to store progress indication data
|
class PriData; // Some structure to store progress indication data
|
||||||
@ -278,8 +279,7 @@ public:
|
|||||||
* @param gauge_id The ID of the gague widget of the status bar.
|
* @param gauge_id The ID of the gague widget of the status bar.
|
||||||
* @param statusbar_id The ID of the status bar.
|
* @param statusbar_id The ID of the status bar.
|
||||||
*/
|
*/
|
||||||
void set_global_progress_indicator(unsigned gauge_id,
|
void set_global_progress_indicator(ProgressStatusBar *prs);
|
||||||
unsigned statusbar_id);
|
|
||||||
|
|
||||||
void arrange_model();
|
void arrange_model();
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <future>
|
#include <future>
|
||||||
|
|
||||||
#include <slic3r/GUI/GUI.hpp>
|
#include <slic3r/GUI/GUI.hpp>
|
||||||
#include <slic3r/GUI/PngExportDialog.hpp>
|
#include <slic3r/GUI/ProgressStatusBar.hpp>
|
||||||
|
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/filedlg.h>
|
#include <wx/filedlg.h>
|
||||||
@ -105,10 +105,10 @@ namespace {
|
|||||||
* the main thread as well.
|
* the main thread as well.
|
||||||
*/
|
*/
|
||||||
class GuiProgressIndicator:
|
class GuiProgressIndicator:
|
||||||
public IProgressIndicator, public wxEvtHandler {
|
public ProgressIndicator, public wxEvtHandler {
|
||||||
|
|
||||||
wxProgressDialog gauge_;
|
wxProgressDialog gauge_;
|
||||||
using Base = IProgressIndicator;
|
using Base = ProgressIndicator;
|
||||||
wxString message_;
|
wxString message_;
|
||||||
int range_; wxString title_;
|
int range_; wxString title_;
|
||||||
bool is_asynch_ = false;
|
bool is_asynch_ = false;
|
||||||
@ -154,7 +154,7 @@ public:
|
|||||||
|
|
||||||
virtual void cancel() override {
|
virtual void cancel() override {
|
||||||
update(max(), "Abort");
|
update(max(), "Abort");
|
||||||
IProgressIndicator::cancel();
|
ProgressIndicator::cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void state(float val) override {
|
virtual void state(float val) override {
|
||||||
@ -211,31 +211,21 @@ AppControllerBoilerplate::create_progress_indicator(unsigned statenum,
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// A wrapper progress indicator class around the statusbar created in perl.
|
class Wrapper: public ProgressIndicator, public wxEvtHandler {
|
||||||
class Wrapper: public IProgressIndicator, public wxEvtHandler {
|
ProgressStatusBar *sbar_;
|
||||||
wxGauge *gauge_;
|
using Base = ProgressIndicator;
|
||||||
wxStatusBar *stbar_;
|
|
||||||
using Base = IProgressIndicator;
|
|
||||||
std::string message_;
|
std::string message_;
|
||||||
AppControllerBoilerplate& ctl_;
|
AppControllerBoilerplate& ctl_;
|
||||||
|
|
||||||
void showProgress(bool show = true) {
|
void showProgress(bool show = true) {
|
||||||
gauge_->Show(show);
|
sbar_->show_progress(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _state(unsigned st) {
|
void _state(unsigned st) {
|
||||||
if( st <= IProgressIndicator::max() ) {
|
if( st <= ProgressIndicator::max() ) {
|
||||||
Base::state(st);
|
Base::state(st);
|
||||||
|
sbar_->set_status_text(message_);
|
||||||
if(!gauge_->IsShown()) showProgress(true);
|
sbar_->set_progress(st);
|
||||||
|
|
||||||
stbar_->SetStatusText(message_);
|
|
||||||
if(static_cast<long>(st) == gauge_->GetRange()) {
|
|
||||||
gauge_->SetValue(0);
|
|
||||||
showProgress(false);
|
|
||||||
} else {
|
|
||||||
gauge_->SetValue(static_cast<int>(st));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,12 +238,12 @@ class Wrapper: public IProgressIndicator, public wxEvtHandler {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
inline Wrapper(wxGauge *gauge, wxStatusBar *stbar,
|
inline Wrapper(ProgressStatusBar *sbar,
|
||||||
AppControllerBoilerplate& ctl):
|
AppControllerBoilerplate& ctl):
|
||||||
gauge_(gauge), stbar_(stbar), ctl_(ctl)
|
sbar_(sbar), ctl_(ctl)
|
||||||
{
|
{
|
||||||
Base::max(static_cast<float>(gauge->GetRange()));
|
Base::max(static_cast<float>(sbar_->get_range()));
|
||||||
Base::states(static_cast<unsigned>(gauge->GetRange()));
|
Base::states(static_cast<unsigned>(sbar_->get_range()));
|
||||||
|
|
||||||
Bind(PROGRESS_STATUS_UPDATE_EVENT,
|
Bind(PROGRESS_STATUS_UPDATE_EVENT,
|
||||||
&Wrapper::_state,
|
&Wrapper::_state,
|
||||||
@ -266,8 +256,8 @@ public:
|
|||||||
|
|
||||||
virtual void max(float val) override {
|
virtual void max(float val) override {
|
||||||
if(val > 1.0) {
|
if(val > 1.0) {
|
||||||
gauge_->SetRange(static_cast<int>(val));
|
sbar_->set_range(static_cast<int>(val));
|
||||||
IProgressIndicator::max(val);
|
ProgressIndicator::max(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,135 +284,19 @@ public:
|
|||||||
|
|
||||||
virtual void title(const string & /*title*/) override {}
|
virtual void title(const string & /*title*/) override {}
|
||||||
|
|
||||||
|
virtual void on_cancel(CancelFn fn) override {
|
||||||
|
sbar_->set_cancel_callback(fn);
|
||||||
|
Base::on_cancel(fn);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppController::set_global_progress_indicator(
|
void AppController::set_global_progress_indicator(ProgressStatusBar *prsb)
|
||||||
unsigned gid,
|
|
||||||
unsigned sid)
|
|
||||||
{
|
{
|
||||||
wxGauge* gauge = dynamic_cast<wxGauge*>(wxWindow::FindWindowById(gid));
|
if(prsb) {
|
||||||
wxStatusBar* sb = dynamic_cast<wxStatusBar*>(wxWindow::FindWindowById(sid));
|
global_progress_indicator(std::make_shared<Wrapper>(prsb, *this));
|
||||||
|
|
||||||
if(gauge && sb) {
|
|
||||||
global_progress_indicator(std::make_shared<Wrapper>(gauge, sb, *this));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//PrintController::PngExportData PrintController::collect_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;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
@ -202,6 +202,8 @@ void set_main_frame(wxFrame *main_frame)
|
|||||||
g_wxMainFrame = main_frame;
|
g_wxMainFrame = main_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxFrame* get_main_frame() { return g_wxMainFrame; }
|
||||||
|
|
||||||
void set_tab_panel(wxNotebook *tab_panel)
|
void set_tab_panel(wxNotebook *tab_panel)
|
||||||
{
|
{
|
||||||
g_wxTabPanel = tab_panel;
|
g_wxTabPanel = tab_panel;
|
||||||
@ -856,10 +858,6 @@ wxWindow* get_right_panel(){
|
|||||||
return g_right_panel;
|
return g_right_panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFrame* get_main_frame() {
|
|
||||||
return g_wxMainFrame;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxNotebook * get_tab_panel() {
|
wxNotebook * get_tab_panel() {
|
||||||
return g_wxTabPanel;
|
return g_wxTabPanel;
|
||||||
}
|
}
|
||||||
|
@ -1,286 +0,0 @@
|
|||||||
#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 );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
#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
|
|
151
xs/src/slic3r/GUI/ProgressStatusBar.cpp
Normal file
151
xs/src/slic3r/GUI/ProgressStatusBar.cpp
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
#include "ProgressStatusBar.hpp"
|
||||||
|
|
||||||
|
#include <wx/timer.h>
|
||||||
|
#include <wx/gauge.h>
|
||||||
|
#include <wx/button.h>
|
||||||
|
#include <wx/statusbr.h>
|
||||||
|
#include <wx/frame.h>
|
||||||
|
#include "GUI.hpp"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
|
||||||
|
ProgressStatusBar::ProgressStatusBar(wxWindow *parent, int id):
|
||||||
|
self(new wxStatusBar(parent ? parent : GUI::get_main_frame(),
|
||||||
|
id == -1? wxID_ANY : id)),
|
||||||
|
timer_(new wxTimer(self)),
|
||||||
|
prog_ (new wxGauge(self,
|
||||||
|
wxGA_HORIZONTAL,
|
||||||
|
100,
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize)),
|
||||||
|
cancelbutton_(new wxButton(self,
|
||||||
|
-1,
|
||||||
|
"Cancel",
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize))
|
||||||
|
{
|
||||||
|
prog_->Hide();
|
||||||
|
cancelbutton_->Hide();
|
||||||
|
|
||||||
|
self->SetFieldsCount(3);
|
||||||
|
int w[] = {-1, 150, 155};
|
||||||
|
self->SetStatusWidths(3, w);
|
||||||
|
|
||||||
|
self->Bind(wxEVT_TIMER, [this](const wxTimerEvent&) {
|
||||||
|
if (prog_->IsShown()) timer_->Stop();
|
||||||
|
if(is_busy()) prog_->Pulse();
|
||||||
|
});
|
||||||
|
|
||||||
|
self->Bind(wxEVT_SIZE, [this](wxSizeEvent& event){
|
||||||
|
wxRect rect;
|
||||||
|
self->GetFieldRect(1, rect);
|
||||||
|
auto offset = 0;
|
||||||
|
cancelbutton_->Move(rect.GetX() + offset, rect.GetY() + offset);
|
||||||
|
cancelbutton_->SetSize(rect.GetWidth() - offset, rect.GetHeight());
|
||||||
|
|
||||||
|
self->GetFieldRect(2, rect);
|
||||||
|
prog_->Move(rect.GetX() + offset, rect.GetY() + offset);
|
||||||
|
prog_->SetSize(rect.GetWidth() - offset, rect.GetHeight());
|
||||||
|
|
||||||
|
event.Skip();
|
||||||
|
});
|
||||||
|
|
||||||
|
cancelbutton_->Bind(wxEVT_BUTTON, [this](const wxCommandEvent&) {
|
||||||
|
if(cancel_cb_) cancel_cb_();
|
||||||
|
cancelbutton_->Hide();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ProgressStatusBar::~ProgressStatusBar() {
|
||||||
|
if(timer_->IsRunning()) timer_->Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProgressStatusBar::get_progress() const
|
||||||
|
{
|
||||||
|
return prog_->GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressStatusBar::set_progress(int val)
|
||||||
|
{
|
||||||
|
if(!prog_->IsShown()) show_progress(true);
|
||||||
|
|
||||||
|
if(val == prog_->GetRange()) {
|
||||||
|
prog_->SetValue(0);
|
||||||
|
show_progress(false);
|
||||||
|
} else {
|
||||||
|
prog_->SetValue(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProgressStatusBar::get_range() const
|
||||||
|
{
|
||||||
|
return prog_->GetRange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressStatusBar::set_range(int val)
|
||||||
|
{
|
||||||
|
if(val != prog_->GetRange()) {
|
||||||
|
prog_->SetRange(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressStatusBar::show_progress(bool show)
|
||||||
|
{
|
||||||
|
prog_->Show(show);
|
||||||
|
prog_->Pulse();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressStatusBar::start_busy(int rate)
|
||||||
|
{
|
||||||
|
busy_ = true;
|
||||||
|
show_progress(true);
|
||||||
|
if (!timer_->IsRunning()) {
|
||||||
|
timer_->Start(rate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressStatusBar::stop_busy()
|
||||||
|
{
|
||||||
|
timer_->Stop();
|
||||||
|
show_progress(false);
|
||||||
|
prog_->SetValue(0);
|
||||||
|
busy_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressStatusBar::set_cancel_callback(ProgressStatusBar::CancelFn ccb) {
|
||||||
|
cancel_cb_ = ccb;
|
||||||
|
if(ccb) cancelbutton_->Show();
|
||||||
|
else cancelbutton_->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressStatusBar::run(int rate)
|
||||||
|
{
|
||||||
|
if(!timer_->IsRunning()) {
|
||||||
|
timer_->Start(rate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressStatusBar::embed(wxFrame *frame)
|
||||||
|
{
|
||||||
|
wxFrame* mf = frame? frame : GUI::get_main_frame();
|
||||||
|
mf->SetStatusBar(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressStatusBar::set_status_text(const std::string& txt)
|
||||||
|
{
|
||||||
|
self->SetStatusText(txt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressStatusBar::show_cancel_button()
|
||||||
|
{
|
||||||
|
cancelbutton_->Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressStatusBar::hide_cancel_button()
|
||||||
|
{
|
||||||
|
cancelbutton_->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
64
xs/src/slic3r/GUI/ProgressStatusBar.hpp
Normal file
64
xs/src/slic3r/GUI/ProgressStatusBar.hpp
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#ifndef PROGRESSSTATUSBAR_HPP
|
||||||
|
#define PROGRESSSTATUSBAR_HPP
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
class wxTimer;
|
||||||
|
class wxGauge;
|
||||||
|
class wxButton;
|
||||||
|
class wxTimerEvent;
|
||||||
|
class wxStatusBar;
|
||||||
|
class wxWindow;
|
||||||
|
class wxFrame;
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The ProgressStatusBar class is the widgets occupying the lower area
|
||||||
|
* of the Slicer main window. It consists of a message area to the left and a
|
||||||
|
* progress indication area to the right with an optional cancel button.
|
||||||
|
*/
|
||||||
|
class ProgressStatusBar {
|
||||||
|
wxStatusBar *self; // we cheat! It should be the base class but: perl!
|
||||||
|
wxTimer *timer_;
|
||||||
|
wxGauge *prog_;
|
||||||
|
wxButton *cancelbutton_;
|
||||||
|
public:
|
||||||
|
|
||||||
|
/// Cancel callback function type
|
||||||
|
using CancelFn = std::function<void()>;
|
||||||
|
|
||||||
|
ProgressStatusBar(wxWindow *parent = nullptr, int id = -1);
|
||||||
|
~ProgressStatusBar();
|
||||||
|
|
||||||
|
int get_progress() const;
|
||||||
|
void set_progress(int);
|
||||||
|
int get_range() const;
|
||||||
|
void set_range(int = 100);
|
||||||
|
void show_progress(bool);
|
||||||
|
void start_busy(int = 100);
|
||||||
|
void stop_busy();
|
||||||
|
inline bool is_busy() const { return busy_; }
|
||||||
|
void set_cancel_callback(CancelFn = CancelFn());
|
||||||
|
inline void remove_cancel_callback() { set_cancel_callback(); }
|
||||||
|
void run(int rate);
|
||||||
|
void embed(wxFrame *frame = nullptr);
|
||||||
|
void set_status_text(const std::string& txt);
|
||||||
|
|
||||||
|
// Temporary methods to satisfy Perl side
|
||||||
|
void show_cancel_button();
|
||||||
|
void hide_cancel_button();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool busy_ = false;
|
||||||
|
CancelFn cancel_cb_;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace GUI {
|
||||||
|
using Slic3r::ProgressStatusBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // PROGRESSSTATUSBAR_HPP
|
@ -10,9 +10,9 @@ namespace Slic3r {
|
|||||||
/**
|
/**
|
||||||
* @brief Generic progress indication interface.
|
* @brief Generic progress indication interface.
|
||||||
*/
|
*/
|
||||||
class IProgressIndicator {
|
class ProgressIndicator {
|
||||||
public:
|
public:
|
||||||
using CancelFn = std::function<void(void)>; // Cancel functio signature.
|
using CancelFn = std::function<void(void)>; // Cancel function signature.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float state_ = .0f, max_ = 1.f, step_;
|
float state_ = .0f, max_ = 1.f, step_;
|
||||||
@ -20,7 +20,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
inline virtual ~IProgressIndicator() {}
|
inline virtual ~ProgressIndicator() {}
|
||||||
|
|
||||||
/// Get the maximum of the progress range.
|
/// Get the maximum of the progress range.
|
||||||
float max() const { return max_; }
|
float max() const { return max_; }
|
||||||
@ -28,14 +28,14 @@ public:
|
|||||||
/// Get the current progress state
|
/// Get the current progress state
|
||||||
float state() const { return state_; }
|
float state() const { return state_; }
|
||||||
|
|
||||||
/// Set the maximum of hte progress range
|
/// Set the maximum of the progress range
|
||||||
virtual void max(float maxval) { max_ = maxval; }
|
virtual void max(float maxval) { max_ = maxval; }
|
||||||
|
|
||||||
/// Set the current state of the progress.
|
/// Set the current state of the progress.
|
||||||
virtual void state(float val) { state_ = val; }
|
virtual void state(float val) { state_ = val; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Number of states int the progress. Can be used insted of giving a
|
* @brief Number of states int the progress. Can be used instead of giving a
|
||||||
* maximum value.
|
* maximum value.
|
||||||
*/
|
*/
|
||||||
virtual void states(unsigned statenum) {
|
virtual void states(unsigned statenum) {
|
||||||
@ -45,14 +45,14 @@ public:
|
|||||||
/// Message shown on the next status update.
|
/// Message shown on the next status update.
|
||||||
virtual void message(const string&) = 0;
|
virtual void message(const string&) = 0;
|
||||||
|
|
||||||
/// Title of the operaton.
|
/// Title of the operation.
|
||||||
virtual void title(const string&) = 0;
|
virtual void title(const string&) = 0;
|
||||||
|
|
||||||
/// Formatted message for the next status update. Works just like sprinf.
|
/// Formatted message for the next status update. Works just like sprintf.
|
||||||
virtual void message_fmt(const string& fmt, ...);
|
virtual void message_fmt(const string& fmt, ...);
|
||||||
|
|
||||||
/// Set up a cancel callback for the operation if feasible.
|
/// Set up a cancel callback for the operation if feasible.
|
||||||
inline void on_cancel(CancelFn func) { cancelfunc_ = func; }
|
virtual void on_cancel(CancelFn func = CancelFn()) { cancelfunc_ = func; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Explicitly shut down the progress indicator and call the associated
|
* Explicitly shut down the progress indicator and call the associated
|
||||||
@ -60,7 +60,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual void cancel() { cancelfunc_(); }
|
virtual void cancel() { cancelfunc_(); }
|
||||||
|
|
||||||
/// Convinience function to call message and status update in one function.
|
/// Convenience function to call message and status update in one function.
|
||||||
void update(float st, const string& msg) {
|
void update(float st, const string& msg) {
|
||||||
message(msg); state(st);
|
message(msg); state(st);
|
||||||
}
|
}
|
@ -5,6 +5,7 @@
|
|||||||
#include "slic3r/AppController.hpp"
|
#include "slic3r/AppController.hpp"
|
||||||
#include "libslic3r/Model.hpp"
|
#include "libslic3r/Model.hpp"
|
||||||
#include "libslic3r/Print.hpp"
|
#include "libslic3r/Print.hpp"
|
||||||
|
#include "slic3r/GUI/ProgressStatusBar.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%name{Slic3r::PrintController} class PrintController {
|
%name{Slic3r::PrintController} class PrintController {
|
||||||
@ -22,7 +23,7 @@
|
|||||||
PrintController *print_ctl();
|
PrintController *print_ctl();
|
||||||
void set_model(Model *model);
|
void set_model(Model *model);
|
||||||
void set_print(Print *print);
|
void set_print(Print *print);
|
||||||
void set_global_progress_indicator(unsigned gauge_id, unsigned statusbar_id);
|
void set_global_progress_indicator(ProgressStatusBar *prs);
|
||||||
|
|
||||||
void arrange_model();
|
void arrange_model();
|
||||||
};
|
};
|
48
xs/xsp/ProgressStatusBar.xsp
Normal file
48
xs/xsp/ProgressStatusBar.xsp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <xsinit.h>
|
||||||
|
#include "slic3r/GUI/ProgressStatusBar.hpp"
|
||||||
|
%}
|
||||||
|
|
||||||
|
%name{Slic3r::GUI::ProgressStatusBar} class ProgressStatusBar {
|
||||||
|
ProgressStatusBar();
|
||||||
|
~ProgressStatusBar();
|
||||||
|
|
||||||
|
int GetProgress() const
|
||||||
|
%code%{ RETVAL=THIS->get_progress(); %};
|
||||||
|
|
||||||
|
void SetProgress(int val)
|
||||||
|
%code%{ THIS->set_progress(val); %};
|
||||||
|
|
||||||
|
void SetRange(int val = 100)
|
||||||
|
%code%{ THIS->set_range(val); %};
|
||||||
|
|
||||||
|
void ShowProgress(bool show)
|
||||||
|
%code%{ THIS->show_progress(show); %};
|
||||||
|
|
||||||
|
void StartBusy(int val = 100)
|
||||||
|
%code%{ THIS->start_busy(val); %};
|
||||||
|
|
||||||
|
void StopBusy()
|
||||||
|
%code%{ THIS->stop_busy(); %};
|
||||||
|
|
||||||
|
bool IsBusy() const
|
||||||
|
%code%{ RETVAL=THIS->is_busy(); %};
|
||||||
|
|
||||||
|
void Run(int rate)
|
||||||
|
%code%{ THIS->run(rate); %};
|
||||||
|
|
||||||
|
void Embed()
|
||||||
|
%code%{ THIS->embed(); %};
|
||||||
|
|
||||||
|
void SetStatusText(std::string txt)
|
||||||
|
%code%{ THIS->set_status_text(txt); %};
|
||||||
|
|
||||||
|
void ShowCancelButton()
|
||||||
|
%code%{ THIS->show_cancel_button(); %};
|
||||||
|
|
||||||
|
void HideCancelButton()
|
||||||
|
%code%{ THIS->hide_cancel_button(); %};
|
||||||
|
|
||||||
|
};
|
@ -235,6 +235,8 @@ PresetBundle* O_OBJECT_SLIC3R
|
|||||||
Ref<PresetBundle> O_OBJECT_SLIC3R_T
|
Ref<PresetBundle> O_OBJECT_SLIC3R_T
|
||||||
TabIface* O_OBJECT_SLIC3R
|
TabIface* O_OBJECT_SLIC3R
|
||||||
Ref<TabIface> O_OBJECT_SLIC3R_T
|
Ref<TabIface> O_OBJECT_SLIC3R_T
|
||||||
|
ProgressStatusBar* O_OBJECT_SLIC3R
|
||||||
|
Ref<ProgressStatusBar> O_OBJECT_SLIC3R_T
|
||||||
|
|
||||||
PresetUpdater* O_OBJECT_SLIC3R
|
PresetUpdater* O_OBJECT_SLIC3R
|
||||||
Ref<PresetUpdater> O_OBJECT_SLIC3R_T
|
Ref<PresetUpdater> O_OBJECT_SLIC3R_T
|
||||||
|
@ -213,6 +213,7 @@
|
|||||||
%typemap{PresetHints*};
|
%typemap{PresetHints*};
|
||||||
%typemap{Ref<PresetHints>}{simple};
|
%typemap{Ref<PresetHints>}{simple};
|
||||||
%typemap{TabIface*};
|
%typemap{TabIface*};
|
||||||
|
%typemap{ProgressStatusBar*};
|
||||||
|
|
||||||
%typemap{PrintRegionPtrs*};
|
%typemap{PrintRegionPtrs*};
|
||||||
%typemap{PrintObjectPtrs*};
|
%typemap{PrintObjectPtrs*};
|
||||||
|
Loading…
Reference in New Issue
Block a user