Separate Job, ProgressStatusBar and ProgressIndicator

* Separate GUI::Job
* make use of ProgressIndicator interface
* make ProgressStatusbar independent from GUI::App
This commit is contained in:
tamasmeszaros 2019-12-16 09:47:31 +01:00
parent f60ff1c7ce
commit a9403319b7
8 changed files with 206 additions and 192 deletions

View file

@ -15,8 +15,7 @@
namespace Slic3r {
ProgressStatusBar::ProgressStatusBar(wxWindow *parent, int id)
: self{new wxStatusBar(parent ? parent : GUI::wxGetApp().mainframe,
id == -1 ? wxID_ANY : id)}
: self{new wxStatusBar(parent, id == -1 ? wxID_ANY : id)}
, m_prog{new wxGauge(self,
wxGA_HORIZONTAL,
100,
@ -32,7 +31,6 @@ ProgressStatusBar::ProgressStatusBar(wxWindow *parent, int id)
m_prog->Hide();
m_cancelbutton->Hide();
self->SetFont(GUI::wxGetApp().normal_font());
self->SetFieldsCount(3);
int w[] = {-1, 150, 155};
self->SetStatusWidths(3, w);
@ -149,8 +147,7 @@ void ProgressStatusBar::run(int rate)
void ProgressStatusBar::embed(wxFrame *frame)
{
wxFrame* mf = frame ? frame : GUI::wxGetApp().mainframe;
if(mf) mf->SetStatusBar(self);
if(frame) frame->SetStatusBar(self);
}
void ProgressStatusBar::set_status_text(const wxString& txt)
@ -173,6 +170,11 @@ wxString ProgressStatusBar::get_status_text() const
return self->GetStatusText();
}
void ProgressStatusBar::set_font(const wxFont &font)
{
self->SetFont(font);
}
void ProgressStatusBar::show_cancel_button()
{
if(m_cancelbutton) m_cancelbutton->Show();