mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 07:34:03 -06:00
Merged with dev
This commit is contained in:
parent
d934b63424
commit
fe3b92870f
90 changed files with 3310 additions and 1748 deletions
|
@ -28,16 +28,16 @@ bool AppControllerBoilerplate::supports_asynch() const
|
|||
|
||||
void AppControllerBoilerplate::process_events()
|
||||
{
|
||||
wxSafeYield();
|
||||
wxYieldIfNeeded();
|
||||
}
|
||||
|
||||
AppControllerBoilerplate::PathList
|
||||
AppControllerBoilerplate::query_destination_paths(
|
||||
const wxString &title,
|
||||
const std::string &title,
|
||||
const std::string &extensions) const
|
||||
{
|
||||
|
||||
wxFileDialog dlg(wxTheApp->GetTopWindow(), title );
|
||||
wxFileDialog dlg(wxTheApp->GetTopWindow(), _(title) );
|
||||
dlg.SetWildcard(extensions);
|
||||
|
||||
dlg.ShowModal();
|
||||
|
@ -53,11 +53,11 @@ AppControllerBoilerplate::query_destination_paths(
|
|||
|
||||
AppControllerBoilerplate::Path
|
||||
AppControllerBoilerplate::query_destination_path(
|
||||
const wxString &title,
|
||||
const std::string &title,
|
||||
const std::string &extensions,
|
||||
const std::string& hint) const
|
||||
{
|
||||
wxFileDialog dlg(wxTheApp->GetTopWindow(), title );
|
||||
wxFileDialog dlg(wxTheApp->GetTopWindow(), _(title) );
|
||||
dlg.SetWildcard(extensions);
|
||||
|
||||
dlg.SetFilename(hint);
|
||||
|
@ -72,8 +72,8 @@ AppControllerBoilerplate::query_destination_path(
|
|||
}
|
||||
|
||||
bool AppControllerBoilerplate::report_issue(IssueType issuetype,
|
||||
const wxString &description,
|
||||
const wxString &brief)
|
||||
const std::string &description,
|
||||
const std::string &brief)
|
||||
{
|
||||
auto icon = wxICON_INFORMATION;
|
||||
auto style = wxOK|wxCENTRE;
|
||||
|
@ -85,15 +85,15 @@ bool AppControllerBoilerplate::report_issue(IssueType issuetype,
|
|||
case IssueType::FATAL: icon = wxICON_ERROR;
|
||||
}
|
||||
|
||||
auto ret = wxMessageBox(description, brief, icon | style);
|
||||
auto ret = wxMessageBox(_(description), _(brief), icon | style);
|
||||
return ret != wxCANCEL;
|
||||
}
|
||||
|
||||
bool AppControllerBoilerplate::report_issue(
|
||||
AppControllerBoilerplate::IssueType issuetype,
|
||||
const wxString &description)
|
||||
const std::string &description)
|
||||
{
|
||||
return report_issue(issuetype, description, wxString());
|
||||
return report_issue(issuetype, description, std::string());
|
||||
}
|
||||
|
||||
wxDEFINE_EVENT(PROGRESS_STATUS_UPDATE_EVENT, wxCommandEvent);
|
||||
|
@ -126,7 +126,9 @@ class GuiProgressIndicator:
|
|||
void _state( unsigned st) {
|
||||
if(!gauge_.IsShown()) gauge_.ShowModal();
|
||||
Base::state(st);
|
||||
gauge_.Update(static_cast<int>(st), message_);
|
||||
if(!gauge_.Update(static_cast<int>(st), message_)) {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -140,7 +142,8 @@ public:
|
|||
inline GuiProgressIndicator(int range, const wxString& title,
|
||||
const wxString& firstmsg) :
|
||||
gauge_(title, firstmsg, range, wxTheApp->GetTopWindow(),
|
||||
wxPD_APP_MODAL | wxPD_AUTO_HIDE),
|
||||
wxPD_APP_MODAL | wxPD_AUTO_HIDE | wxPD_CAN_ABORT),
|
||||
|
||||
message_(firstmsg),
|
||||
range_(range), title_(title)
|
||||
{
|
||||
|
@ -152,11 +155,6 @@ public:
|
|||
this, id_);
|
||||
}
|
||||
|
||||
virtual void cancel() override {
|
||||
update(max(), "Abort");
|
||||
ProgressIndicator::cancel();
|
||||
}
|
||||
|
||||
virtual void state(float val) override {
|
||||
state(static_cast<unsigned>(val));
|
||||
}
|
||||
|
@ -171,26 +169,28 @@ public:
|
|||
} else _state(st);
|
||||
}
|
||||
|
||||
virtual void message(const wxString & msg) override {
|
||||
message_ = msg;
|
||||
virtual void message(const std::string & msg) override {
|
||||
message_ = _(msg);
|
||||
}
|
||||
|
||||
virtual void messageFmt(const wxString& fmt, ...) {
|
||||
virtual void messageFmt(const std::string& fmt, ...) {
|
||||
va_list arglist;
|
||||
va_start(arglist, fmt);
|
||||
message_ = wxString::Format(wxString(fmt), arglist);
|
||||
message_ = wxString::Format(_(fmt), arglist);
|
||||
va_end(arglist);
|
||||
}
|
||||
|
||||
virtual void title(const wxString & title) override {
|
||||
title_ = title;
|
||||
virtual void title(const std::string & title) override {
|
||||
title_ = _(title);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
AppControllerBoilerplate::ProgresIndicatorPtr
|
||||
AppControllerBoilerplate::create_progress_indicator(
|
||||
unsigned statenum, const wxString& title, const wxString& firstmsg) const
|
||||
unsigned statenum,
|
||||
const std::string& title,
|
||||
const std::string& firstmsg) const
|
||||
{
|
||||
auto pri =
|
||||
std::make_shared<GuiProgressIndicator>(statenum, title, firstmsg);
|
||||
|
@ -203,10 +203,10 @@ AppControllerBoilerplate::create_progress_indicator(
|
|||
}
|
||||
|
||||
AppControllerBoilerplate::ProgresIndicatorPtr
|
||||
AppControllerBoilerplate::create_progress_indicator(unsigned statenum,
|
||||
const wxString &title) const
|
||||
AppControllerBoilerplate::create_progress_indicator(
|
||||
unsigned statenum, const std::string &title) const
|
||||
{
|
||||
return create_progress_indicator(statenum, title, wxString());
|
||||
return create_progress_indicator(statenum, title, std::string());
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -214,7 +214,7 @@ namespace {
|
|||
class Wrapper: public ProgressIndicator, public wxEvtHandler {
|
||||
ProgressStatusBar *sbar_;
|
||||
using Base = ProgressIndicator;
|
||||
std::string message_;
|
||||
wxString message_;
|
||||
AppControllerBoilerplate& ctl_;
|
||||
|
||||
void showProgress(bool show = true) {
|
||||
|
@ -271,18 +271,18 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void message(const wxString & msg) override {
|
||||
message_ = msg;
|
||||
virtual void message(const std::string & msg) override {
|
||||
message_ = _(msg);
|
||||
}
|
||||
|
||||
virtual void message_fmt(const wxString& fmt, ...) override {
|
||||
virtual void message_fmt(const std::string& fmt, ...) override {
|
||||
va_list arglist;
|
||||
va_start(arglist, fmt);
|
||||
message_ = wxString::Format(fmt, arglist);
|
||||
message_ = wxString::Format(_(fmt), arglist);
|
||||
va_end(arglist);
|
||||
}
|
||||
|
||||
virtual void title(const wxString & /*title*/) override {}
|
||||
virtual void title(const std::string & /*title*/) override {}
|
||||
|
||||
virtual void on_cancel(CancelFn fn) override {
|
||||
sbar_->set_cancel_callback(fn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue