OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::MediaProgressDialog Struct Reference
Inheritance diagram for Slic3r::GUI::MediaProgressDialog:
Collaboration diagram for Slic3r::GUI::MediaProgressDialog:

Public Types

enum  State {
  Uncancelable = -1 , Canceled , Continue , Finished ,
  Dismissed
}

Public Member Functions

 MediaProgressDialog (wxString title, wxWindow *parent, std::function< void()> cancel)
void OnCancel () override
void OnPaint (wxPaintEvent &evt)
virtual void DoSetSize (int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO) override
bool Create (const wxString &title, const wxString &message, int maximum=100, wxWindow *parent=NULL, int style=wxPD_APP_MODAL|wxPD_AUTO_HIDE)
virtual bool Update (int value, const wxString &newmsg=wxEmptyString, bool *skip=NULL)
virtual void Update () wxOVERRIDE
virtual bool Pulse (const wxString &newmsg=wxEmptyString, bool *skip=NULL)
bool WasCanceled () const
virtual void Resume ()
virtual int GetValue () const
virtual int GetRange () const
virtual wxString GetMessage () const
virtual void SetRange (int maximum)
virtual bool WasCancelled () const
virtual bool WasSkipped () const
virtual bool Show (bool show=true) wxOVERRIDE

Public Attributes

std::function< void()> m_cancel
int m_mode = 0
bool m_adaptive = {false}
wxSizer * m_sizer_main = {nullptr}
wxPanel * m_top_line = {nullptr}
wxSimplebook * m_simplebook = {nullptr}
wxPanel * m_panel_2line = {nullptr}
wxPanel * m_panel_1line = {nullptr}
Button * m_button_cancel = {nullptr}
wxScrolledWindow * m_msg_scrolledWindow = {nullptr}

Protected Member Functions

void OnCancel (wxCommandEvent &)
void SetMaximum (int maximum)
bool HasPDFlag (int flag) const
int GetPDStyle () const
void SetPDStyle (int pdStyle)
void set_panel_height (int height)
void UpdateTimeEstimates (int value, unsigned long &elapsedTime, unsigned long &estimatedTime, unsigned long &remainingTime)
void EnsureActiveEventLoopExists ()
void OnSkip (wxCommandEvent &)
void OnClose (wxCloseEvent &)
void DisableOtherWindows ()
void ReenableOtherWindows ()
void SetTopParent (wxWindow *parent)
wxString FormatString (wxString title)
wxWindow * GetTopParent () const

Static Protected Member Functions

static wxString GetElapsedLabel ()
static wxString GetEstimatedLabel ()
static wxString GetRemainingLabel ()
static wxString GetFormattedTime (unsigned long timeInSec)

Protected Attributes

State m_state
int m_maximum
unsigned long m_timeStart
unsigned long m_timeStop
unsigned long m_break

Private Member Functions

void Init ()
wxStaticText * CreateLabel (const wxString &text, wxSizer *sizer)
void UpdateMessage (const wxString &newmsg)
bool DoBeforeUpdate (bool *skip)
void DoAfterUpdate ()
void EnableClose ()
void EnableSkip (bool enable=true)
void EnableAbort (bool enable=true)
void DisableSkip ()
void DisableAbort ()
 wxDECLARE_NO_COPY_CLASS (ProgressDialog)

Static Private Member Functions

static void SetTimeLabel (unsigned long val, wxStaticText *label)

Private Attributes

wxGauge * m_gauge
wxStaticText * m_msg
wxStaticText * m_msg_2line
wxStaticText * m_elapsed
wxStaticText * m_estimated
wxStaticText * m_remaining
wxWindowRef m_parentTop
int m_pdStyle
bool m_skip
wxButton * m_btnAbort
wxButton * m_btnSkip
unsigned long m_last_timeupdate
int m_delay
int m_ctdelay
unsigned long m_display_estimated
wxWindowDisabler * m_winDisabler
wxEventLoop * m_tempEventLoop

Detailed Description

Member Enumeration Documentation

◆ State

Enumerator
Uncancelable 
Canceled 
Continue 
Finished 
Dismissed 
80 {
81 Uncancelable = -1, // dialog can't be canceled
82 Canceled, // can be cancelled and, in fact, was
83 Continue, // can be cancelled but wasn't
84 Finished, // finished, waiting to be removed from screen
85 Dismissed // was closed by user after finishing
86 };
@ Uncancelable
Definition ProgressDialog.hpp:81
@ Canceled
Definition ProgressDialog.hpp:82
@ Continue
Definition ProgressDialog.hpp:83
@ Dismissed
Definition ProgressDialog.hpp:85
@ Finished
Definition ProgressDialog.hpp:84

Constructor & Destructor Documentation

◆ MediaProgressDialog()

Slic3r::GUI::MediaProgressDialog::MediaProgressDialog ( wxString title,
wxWindow * parent,
std::function< void()> cancel )
inline
558 : ProgressDialog(title, "", 100, parent, wxPD_NO_PROGRESS | wxPD_APP_MODAL | wxPD_CAN_ABORT)
559 , m_cancel(cancel) {}
#define wxPD_NO_PROGRESS
Definition ProgressDialog.hpp:39
ProgressDialog()
Definition ProgressDialog.cpp:89
std::function< void()> m_cancel
Definition MediaFilePanel.cpp:561

References Slic3r::GUI::ProgressDialog::ProgressDialog(), m_cancel, and wxPD_NO_PROGRESS.

Here is the call graph for this function:

Member Function Documentation

◆ Create()

bool Slic3r::GUI::ProgressDialog::Create ( const wxString & title,
const wxString & message,
int maximum = 100,
wxWindow * parent = NULL,
int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE )
inherited
153{
154 SetFont(wxGetApp().normal_font());
155 SetTopParent(parent);
156
158
159 if (!wxDialog::Create(m_parentTop, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, GetWindowStyle())) return false;
160 SetBackgroundColour(PROGRESSDIALOG_DEF_BK);
161
162 /* SetSize(DESIGN_RESOUTION_PROGRESS_SIZE);
163 SetMinSize(DESIGN_RESOUTION_PROGRESS_SIZE);
164 SetMaxSize(DESIGN_RESOUTION_PROGRESS_SIZE);*/
165
166 SetMaximum(maximum);
168
169#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
170 if (!HasPDFlag(wxPD_CAN_ABORT)) { EnableCloseButton(false); }
171#endif // wxMSW
172
173 m_state = HasPDFlag(wxPD_CAN_ABORT) ? Continue : Uncancelable;
174
175 wxBoxSizer *m_sizer_main = new wxBoxSizer(wxVERTICAL);
176
177 m_top_line = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
178 m_top_line->SetBackgroundColour(wxColour(166, 169, 170));
179
180 m_sizer_main->Add(m_top_line, 0, wxEXPAND, 0);
181 m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(24));
182
183 if (!m_adaptive) {
184 m_simplebook = new wxSimplebook(this, wxID_ANY, wxDefaultPosition, PROGRESSDIALOG_SIMPLEBOOK_SIZE, 0);
185
186 m_panel_1line = new wxPanel(m_simplebook, wxID_ANY, wxDefaultPosition, PROGRESSDIALOG_SIMPLEBOOK_SIZE, 0);
188 m_panel_1line->SetBackgroundColour(PROGRESSDIALOG_DEF_BK);
189 m_simplebook->AddPage(m_panel_1line, wxEmptyString, false);
190
191 m_panel_2line = new wxPanel(m_simplebook, wxID_ANY, wxDefaultPosition, PROGRESSDIALOG_SIMPLEBOOK_SIZE, 0);
193 m_panel_2line->SetBackgroundColour(PROGRESSDIALOG_DEF_BK);
194 m_simplebook->AddPage(m_panel_2line, wxEmptyString, false);
195
196 wxBoxSizer *sizer_1line = new wxBoxSizer(wxHORIZONTAL);
197 m_msg = new wxStaticText(m_panel_1line, wxID_ANY, wxEmptyString, wxDefaultPosition, PROGRESSDIALOG_SIMPLEBOOK_SIZE, 0);
198 m_msg->Wrap(-1);
199 m_msg->SetFont(::Label::Body_14);
200 m_msg->SetForegroundColour(PROGRESSDIALOG_GREY_700);
201 sizer_1line->Add(m_msg, 0, wxALIGN_CENTER, 0);
202 m_panel_1line->SetSizer(sizer_1line);
203 m_panel_1line->Layout();
204 sizer_1line->Fit(m_panel_1line);
205
206 wxBoxSizer *sizer_2line = new wxBoxSizer(wxVERTICAL);
207 m_msg_2line = new wxStaticText(m_panel_2line, wxID_ANY, wxEmptyString, wxDefaultPosition, PROGRESSDIALOG_SIMPLEBOOK_SIZE, 0);
210 m_msg_2line->SetForegroundColour(PROGRESSDIALOG_GREY_700);
211 m_msg_2line->SetMaxSize(wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x, -1));
212 sizer_2line->Add(m_msg_2line, 1, wxALL, 0);
213 m_panel_2line->SetSizer(sizer_2line);
214 m_panel_2line->Layout();
215 sizer_2line->Fit(m_panel_2line);
216
217 m_sizer_main->Add(m_simplebook, 1, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(28));
218 } else {
219 m_msg_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
220 m_msg_scrolledWindow->SetScrollRate(0, FromDIP(20));
221 wxBoxSizer* m_msg_sizer= new wxBoxSizer(wxVERTICAL);
222
223 m_msg = new wxStaticText(m_msg_scrolledWindow, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x, -1), 0);
225 m_msg->SetFont(::Label::Body_14);
226 m_msg->SetForegroundColour(PROGRESSDIALOG_GREY_700);
227
228 m_msg_sizer->Add(m_msg, 0, wxEXPAND | wxALL, 0);
229 m_msg_scrolledWindow->SetSizer(m_msg_sizer);
230 m_msg_scrolledWindow->Layout();
231 m_msg_sizer->Fit(m_msg_scrolledWindow);
232 m_sizer_main->Add(m_msg_scrolledWindow, 0, wxEXPAND | wxALL, FromDIP(28));
233 }
234
235
236 m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, 0);
237
238 int gauge_style = wxGA_HORIZONTAL;
239 if (style & wxPD_SMOOTH) gauge_style |= wxGA_SMOOTH;
240 gauge_style |= wxGA_PROGRESS;
241
242#ifdef __WXMSW__
243 maximum /= m_factor;
244#endif
245
247 m_gauge = new wxGauge(this, wxID_ANY, maximum, wxDefaultPosition, PROGRESSDIALOG_GAUGE_SIZE, gauge_style);
248#ifdef __WXGTK__
249 SetGaugeColor(m_gauge,
250 StateColor::darkModeColorFor(wxColour("#009688")).GetAsString(),
251 StateColor::darkModeColorFor(wxColour("#D9D9D9")).GetAsString()
252 );
253 m_gauge->SetValue(0);
254#else
255 m_gauge->Pulse(); // colors not applied without this. probably it switches to a dc painted version of progressbar
256 m_gauge->SetValue(0);
257 m_gauge->SetForegroundColour(wxColour("#009688"));
258 m_gauge->SetBackgroundColour(wxColour("#D9D9D9"));
259 wxGetApp().UpdateDarkUI(m_gauge);
260#endif
261 m_sizer_main->Add(m_gauge, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(28));
262 }
263
264 // Optional elapsed/estimated/remaining time labels, created only when the
265 // caller opts in via the wxPD_*_TIME style flags (so callers that don't set
266 // them are unaffected). Update()/Pulse() already refresh these once non-null.
267 if (HasPDFlag(wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME)) {
268 wxFlexGridSizer *sizer_times = new wxFlexGridSizer(2, FromDIP(2), FromDIP(8));
269 if (HasPDFlag(wxPD_ELAPSED_TIME)) m_elapsed = CreateLabel(GetElapsedLabel(), sizer_times);
270 if (HasPDFlag(wxPD_ESTIMATED_TIME)) m_estimated = CreateLabel(GetEstimatedLabel(), sizer_times);
271 if (HasPDFlag(wxPD_REMAINING_TIME)) m_remaining = CreateLabel(GetRemainingLabel(), sizer_times);
272 m_sizer_main->Add(sizer_times, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP | wxLEFT | wxRIGHT, FromDIP(12));
273 }
274
275#ifdef __WXMSW__
276 //m_block_left = new wxWindow(m_gauge, wxID_ANY, wxPoint(0, 0), wxSize(FromDIP(2), PROGRESSDIALOG_GAUGE_SIZE.y * 2));
277 //m_block_left->SetBackgroundColour(PROGRESSDIALOG_DEF_BK);
278 //m_block_right = new wxWindow(m_gauge, wxID_ANY, wxPoint(PROGRESSDIALOG_GAUGE_SIZE.x - 2, 0), wxSize(FromDIP(2), PROGRESSDIALOG_GAUGE_SIZE.y * 2));
279 //m_block_right->SetBackgroundColour(PROGRESSDIALOG_DEF_BK);
280#endif
281 wxBoxSizer *m_sizer_bottom = new wxBoxSizer(wxHORIZONTAL);
282
283 m_sizer_bottom->Add(0, 0, 1, wxEXPAND, 0);
284
285 if (HasPDFlag(wxPD_CAN_ABORT)) {
286 m_button_cancel = new Button(this, _L("Cancel"));
288 m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &event) {
289 if (m_state == Finished) {
290 event.Skip();
291 } else {
293 DisableAbort();
294 m_button_cancel->Enable(false);
295 DisableSkip();
296 OnCancel();
297 m_timeStop = wxGetCurrentTime();
298 }
299 });
300 m_sizer_bottom->Add(m_button_cancel, 0, wxALL, 0);
301 }
302
303 m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(16));
304 m_sizer_main->Add(m_sizer_bottom, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(28));
305 m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(10));
306
307 wxGetApp().UpdateDlgDarkUI(this);
308
309 SetSizer(m_sizer_main);
310 Layout();
311 Fit();
312 Centre(wxCENTER_FRAME | wxBOTH);
314 FormatString(message);
315
316 Show();
317 Enable();
318 if (m_elapsed) { SetTimeLabel(0, m_elapsed); }
319
320 Update();
321 return true;
322
323 //
324 // sizerTop = new wxBoxSizer(wxVERTICAL);
325 // auto def_size_width = wxMin(wxGetClientDisplayRect().width / 3, 305);
326 //
327 // wxStaticLine *m_staticline2 = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxSize(def_size_width, 1), wxLI_HORIZONTAL);
328 // sizerTop->Add(m_staticline2, 0, wxEXPAND, 0);
329 // auto m_block_top = new wxWindow(this, wxID_ANY, wxDefaultPosition, wxSize(def_size_width, 20));
330 // m_block_top->SetBackgroundColour(wxColor(DESIGN_RESOUTION_DEF_BK_COLOR));
331 // sizerTop->Add(m_block_top, 0, wxEXPAND);
332 //
333 // m_message_area = new wxWindow(this, wxID_ANY, wxDefaultPosition, wxSize(def_size_width, 38));
334 // m_message_area->SetBackgroundColour(DESIGN_RESOUTION_DEF_BK_COLOR);
335 // sizerTop->Add(m_message_area, 0, wxLEFT | wxRIGHT | wxBottom | wxEXPAND, 2 * LAYOUT_MARGIN);
336 //
337 // m_msg = new wxStaticText(m_message_area, wxID_ANY, wxString(""), wxPoint(0, 10), wxSize(def_size_width, 20), wxST_ELLIPSIZE_END);
338 // m_msg->SetForegroundColour(wxColour(107, 107, 107));
339 // m_msg->SetBackgroundColour(DESIGN_RESOUTION_DEF_BK_COLOR);
340 // m_msg->SetMinSize(wxSize(def_size_width, 20));
341 // m_msg->SetMaxSize(wxSize(def_size_width, 20));
342 //
343 // m_msg_2line = new wxStaticText(m_message_area, wxID_ANY, wxString(""), wxPoint(0, 0), wxSize(def_size_width, 40), wxST_ELLIPSIZE_END);
344 // m_msg_2line->SetForegroundColour(wxColour(107, 107, 107));
345 // m_msg_2line->SetBackgroundColour(DESIGN_RESOUTION_DEF_BK_COLOR);
346 // m_msg_2line->SetMinSize(wxSize(def_size_width, 40));
347 // m_msg_2line->SetMaxSize(wxSize(def_size_width, 40));
348 //
349 // auto block_left = new wxWindow(m_gauge, -1, wxPoint(0, 0), wxSize(2, m_gauge->GetSize().GetHeight()));
350 // block_left->SetBackgroundColour(wxColor(255, 255, 255));
351 //
352 // auto block_right = new wxWindow(m_gauge, -1, wxPoint(m_gauge->GetSize().GetWidth() - 2, 0), wxSize(2, m_gauge->GetSize().GetHeight()));
353 // block_right->SetBackgroundColour(wxColor(255, 255, 255));
354 //
355 // sizerTop->Add(m_gauge, 0, wxLEFT | wxRIGHT | wxBottom, 2 * LAYOUT_MARGIN);
356 // m_gauge->SetValue(0);
357 //
358 // m_elapsed = m_estimated = m_remaining = NULL;
359 // size_t nTimeLabels = 0;
360 //
361 // wxSizer *const sizerLabels = new wxFlexGridSizer(2);
362 //
363 // if (style & wxPD_ELAPSED_TIME) {
364 // nTimeLabels++;
365 //
366 // m_elapsed = CreateLabel(GetElapsedLabel(), sizerLabels);
367 // }
368 //
369 // if (style & wxPD_ESTIMATED_TIME) {
370 // nTimeLabels++;
371 //
372 // m_estimated = CreateLabel(GetEstimatedLabel(), sizerLabels);
373 // }
374 //
375 // if (style & wxPD_REMAINING_TIME) {
376 // nTimeLabels++;
377 //
378 // m_remaining = CreateLabel(GetRemainingLabel(), sizerLabels);
379 // }
380 // sizerTop->Add(sizerLabels, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP | wxBottom, LAYOUT_MARGIN);
381 //
382 // wxStdDialogButtonSizer *buttonSizer = wxDialog::CreateStdDialogButtonSizer(0);
383 //
384 // const int borderFlags = wxALL;
385 //
386 // std::string icon_path = (boost::format("%1%/images/common_dialog_confirm.png") % resources_dir()).str();
387 // /*m_btnAbort = new wxBitmapButton(this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize(52, 24), wxBU_AUTODRAW | wxBORDER_NONE);
388 // m_btnAbort->SetBitmap(wxBitmap(icon_path, wxBITMAP_TYPE_ANY));
389 // m_btnAbort->SetBitmapDisabled(wxBitmap(icon_path, wxBITMAP_TYPE_ANY));
390 // m_btnAbort->SetBitmapPressed(wxBitmap(icon_path, wxBITMAP_TYPE_ANY));
391 // m_btnAbort->SetBitmapFocus(wxBitmap(icon_path, wxBITMAP_TYPE_ANY));
392 // m_btnAbort->SetBitmapCurrent(wxBitmap(icon_path, wxBITMAP_TYPE_ANY));*/
393 //
394 // m_btnAbort = new wxButton(this, wxID_CANCEL, wxString(""), wxDefaultPosition, wxSize(52,24));
395 //
396 // wxStaticBitmap *m_bitmatAbort = new wxStaticBitmap(m_btnAbort, wxID_ANY, wxBitmap(icon_path, wxBITMAP_TYPE_ANY), wxDefaultPosition, wxSize(52, 24), 0);
397 // wxStaticText *textAbort = new wxStaticText(m_btnAbort, wxID_ANY, _T("Cancel"), wxPoint(5, 3), wxSize(42, 19));
398 // textAbort->SetBa
399 // ckgroundColour(wxColor(0, 150, 136));
400 // textAbort->SetForegroundColour(DESIGN_RESOUTION_DEF_BK_COLOR);
401 //
402 // textAbort->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &event) {
403 // if (m_state == Finished) {
404 // event.Skip();
405 // } else {
406 // m_state = Canceled;
407 // //DisableAbort();
408 // DisableSkip();
409 // m_timeStop = wxGetCurrentTime();
410 // }
411 // });
412 //
413 // wxSizerFlags sizerFlags = wxSizerFlags().Border(borderFlags, LAYOUT_MARGIN);
414 // wxWindow *m_button_sizer = new wxWindow(this, wxID_ANY, wxDefaultPosition, wxSize(def_size_width, 26));
415 // m_button_sizer->SetBackgroundColour(DESIGN_RESOUTION_DEF_BK_COLOR);
416 //
417 // if (HasPDFlag(wxPD_CAN_SKIP)) {
418 // m_btnSkip = new wxButton(this, wxID_SKIP, wxGetTranslation("&Skip"));
419 // m_btnSkip->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ProgressDialog::OnSkip, this);
420 // buttonSizer->SetNegativeButton(m_btnSkip);
421 // }
422 //
423 // if (HasPDFlag(wxPD_CAN_ABORT)) {
424 // /*m_btnAbort = new wxButton(this, wxID_CANCEL);
425 // buttonSizer->SetCancelButton(m_btnAbort);
426 // m_btnAbort->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ProgressDialog::OnCancel, this);*/
427 //
428 // m_button_calcel = new Button(m_button_sizer, _T("Cancel"));
429 // m_button_calcel->SetTextColor(wxColour(107, 107, 107));
430 // m_button_calcel->SetSize(60, 24);
431 // m_button_calcel->SetPosition(wxPoint(m_button_sizer->GetSize().GetWidth() - m_button_calcel->GetSize().GetWidth(), 0));
432 //
433 // m_button_calcel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &event) {
434 // if (m_state == Finished) {
435 // event.Skip();
436 // } else {
437 // m_state = Canceled;
438 // DisableAbort();
439 // m_button_calcel->Enable(false);
440 // DisableSkip();
441 // m_timeStop = wxGetCurrentTime();
442 // }
443 // });
444 // }
445 //
446 // if (!HasPDFlag(wxPD_CAN_SKIP | wxPD_CAN_ABORT)) buttonSizer->AddSpacer(LAYOUT_MARGIN);
447 //
448 // sizerTop->Add(m_button_sizer, 1, wxEXPAND, 0);
449 //
450 // auto m_block_bottom = new wxWindow(this, wxID_ANY, wxDefaultPosition, wxSize(def_size_width, 15));
451 // m_block_bottom->SetBackgroundColour(DESIGN_RESOUTION_DEF_BK_COLOR);
452 // sizerTop->Add(m_block_bottom, 0, wxEXPAND);
453 //
454 // SetSizerAndFit(sizerTop);
455 // FormatString(message);
456 //
457 // Centre(wxCENTER_FRAME | wxBOTH);
458 //
459 // DisableOtherWindows();
460 //
461 // Show();
462 // Enable();
463 // if (m_elapsed) { SetTimeLabel(0, m_elapsed); }
464 //
465 // Update();
466 // return true;
467}
@ Regular
Definition Button.hpp:24
@ Choice
Definition Button.hpp:33
#define _L(s)
Definition OBJ.cpp:34
#define PROGRESSDIALOG_GREY_700
Definition ProgressDialog.hpp:37
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
class WXDLLIMPEXP_FWD_CORE wxGauge
Definition ProgressDialog.hpp:29
#define PROGRESSDIALOG_DEF_BK
Definition ProgressDialog.hpp:36
#define PROGRESSDIALOG_GAUGE_SIZE
Definition ProgressDialog.hpp:34
#define PROGRESSDIALOG_SIMPLEBOOK_SIZE
Definition ProgressDialog.hpp:33
#define style
Definition WipeTowerDialog.cpp:101
static wxFont Body_14
Definition Label.hpp:53
bool HasPDFlag(int flag) const
Definition ProgressDialog.hpp:115
static void SetTimeLabel(unsigned long val, wxStaticText *label)
Definition ProgressDialog.cpp:762
void DisableOtherWindows()
Definition ProgressDialog.cpp:868
Button * m_button_cancel
Definition ProgressDialog.hpp:96
virtual void OnCancel()
Definition ProgressDialog.hpp:71
wxStaticText * m_remaining
Definition ProgressDialog.hpp:208
virtual bool Show(bool show=true) wxOVERRIDE
Definition ProgressDialog.cpp:705
wxScrolledWindow * m_msg_scrolledWindow
Definition ProgressDialog.hpp:99
bool m_adaptive
Definition ProgressDialog.hpp:90
wxGauge * m_gauge
Definition ProgressDialog.hpp:203
int m_pdStyle
Definition ProgressDialog.hpp:218
wxStaticText * CreateLabel(const wxString &text, wxSizer *sizer)
Definition ProgressDialog.cpp:529
unsigned long m_timeStop
Definition ProgressDialog.hpp:171
static wxString GetElapsedLabel()
Definition ProgressDialog.hpp:109
static wxString GetRemainingLabel()
Definition ProgressDialog.hpp:111
wxPanel * m_panel_1line
Definition ProgressDialog.hpp:95
wxStaticText * m_msg
Definition ProgressDialog.hpp:205
static wxString GetEstimatedLabel()
Definition ProgressDialog.hpp:110
void EnsureActiveEventLoopExists()
Definition ProgressDialog.cpp:521
wxStaticText * m_elapsed
Definition ProgressDialog.hpp:208
wxStaticText * m_estimated
Definition ProgressDialog.hpp:208
void SetTopParent(wxWindow *parent)
Definition ProgressDialog.cpp:102
wxPanel * m_panel_2line
Definition ProgressDialog.hpp:94
wxWindowRef m_parentTop
Definition ProgressDialog.hpp:212
wxStaticText * m_msg_2line
Definition ProgressDialog.hpp:206
wxSizer * m_sizer_main
Definition ProgressDialog.hpp:91
wxPanel * m_top_line
Definition ProgressDialog.hpp:92
virtual void Update() wxOVERRIDE
Definition ProgressDialog.hpp:74
void DisableAbort()
Definition ProgressDialog.hpp:200
State m_state
Definition ProgressDialog.hpp:157
void DisableSkip()
Definition ProgressDialog.hpp:199
void SetMaximum(int maximum)
Definition ProgressDialog.cpp:745
wxSimplebook * m_simplebook
Definition ProgressDialog.hpp:93
wxString FormatString(wxString title)
Definition ProgressDialog.cpp:108
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219
wxMouseEvent
Definition CameraPopup.cpp:47
@ Enable
Definition Config.hpp:245

References _L, Label::Body_14, Canceled, Choice, Continue, CreateLabel(), StateColor::darkModeColorFor(), DisableAbort(), DisableOtherWindows(), DisableSkip(), Slic3r::Enable, EnsureActiveEventLoopExists(), Finished, FormatString(), GetElapsedLabel(), GetEstimatedLabel(), GetRemainingLabel(), HasPDFlag(), m_adaptive, m_button_cancel, m_elapsed, m_estimated, m_gauge, m_msg, m_msg_2line, m_msg_scrolledWindow, m_panel_1line, m_panel_2line, m_parentTop, m_pdStyle, m_remaining, m_simplebook, m_sizer_main, m_state, m_timeStop, m_top_line, OnCancel(), PROGRESSDIALOG_DEF_BK, PROGRESSDIALOG_GAUGE_SIZE, PROGRESSDIALOG_GREY_700, PROGRESSDIALOG_SIMPLEBOOK_SIZE, Regular, SetMaximum(), SetTimeLabel(), SetTopParent(), Show(), style, Uncancelable, Update(), wxGauge, Slic3r::GUI::wxMouseEvent, wxPD_NO_PROGRESS, and wxStaticText.

Referenced by ProgressDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateLabel()

wxStaticText * Slic3r::GUI::ProgressDialog::CreateLabel ( const wxString & text,
wxSizer * sizer )
privateinherited
530{
531 wxStaticText *label = new wxStaticText(this, wxID_ANY, text);
532 wxStaticText *value = new wxStaticText(this, wxID_ANY, _L("unknown"));
533
534 // Match the message label's look so the times theme with the rest of the
535 // dialog: PROGRESSDIALOG_GREY_700 is a key in the dark-mode colour map, so
536 // UpdateDlgDarkUI() (called at the end of Create()) remaps it in dark mode.
537 for (wxStaticText *st : {label, value}) {
538 st->SetFont(::Label::Body_13);
539 st->SetForegroundColour(PROGRESSDIALOG_GREY_700);
540 }
541
542 // select placement most native or nice on target GUI
543#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK20__)
544 // value and time centered in one row
545 sizer->Add(label, 1, wxALIGN_RIGHT | wxTOP | wxRIGHT, LAYOUT_MARGIN);
546 sizer->Add(value, 1, wxALIGN_LEFT | wxTOP, LAYOUT_MARGIN);
547#else
548 // value and time to the right in one row
549 sizer->Add(label);
550 sizer->Add(value, 0, wxLEFT, LAYOUT_MARGIN);
551#endif
552
553 return value;
554}
#define LAYOUT_MARGIN
Definition ProgressDialog.cpp:47
static wxFont Body_13
Definition Label.hpp:54

References _L, Label::Body_13, LAYOUT_MARGIN, PROGRESSDIALOG_GREY_700, and wxStaticText.

Referenced by Create().

Here is the caller graph for this function:

◆ DisableAbort()

void Slic3r::GUI::ProgressDialog::DisableAbort ( )
inlineprivateinherited
200{ EnableAbort(false); }
void EnableAbort(bool enable=true)
Definition ProgressDialog.cpp:908

References EnableAbort().

Referenced by Create(), OnCancel(), and OnClose().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DisableOtherWindows()

void Slic3r::GUI::ProgressDialog::DisableOtherWindows ( )
protectedinherited
869{
870 if (HasPDFlag(wxPD_APP_MODAL)) {
871#if defined(__WXOSX__)
872 if (m_parentTop) m_parentTop->Disable();
873 m_winDisabler = NULL;
874#else
876#endif
877 } else {
878 if (m_parentTop) m_parentTop->Disable();
879 m_winDisabler = NULL;
880 }
881
882}
class WXDLLIMPEXP_FWD_CORE wxWindowDisabler
Definition ProgressDialog.hpp:31
wxWindowDisabler * m_winDisabler
Definition ProgressDialog.hpp:241

References HasPDFlag(), m_parentTop, m_winDisabler, and wxWindowDisabler.

Referenced by Create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DisableSkip()

void Slic3r::GUI::ProgressDialog::DisableSkip ( )
inlineprivateinherited
199{ EnableSkip(false); }
void EnableSkip(bool enable=true)
Definition ProgressDialog.cpp:901

References EnableSkip().

Referenced by Create(), OnCancel(), OnClose(), OnSkip(), and Update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoAfterUpdate()

void Slic3r::GUI::ProgressDialog::DoAfterUpdate ( )
privateinherited
686{
687 // allow the window to repaint:
688 // NOTE: since we yield only for UI events with this call, there
689 // should be no side-effects
690 wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI | wxEVT_CATEGORY_USER_INPUT);
691}

Referenced by Pulse(), and Update().

Here is the caller graph for this function:

◆ DoBeforeUpdate()

bool Slic3r::GUI::ProgressDialog::DoBeforeUpdate ( bool * skip)
privateinherited
667{
668 // we have to yield because not only we want to update the display but
669 // also to process the clicks on the cancel and skip buttons
670 // NOTE: using YieldFor() this call shouldn't give re-entrancy problems
671 // for event handlers not interested to UI/user-input events.
672 wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI | wxEVT_CATEGORY_USER_INPUT);
673
674 Update();
675
676 if (m_skip && skip && !*skip) {
677 *skip = true;
678 m_skip = false;
679 EnableSkip();
680 }
681
682 return m_state != Canceled;
683}
bool m_skip
Definition ProgressDialog.hpp:221

References Canceled, EnableSkip(), m_skip, m_state, and Update().

Referenced by Pulse(), and Update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoSetSize()

void Slic3r::GUI::ProgressDialog::DoSetSize ( int x,
int y,
int width,
int height,
int sizeFlags = wxSIZE_AUTO )
overridevirtualinherited
856{
857 //if (m_button_cancel != nullptr) { m_button_cancel->SetMinSize(PROGRESSDIALOG_CANCEL_BUTTON_SIZE); }
858
859#ifdef __WXMSW__
860 //if (m_block_left != nullptr && m_block_right != nullptr) {
861 // m_block_left->SetPosition(wxPoint(0, 0));
862 // m_block_right->SetPosition(wxPoint(PROGRESSDIALOG_GAUGE_SIZE.x - 2, 0));
863 //}
864#endif
865 wxDialog::DoSetSize(x, y, width, height, sizeFlags);
866}

◆ EnableAbort()

void Slic3r::GUI::ProgressDialog::EnableAbort ( bool enable = true)
privateinherited
909{
910 if (HasPDFlag(wxPD_CAN_ABORT)) {
911 if (m_btnAbort) m_btnAbort->Enable(enable);
912 }
913}
wxButton * m_btnAbort
Definition ProgressDialog.hpp:224

References HasPDFlag(), and m_btnAbort.

Referenced by DisableAbort(), and Resume().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnableClose()

void Slic3r::GUI::ProgressDialog::EnableClose ( )
privateinherited
916{
917 if (HasPDFlag(wxPD_CAN_ABORT)) {
918 if (m_btnAbort) {
919 m_btnAbort->Enable();
920 m_btnAbort->SetLabel(wxGetTranslation("Close"));
921 }
922 }
923}

References HasPDFlag(), and m_btnAbort.

Referenced by Update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnableSkip()

void Slic3r::GUI::ProgressDialog::EnableSkip ( bool enable = true)
privateinherited
902{
903 if (HasPDFlag(wxPD_CAN_SKIP)) {
904 if (m_btnSkip) m_btnSkip->Enable(enable);
905 }
906}
wxButton * m_btnSkip
Definition ProgressDialog.hpp:225

References HasPDFlag(), and m_btnSkip.

Referenced by DisableSkip(), DoBeforeUpdate(), and Resume().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnsureActiveEventLoopExists()

void Slic3r::GUI::ProgressDialog::EnsureActiveEventLoopExists ( )
protectedinherited
522{
523 if (!wxEventLoopBase::GetActive()) {
525 wxEventLoop::SetActive(m_tempEventLoop);
526 }
527}
class WXDLLIMPEXP_FWD_CORE wxEventLoop
Definition ProgressDialog.hpp:28
wxEventLoop * m_tempEventLoop
Definition ProgressDialog.hpp:245

References m_tempEventLoop, and wxEventLoop.

Referenced by Create().

Here is the caller graph for this function:

◆ FormatString()

wxString Slic3r::GUI::ProgressDialog::FormatString ( wxString title)
protectedinherited
109{
110 if (!m_adaptive) {
111 auto current_width = 0;
112 m_mode = 0;
113 for (int i = 0; i < title.length(); i++) {
114 current_width = m_msg->GetTextExtent(title.SubString(0, i)).x;
115 if (current_width > PROGRESSDIALOG_GAUGE_SIZE.x) {
116 m_mode = 1;
117 // title.insert(i - 1, "\n");
118 break;
119 }
120 }
121 // set mode
122 if (m_mode == 0) {
123 m_simplebook->SetSelection(0);
124 m_msg->SetLabel(title);
125 } else {
126 wxSize content_size = m_msg->GetTextExtent(title);
127 int resized_height = (int(content_size.x / PROGRESSDIALOG_GAUGE_SIZE.x) + 1) * content_size.y;
128 set_panel_height(resized_height);
129 m_simplebook->SetSelection(1);
130 m_msg_2line->SetLabel(title);
131 }
132 } else {
133 m_msg->SetLabel(title);
134 m_msg->SetMaxSize(wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x + 5, -1));
135 m_msg->SetMinSize(wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x + 5, -1));
137 m_msg->Layout();
138 m_msg->Fit();
139
140 m_msg_scrolledWindow->SetSize(wxSize(FromDIP(m_msg->GetSize().x + 5), FromDIP(150)));
141 m_msg_scrolledWindow->SetMinSize(wxSize(FromDIP(m_msg->GetSize().x + 5), FromDIP(150)));
142 m_msg_scrolledWindow->SetMaxSize(wxSize(FromDIP(m_msg->GetSize().x + 5), FromDIP(150)));
143 // m_msg_scrolledWindow->Layout();
145 }
146
147
148 //Fit();
149 return title;
150}
int m_mode
Definition ProgressDialog.hpp:88
void set_panel_height(int height)
Definition ProgressDialog.cpp:736

References m_adaptive, m_mode, m_msg, m_msg_2line, m_msg_scrolledWindow, m_simplebook, PROGRESSDIALOG_GAUGE_SIZE, PROGRESSDIALOG_SIMPLEBOOK_SIZE, and set_panel_height().

Referenced by Create(), and UpdateMessage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetElapsedLabel()

wxString Slic3r::GUI::ProgressDialog::GetElapsedLabel ( )
inlinestaticprotectedinherited
109{ return _L("Elapsed time:"); }

References _L.

Referenced by Create().

Here is the caller graph for this function:

◆ GetEstimatedLabel()

wxString Slic3r::GUI::ProgressDialog::GetEstimatedLabel ( )
inlinestaticprotectedinherited
110{ return _L("Estimated time:"); }

References _L.

Referenced by Create().

Here is the caller graph for this function:

◆ GetFormattedTime()

wxString Slic3r::GUI::ProgressDialog::GetFormattedTime ( unsigned long timeInSec)
staticprotectedinherited
506{
507 wxString timeAsHMS;
508
509 if (timeInSec == (unsigned long) -1) {
510 timeAsHMS = wxGetTranslation("Unknown");
511 } else {
512 unsigned hours = timeInSec / 3600;
513 unsigned minutes = (timeInSec % 3600) / 60;
514 unsigned seconds = timeInSec % 60;
515 timeAsHMS.Printf("%u:%02u:%02u", hours, minutes, seconds);
516 }
517
518 return timeAsHMS;
519}

Referenced by SetTimeLabel().

Here is the caller graph for this function:

◆ GetMessage()

wxString Slic3r::GUI::ProgressDialog::GetMessage ( ) const
virtualinherited
723{ return m_msg->GetLabel(); }

References m_msg.

◆ GetPDStyle()

int Slic3r::GUI::ProgressDialog::GetPDStyle ( ) const
inlineprotectedinherited
118{ return m_pdStyle; }

References m_pdStyle.

◆ GetRange()

int Slic3r::GUI::ProgressDialog::GetRange ( ) const
virtualinherited
721{ return m_maximum; }
int m_maximum
Definition ProgressDialog.hpp:160

References m_maximum.

◆ GetRemainingLabel()

wxString Slic3r::GUI::ProgressDialog::GetRemainingLabel ( )
inlinestaticprotectedinherited
111{ return _L("Remaining time:"); }

References _L.

Referenced by Create().

Here is the caller graph for this function:

◆ GetTopParent()

wxWindow * Slic3r::GUI::ProgressDialog::GetTopParent ( ) const
inlineprotectedinherited
154{ return m_parentTop; }

References m_parentTop.

◆ GetValue()

int Slic3r::GUI::ProgressDialog::GetValue ( ) const
virtualinherited
715{
716 wxCHECK_MSG(m_gauge, -1, "dialog should be fully created");
717
718 return m_gauge->GetValue();
719}

References m_gauge.

◆ HasPDFlag()

bool Slic3r::GUI::ProgressDialog::HasPDFlag ( int flag) const
inlineprotectedinherited
115{ return (m_pdStyle & flag) != 0; }

References m_pdStyle.

Referenced by Create(), DisableOtherWindows(), EnableAbort(), EnableClose(), EnableSkip(), ReenableOtherWindows(), Update(), WasCancelled(), and WasSkipped().

Here is the caller graph for this function:

◆ Init()

void Slic3r::GUI::ProgressDialog::Init ( )
privateinherited
53{
54 // we may disappear at any moment, let the others know about it
55 SetExtraStyle(GetExtraStyle() | wxWS_EX_TRANSIENT);
56
57 // Initialize all our members that we always use (even when we don't
58 // create a valid window in this class).
59
60 m_pdStyle = 0;
61 m_parentTop = NULL;
62
63 m_gauge = NULL;
64 m_msg = NULL;
66
68 m_maximum = 0;
69
70 m_timeStart = wxGetCurrentTime();
71 m_timeStop = (unsigned long) -1;
72 m_break = 0;
73
74 m_skip = false;
75
76 m_btnAbort = NULL;
77 m_btnSkip = NULL;
78
80
81 m_delay = 3;
82
83 m_winDisabler = NULL;
84 m_tempEventLoop = NULL;
85
86 SetWindowStyle(wxDEFAULT_DIALOG_STYLE);
87}
unsigned long m_break
Definition ProgressDialog.hpp:173
unsigned long m_timeStart
Definition ProgressDialog.hpp:169
unsigned long m_display_estimated
Definition ProgressDialog.hpp:238
int m_delay
Definition ProgressDialog.hpp:234
unsigned long m_last_timeupdate
Definition ProgressDialog.hpp:229
int m_ctdelay
Definition ProgressDialog.hpp:237

References m_break, m_btnAbort, m_btnSkip, m_ctdelay, m_delay, m_display_estimated, m_elapsed, m_estimated, m_gauge, m_last_timeupdate, m_maximum, m_msg, m_parentTop, m_pdStyle, m_remaining, m_skip, m_state, m_tempEventLoop, m_timeStart, m_timeStop, m_winDisabler, and Uncancelable.

Referenced by ProgressDialog(), and ProgressDialog().

Here is the caller graph for this function:

◆ OnCancel() [1/2]

void Slic3r::GUI::MediaProgressDialog::OnCancel ( )
inlineoverridevirtual

Reimplemented from Slic3r::GUI::ProgressDialog.

560{m_cancel(); }

References m_cancel.

◆ OnCancel() [2/2]

void Slic3r::GUI::ProgressDialog::OnCancel ( wxCommandEvent & event)
protectedinherited
782{
783 if (m_state == Finished) {
784 // this means that the count down is already finished and we're being
785 // shown as a modal dialog - so just let the default handler do the job
786 event.Skip();
787 } else {
788 // request to cancel was received, the next time Update() is called we
789 // will handle it
791
792 // update the buttons state immediately so that the user knows that the
793 // request has been noticed
794 DisableAbort();
795 DisableSkip();
796
797 OnCancel();
798
799 // save the time when the dialog was stopped
800 m_timeStop = wxGetCurrentTime();
801 }
802}

References Canceled, DisableAbort(), DisableSkip(), Finished, m_state, m_timeStop, and OnCancel().

Here is the call graph for this function:

◆ OnClose()

void Slic3r::GUI::ProgressDialog::OnClose ( wxCloseEvent & event)
protectedinherited
811{
812 if (m_state == Uncancelable) {
813 // can't close this dialog
814 event.Veto();
815 } else if (m_state == Finished) {
816 // let the default handler close the window as we already terminated
817 event.Skip();
818 } else {
819 // next Update() will notice it
821 DisableAbort();
822 DisableSkip();
823 OnCancel();
824
825 m_timeStop = wxGetCurrentTime();
826 }
827}

References Canceled, DisableAbort(), DisableSkip(), Finished, m_state, m_timeStop, OnCancel(), and Uncancelable.

Referenced by ProgressDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPaint()

void Slic3r::GUI::ProgressDialog::OnPaint ( wxPaintEvent & evt)
inherited
100{}

Referenced by ProgressDialog().

Here is the caller graph for this function:

◆ OnSkip()

void Slic3r::GUI::ProgressDialog::OnSkip ( wxCommandEvent & )
protectedinherited
805{
806 DisableSkip();
807 m_skip = true;
808}

References DisableSkip(), and m_skip.

Here is the call graph for this function:

◆ Pulse()

bool Slic3r::GUI::ProgressDialog::Pulse ( const wxString & newmsg = wxEmptyString,
bool * skip = NULL )
virtualinherited
641{
642 if (!DoBeforeUpdate(skip)) return false;
643
644 wxCHECK_MSG(m_msg || m_gauge, false, "dialog should be fully created");
645
646 // show a bit of progress
647 if (m_gauge) m_gauge->Pulse();
648
649 UpdateMessage(newmsg);
650
652 unsigned long elapsed = wxGetCurrentTime() - m_timeStart;
653
654 SetTimeLabel(elapsed, m_elapsed);
655 SetTimeLabel((unsigned long) -1, m_estimated);
656 SetTimeLabel((unsigned long) -1, m_remaining);
657 }
658
660
661 return m_state != Canceled;
662}
void DoAfterUpdate()
Definition ProgressDialog.cpp:685
void UpdateMessage(const wxString &newmsg)
Definition ProgressDialog.cpp:925
bool DoBeforeUpdate(bool *skip)
Definition ProgressDialog.cpp:666

References Canceled, DoAfterUpdate(), DoBeforeUpdate(), m_elapsed, m_estimated, m_gauge, m_msg, m_remaining, m_state, m_timeStart, SetTimeLabel(), and UpdateMessage().

Referenced by Slic3r::GUI::PluginProgressDialog::on_timer(), Slic3r::GUI::PluginProgressDialog::pulse(), and Slic3r::GUI::GUI_App::recreate_GUI().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReenableOtherWindows()

void Slic3r::GUI::ProgressDialog::ReenableOtherWindows ( )
protectedinherited
885{
886 if (HasPDFlag(wxPD_APP_MODAL)) {
887#if defined(__WXOSX__)
888 if (m_parentTop) m_parentTop->Enable();
889#else
890 wxDELETE(m_winDisabler);
891#endif
892 } else {
893 if (m_parentTop) m_parentTop->Enable();
894 }
895}

References HasPDFlag(), m_parentTop, and m_winDisabler.

Referenced by ~ProgressDialog(), Show(), and Update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Resume()

void Slic3r::GUI::ProgressDialog::Resume ( )
virtualinherited
694{
696 m_ctdelay = m_delay; // force an update of the elapsed/estimated/remaining time
697 m_break += wxGetCurrentTime() - m_timeStop;
698
699 EnableAbort();
700 m_button_cancel->Enable(true);
701 EnableSkip();
702 m_skip = false;
703}

References Continue, EnableAbort(), EnableSkip(), m_break, m_button_cancel, m_ctdelay, m_delay, m_skip, m_state, and m_timeStop.

Here is the call graph for this function:

◆ set_panel_height()

void Slic3r::GUI::ProgressDialog::set_panel_height ( int height)
protectedinherited
736 {
737 m_simplebook->SetSize(wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x, height));
738 m_simplebook->SetMinSize(wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x, height));
739 m_panel_2line->SetSize(wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x, height));
740 m_panel_2line->SetMinSize(wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x, height));
741 m_msg_2line->SetSize(wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x, height));
742 m_msg_2line->SetMinSize(wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x, height));
743}

References m_msg_2line, m_panel_2line, m_simplebook, and PROGRESSDIALOG_SIMPLEBOOK_SIZE.

Referenced by FormatString().

Here is the caller graph for this function:

◆ SetMaximum()

void Slic3r::GUI::ProgressDialog::SetMaximum ( int maximum)
protectedinherited
746{
747 m_maximum = maximum;
748
749#if defined(__WXMSW__)
750 // we can't have values > 65,536 in the progress control under Windows, so
751 // scale everything down
752 m_factor = m_maximum / 65536 + 1;
753 m_maximum /= m_factor;
754#endif // __WXMSW__
755}

References m_maximum.

Referenced by Create(), and SetRange().

Here is the caller graph for this function:

◆ SetPDStyle()

void Slic3r::GUI::ProgressDialog::SetPDStyle ( int pdStyle)
inlineprotectedinherited
119{ m_pdStyle = pdStyle; }

References m_pdStyle.

◆ SetRange()

void Slic3r::GUI::ProgressDialog::SetRange ( int maximum)
virtualinherited
726{
727 wxCHECK_RET(m_gauge, "dialog should be fully created");
728
729 wxCHECK_RET(maximum > 0, "Invalid range");
730
731 m_gauge->SetRange(maximum);
732
733 SetMaximum(maximum);
734}

References m_gauge, and SetMaximum().

Here is the call graph for this function:

◆ SetTimeLabel()

void Slic3r::GUI::ProgressDialog::SetTimeLabel ( unsigned long val,
wxStaticText * label )
staticprivateinherited
763{
764 if (label) {
765 wxString s;
766
767 if (val != (unsigned long) -1) {
768 s = GetFormattedTime(val);
769 } else {
770 s = wxGetTranslation("Unknown");
771 }
772
773 if (s != label->GetLabel()) label->SetLabel(s);
774 }
775}
static wxString GetFormattedTime(unsigned long timeInSec)
Definition ProgressDialog.cpp:505

References GetFormattedTime(), and wxStaticText.

Referenced by Create(), Pulse(), and Update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTopParent()

void Slic3r::GUI::ProgressDialog::SetTopParent ( wxWindow * parent)
protectedinherited
103{
104 m_parent = parent;
105 m_parentTop = parent;
106}

References m_parentTop.

Referenced by Create().

Here is the caller graph for this function:

◆ Show()

bool Slic3r::GUI::ProgressDialog::Show ( bool show = true)
virtualinherited
706{
707 // reenable other windows before hiding this one because otherwise
708 // Windows wouldn't give the focus back to the window which had
709 // been previously focused because it would still be disabled
710 if (!show) ReenableOtherWindows();
711 return wxDialog::Show(show);
712}
void ReenableOtherWindows()
Definition ProgressDialog.cpp:884

References ReenableOtherWindows().

Referenced by Create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Update() [1/2]

virtual void Slic3r::GUI::ProgressDialog::Update ( )
inlinevirtualinherited
74{ wxDialog::Update(); }

Referenced by Create(), DoBeforeUpdate(), Update(), and Slic3r::GUI::PluginProgressDialog::update().

Here is the caller graph for this function:

◆ Update() [2/2]

bool Slic3r::GUI::ProgressDialog::Update ( int value,
const wxString & newmsg = wxEmptyString,
bool * skip = NULL )
virtualinherited
561{
562 if (!DoBeforeUpdate(skip)) return false;
563
564 wxCHECK_MSG(m_msg || m_gauge, false, "dialog should be fully created");
565
566#ifdef __WXMSW__
567 value /= m_factor;
568#endif // __WXMSW__
569
570 wxASSERT_MSG(value <= m_maximum, wxT("invalid progress value"));
571 if (m_gauge)
572 m_gauge->SetValue(value);
573
574 UpdateMessage(newmsg);
575
576 if ((m_elapsed || m_remaining || m_estimated) && (value != 0)) {
577 unsigned long elapsed;
578 unsigned long display_remaining;
579
580 UpdateTimeEstimates(value, elapsed, m_display_estimated, display_remaining);
581
582 SetTimeLabel(elapsed, m_elapsed);
584 SetTimeLabel(display_remaining, m_remaining);
585 }
586
587 if (value == m_maximum) {
588 if (m_state == Finished) {
589 // ignore multiple calls to Update(m_maximum): it may sometimes be
590 // troublesome to ensure that Update() is not called twice with the
591 // same value (e.g. because of the rounding errors) and if we don't
592 // return now we're going to generate asserts below
593 return true;
594 }
595
596 // so that we return true below and that out [Cancel] handler knew what
597 // to do
599 if (!HasPDFlag(wxPD_AUTO_HIDE)) {
600 EnableClose();
601 DisableSkip();
602#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
603 EnableCloseButton();
604#endif // __WXMSW__
605
606 if (newmsg.empty()) {
607 // also provide the finishing message if the application didn't
608 m_msg->SetLabel(_L("Done."));
609 }
610
611 // allow the window to repaint:
612 // NOTE: since we yield only for UI events with this call, there
613 // should be no side-effects
614 wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI | wxEVT_CATEGORY_USER_INPUT);
615
616 // NOTE: this call results in a new event loop being created
617 // and to a call to ProcessPendingEvents() (which may generate
618 // unwanted re-entrancies).
619 (void) ShowModal();
620 } else // auto hide
621 {
622 // reenable other windows before hiding this one because otherwise
623 // Windows wouldn't give the focus back to the window which had
624 // been previously focused because it would still be disabled
626
627 Hide();
628 }
629 } else // not at maximum yet
630 {
632 }
633
634 // update the display in case yielding above didn't do it
635 Update();
636
637 return m_state != Canceled;
638}
void EnableClose()
Definition ProgressDialog.cpp:915
void UpdateTimeEstimates(int value, unsigned long &elapsedTime, unsigned long &estimatedTime, unsigned long &remainingTime)
Definition ProgressDialog.cpp:469

References _L, Canceled, DisableSkip(), DoAfterUpdate(), DoBeforeUpdate(), EnableClose(), Finished, HasPDFlag(), m_display_estimated, m_elapsed, m_estimated, m_gauge, m_maximum, m_msg, m_remaining, m_state, ReenableOtherWindows(), SetTimeLabel(), Update(), UpdateMessage(), and UpdateTimeEstimates().

Referenced by Slic3r::GUI::MediaFilePanel::doAction(), Slic3r::fix_model_with_cgal_gui(), Slic3r::GUI::ObjectList::fix_through_cgal(), Slic3r::GUI::ScoreDialog::get_button_sizer(), Slic3r::GUI::Plater::import_model_id(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::GUI::ObjectList::load_modifier(), Slic3r::GUI::GUI_App::on_user_login_handle(), and Slic3r::GUI::GUI_App::recreate_GUI().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateMessage()

void Slic3r::GUI::ProgressDialog::UpdateMessage ( const wxString & newmsg)
privateinherited
926{
927 if (!newmsg.empty() && newmsg != m_msg->GetLabel()) {
928 const wxSize sizeOld = m_msg->GetSize();
929
930 FormatString(newmsg);
931 Fit();
932 // m_msg->SetLabel(newmsg);
933
934 if (m_msg->GetSize().x > sizeOld.x) {
935 // Resize the dialog to fit its new, longer contents instead of
936 // just truncating it.
937 Fit();
938 }
939
940 // allow the window to repaint:
941 // NOTE: since we yield only for UI events with this call, there
942 // should be no side-effects
943 wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI | wxEVT_CATEGORY_USER_INPUT);
944 }
945}

References FormatString(), and m_msg.

Referenced by Pulse(), and Update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateTimeEstimates()

void Slic3r::GUI::ProgressDialog::UpdateTimeEstimates ( int value,
unsigned long & elapsedTime,
unsigned long & estimatedTime,
unsigned long & remainingTime )
protectedinherited
470{
471 unsigned long elapsed = wxGetCurrentTime() - m_timeStart;
472 if (value != 0 && (m_last_timeupdate < elapsed || value == m_maximum)) {
473 m_last_timeupdate = elapsed;
474 unsigned long estimated = m_break + (unsigned long) (((double) (elapsed - m_break) * m_maximum) / ((double) value));
475 if (estimated > m_display_estimated && m_ctdelay >= 0) {
476 ++m_ctdelay;
477 } else if (estimated < m_display_estimated && m_ctdelay <= 0) {
478 --m_ctdelay;
479 } else {
480 m_ctdelay = 0;
481 }
482 if (m_ctdelay >= m_delay // enough confirmations for a higher value
483 || m_ctdelay <= (m_delay * -1) // enough confirmations for a lower value
484 || value == m_maximum // to stay consistent
485 || elapsed > m_display_estimated // to stay consistent
486 || (elapsed > 0 && elapsed < 4) // additional updates in the beginning
487 ) {
488 m_display_estimated = estimated;
489 m_ctdelay = 0;
490 }
491 }
492
493 if (value != 0) {
494 long display_remaining = m_display_estimated - elapsed;
495 if (display_remaining < 0) { display_remaining = 0; }
496
497 estimatedTime = m_display_estimated;
498 remainingTime = display_remaining;
499 }
500
501 elapsedTime = elapsed;
502}

References m_break, m_ctdelay, m_delay, m_display_estimated, m_last_timeupdate, m_maximum, and m_timeStart.

Referenced by Update().

Here is the caller graph for this function:

◆ WasCanceled()

bool Slic3r::GUI::ProgressDialog::WasCanceled ( ) const
inherited
664{ return m_state == Canceled; }

References Canceled, and m_state.

◆ WasCancelled()

bool Slic3r::GUI::ProgressDialog::WasCancelled ( ) const
virtualinherited
757{ return HasPDFlag(wxPD_CAN_ABORT) && m_state == Canceled; }

References Canceled, HasPDFlag(), and m_state.

Referenced by Slic3r::GUI::Plater::priv::load_files().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WasSkipped()

bool Slic3r::GUI::ProgressDialog::WasSkipped ( ) const
virtualinherited
759{ return HasPDFlag(wxPD_CAN_SKIP) && m_skip; }

References HasPDFlag(), and m_skip.

Here is the call graph for this function:

◆ wxDECLARE_NO_COPY_CLASS()

Slic3r::GUI::ProgressDialog::wxDECLARE_NO_COPY_CLASS ( ProgressDialog )
privateinherited

References ProgressDialog().

Here is the call graph for this function:

Member Data Documentation

◆ m_adaptive

bool Slic3r::GUI::ProgressDialog::m_adaptive = {false}
inherited
90{false};

Referenced by ProgressDialog(), Create(), and FormatString().

◆ m_break

unsigned long Slic3r::GUI::ProgressDialog::m_break
protectedinherited

Referenced by Init(), Resume(), and UpdateTimeEstimates().

◆ m_btnAbort

wxButton* Slic3r::GUI::ProgressDialog::m_btnAbort
privateinherited

Referenced by EnableAbort(), EnableClose(), and Init().

◆ m_btnSkip

wxButton* Slic3r::GUI::ProgressDialog::m_btnSkip
privateinherited

Referenced by EnableSkip(), and Init().

◆ m_button_cancel

Button* Slic3r::GUI::ProgressDialog::m_button_cancel = {nullptr}
inherited
96{nullptr};

Referenced by Create(), and Resume().

◆ m_cancel

std::function<void()> Slic3r::GUI::MediaProgressDialog::m_cancel

Referenced by MediaProgressDialog(), and OnCancel().

◆ m_ctdelay

int Slic3r::GUI::ProgressDialog::m_ctdelay
privateinherited

Referenced by Init(), Resume(), and UpdateTimeEstimates().

◆ m_delay

int Slic3r::GUI::ProgressDialog::m_delay
privateinherited

Referenced by Init(), Resume(), and UpdateTimeEstimates().

◆ m_display_estimated

unsigned long Slic3r::GUI::ProgressDialog::m_display_estimated
privateinherited

Referenced by Init(), Update(), and UpdateTimeEstimates().

◆ m_elapsed

wxStaticText* Slic3r::GUI::ProgressDialog::m_elapsed
privateinherited

Referenced by Create(), Init(), Pulse(), and Update().

◆ m_estimated

wxStaticText * Slic3r::GUI::ProgressDialog::m_estimated
privateinherited

Referenced by Create(), Init(), Pulse(), and Update().

◆ m_gauge

wxGauge* Slic3r::GUI::ProgressDialog::m_gauge
privateinherited

◆ m_last_timeupdate

unsigned long Slic3r::GUI::ProgressDialog::m_last_timeupdate
privateinherited

Referenced by Init(), and UpdateTimeEstimates().

◆ m_maximum

int Slic3r::GUI::ProgressDialog::m_maximum
protectedinherited

◆ m_mode

int Slic3r::GUI::ProgressDialog::m_mode = 0
inherited

Referenced by FormatString().

◆ m_msg

wxStaticText* Slic3r::GUI::ProgressDialog::m_msg
privateinherited

◆ m_msg_2line

wxStaticText* Slic3r::GUI::ProgressDialog::m_msg_2line
privateinherited

◆ m_msg_scrolledWindow

wxScrolledWindow* Slic3r::GUI::ProgressDialog::m_msg_scrolledWindow = {nullptr}
inherited
99{nullptr};

Referenced by Create(), and FormatString().

◆ m_panel_1line

wxPanel* Slic3r::GUI::ProgressDialog::m_panel_1line = {nullptr}
inherited
95{nullptr};

Referenced by Create().

◆ m_panel_2line

wxPanel* Slic3r::GUI::ProgressDialog::m_panel_2line = {nullptr}
inherited
94{nullptr};

Referenced by Create(), and set_panel_height().

◆ m_parentTop

wxWindowRef Slic3r::GUI::ProgressDialog::m_parentTop
privateinherited

◆ m_pdStyle

int Slic3r::GUI::ProgressDialog::m_pdStyle
privateinherited

◆ m_remaining

wxStaticText * Slic3r::GUI::ProgressDialog::m_remaining
privateinherited

Referenced by Create(), Init(), Pulse(), and Update().

◆ m_simplebook

wxSimplebook* Slic3r::GUI::ProgressDialog::m_simplebook = {nullptr}
inherited
93{nullptr};

Referenced by Create(), FormatString(), and set_panel_height().

◆ m_sizer_main

wxSizer* Slic3r::GUI::ProgressDialog::m_sizer_main = {nullptr}
inherited
91{nullptr};

Referenced by Create().

◆ m_skip

bool Slic3r::GUI::ProgressDialog::m_skip
privateinherited

◆ m_state

State Slic3r::GUI::ProgressDialog::m_state
protectedinherited

◆ m_tempEventLoop

wxEventLoop* Slic3r::GUI::ProgressDialog::m_tempEventLoop
privateinherited

◆ m_timeStart

unsigned long Slic3r::GUI::ProgressDialog::m_timeStart
protectedinherited

Referenced by Init(), Pulse(), and UpdateTimeEstimates().

◆ m_timeStop

unsigned long Slic3r::GUI::ProgressDialog::m_timeStop
protectedinherited

Referenced by Create(), Init(), OnCancel(), OnClose(), and Resume().

◆ m_top_line

wxPanel* Slic3r::GUI::ProgressDialog::m_top_line = {nullptr}
inherited
92{nullptr};

Referenced by Create().

◆ m_winDisabler

wxWindowDisabler* Slic3r::GUI::ProgressDialog::m_winDisabler
privateinherited

The documentation for this struct was generated from the following file: