OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::SliceInfoPanel Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/SliceInfoPanel.hpp>

Inheritance diagram for Slic3r::GUI::SliceInfoPanel:
Collaboration diagram for Slic3r::GUI::SliceInfoPanel:

Public Member Functions

 SliceInfoPanel (wxWindow *parent, wxBitmap &prediction, wxBitmap &cost, wxBitmap &print, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
 ~SliceInfoPanel ()
void SetImages (wxBitmap &prediction, wxBitmap &cost, wxBitmap &printing)
void on_subtask_print (wxCommandEvent &evt)
void on_thumbnail_enter (wxMouseEvent &event)
void on_thumbnail_leave (wxMouseEvent &event)
void on_mouse_enter (wxMouseEvent &event)
void on_mouse_leave (wxMouseEvent &event)
void on_webrequest_state (wxWebRequestEvent &evt)
void update (BBLSliceInfo *info)
void msw_rescale ()

Protected Attributes

wxWebRequest web_request
std::shared_ptr< ImageTransientPopup > m_thumbnail_popup
std::shared_ptr< SliceInfoPopup > m_slice_info_popup
wxImage m_thumbnail_img
wxBoxSizer * m_item_top_sizer
wxStaticBitmap * m_bmp_item_thumbnail
wxStaticBitmap * m_bmp_item_prediction
wxStaticBitmap * m_bmp_item_print
wxStaticText * m_text_item_prediction
wxStaticBitmap * m_bmp_item_cost
wxStaticText * m_text_item_cost
wxGridSizer * m_filament_info_sizer
wxStaticText * m_text_plate_index

Detailed Description

Constructor & Destructor Documentation

◆ SliceInfoPanel()

Slic3r::GUI::SliceInfoPanel::SliceInfoPanel ( wxWindow * parent,
wxBitmap & prediction,
wxBitmap & cost,
wxBitmap & print,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString & name = wxEmptyString )
193 : wxPanel(parent, id, pos, size, style, name)
194{
195 this->SetBackgroundColour(*wxWHITE);
196
197 m_item_top_sizer = new wxBoxSizer(wxHORIZONTAL);
198
199 m_bmp_item_thumbnail = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW | 0);
202
203 m_item_top_sizer->Add(m_bmp_item_thumbnail, 0, wxALL, 0);
204
205 wxBoxSizer *m_item_content_sizer;
206 m_item_content_sizer = new wxBoxSizer(wxVERTICAL);
207
208 wxBoxSizer *m_item_info_sizer = new wxBoxSizer(wxHORIZONTAL);
209
210 m_bmp_item_prediction = new wxStaticBitmap(this, wxID_ANY, prediction);
211 m_bmp_item_prediction->SetMinSize(ICON_SIZE);
213 m_item_info_sizer->Add(m_bmp_item_prediction, 0, wxALIGN_CENTER_VERTICAL | wxALL, FromDIP(5));
214
215 m_text_item_prediction = new wxStaticText(this, wxID_ANY, "", wxDefaultPosition, wxSize(FromDIP(60), -1));
216 m_text_item_prediction->Wrap(-1);
217 m_item_info_sizer->Add(m_text_item_prediction, 1, wxALIGN_CENTER_VERTICAL | wxALL, 0);
218
219 m_bmp_item_cost = new wxStaticBitmap(this, wxID_ANY, cost);
220 m_bmp_item_cost->SetMinSize(ICON_SIZE);
221 m_bmp_item_cost->SetSize(ICON_SIZE);
222 m_item_info_sizer->Add(m_bmp_item_cost, 0, wxALIGN_CENTER_VERTICAL | wxALL, FromDIP(5));
223
224 m_text_item_cost = new wxStaticText(this, wxID_ANY, "", wxDefaultPosition, wxSize(FromDIP(35), -1));
225 m_text_item_cost->Wrap(-1);
226 m_item_info_sizer->Add(m_text_item_cost, 1, wxALIGN_CENTER_VERTICAL | wxALL, 0);
227
228 m_item_content_sizer->Add(m_item_info_sizer, 0, wxEXPAND, 0);
229
230 wxGridSizer *m_filament_info_sizer = new wxGridSizer(0, 3, 0, 8);
231
232 m_item_content_sizer->Add(m_filament_info_sizer, 0, wxEXPAND, 0);
233
234 m_item_top_sizer->Add(m_item_content_sizer, 0, wxEXPAND, 0);
235
236 wxBoxSizer *m_item_right_sizer;
237 m_item_right_sizer = new wxBoxSizer(wxVERTICAL);
238
239 m_bmp_item_print = new wxStaticBitmap(this, wxID_ANY, print, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW | 0);
242 m_item_right_sizer->Add(m_bmp_item_print, 0, wxALL, FromDIP(5));
243
244 m_item_right_sizer->Add(0, 0, 1, wxEXPAND, FromDIP(5));
245
246 m_text_plate_index = new wxStaticText(this, wxID_ANY, "");
247 m_text_plate_index->Wrap(-1);
248 m_text_plate_index->SetForegroundColour(wxColour(107, 107, 107));
249 m_item_right_sizer->Add(m_text_plate_index, 0, wxALIGN_RIGHT | wxALL, FromDIP(5));
250
251 m_item_top_sizer->Add(m_item_right_sizer, 0, wxEXPAND, 0);
252
253 this->SetSizer(m_item_top_sizer);
254 this->Layout();
255
256 Bind(wxEVT_WEBREQUEST_STATE, &SliceInfoPanel::on_webrequest_state, this);
257
258 // Connect Events
259 m_bmp_item_thumbnail->Connect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(SliceInfoPanel::on_thumbnail_enter), NULL, this);
260 m_bmp_item_thumbnail->Connect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(SliceInfoPanel::on_thumbnail_leave), NULL, this);
261 m_bmp_item_print->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SliceInfoPanel::on_subtask_print), NULL, this);
262}
#define ICON_SIZE
Definition GUI_Utils.hpp:51
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
#define PRINT_ICON_SIZE
Definition SliceInfoPanel.cpp:33
#define style
Definition WipeTowerDialog.cpp:101
wxStaticBitmap * m_bmp_item_cost
Definition SliceInfoPanel.hpp:70
wxStaticText * m_text_item_prediction
Definition SliceInfoPanel.hpp:69
void on_thumbnail_enter(wxMouseEvent &event)
Definition SliceInfoPanel.cpp:284
wxStaticBitmap * m_bmp_item_thumbnail
Definition SliceInfoPanel.hpp:66
wxBoxSizer * m_item_top_sizer
Definition SliceInfoPanel.hpp:65
void on_webrequest_state(wxWebRequestEvent &evt)
Definition SliceInfoPanel.cpp:305
wxGridSizer * m_filament_info_sizer
Definition SliceInfoPanel.hpp:72
void on_thumbnail_leave(wxMouseEvent &event)
Definition SliceInfoPanel.cpp:296
void on_subtask_print(wxCommandEvent &evt)
Definition SliceInfoPanel.cpp:279
wxStaticBitmap * m_bmp_item_print
Definition SliceInfoPanel.hpp:68
wxStaticText * m_text_item_cost
Definition SliceInfoPanel.hpp:71
wxStaticBitmap * m_bmp_item_prediction
Definition SliceInfoPanel.hpp:67
wxStaticText * m_text_plate_index
Definition SliceInfoPanel.hpp:73
static std::vector< Vec2d > THUMBNAIL_SIZE
Definition ThumbnailData.hpp:14

References ICON_SIZE, m_bmp_item_cost, m_bmp_item_prediction, m_bmp_item_print, m_bmp_item_thumbnail, m_filament_info_sizer, m_item_top_sizer, m_text_item_cost, m_text_item_prediction, m_text_plate_index, on_subtask_print(), on_thumbnail_enter(), on_thumbnail_leave(), on_webrequest_state(), PRINT_ICON_SIZE, style, Slic3r::THUMBNAIL_SIZE, and wxStaticText.

Here is the call graph for this function:

◆ ~SliceInfoPanel()

Slic3r::GUI::SliceInfoPanel::~SliceInfoPanel ( )
265{
266 // Disconnect Events
267 m_bmp_item_thumbnail->Disconnect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(SliceInfoPanel::on_thumbnail_enter), NULL, this);
268 m_bmp_item_thumbnail->Disconnect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(SliceInfoPanel::on_thumbnail_leave), NULL, this);
269 m_bmp_item_print->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SliceInfoPanel::on_subtask_print), NULL, this);
270}

References m_bmp_item_print, m_bmp_item_thumbnail, on_subtask_print(), on_thumbnail_enter(), and on_thumbnail_leave().

Here is the call graph for this function:

Member Function Documentation

◆ msw_rescale()

void Slic3r::GUI::SliceInfoPanel::msw_rescale ( )
348{
349 m_bmp_item_prediction->SetMinSize(ICON_SIZE);
351 m_bmp_item_cost->SetMinSize(ICON_SIZE);
352 m_bmp_item_cost->SetSize(ICON_SIZE);
355 this->Layout();
356}

References ICON_SIZE, m_bmp_item_cost, m_bmp_item_prediction, m_bmp_item_print, and PRINT_ICON_SIZE.

◆ on_mouse_enter()

void Slic3r::GUI::SliceInfoPanel::on_mouse_enter ( wxMouseEvent & event)
301{ ; }

References Slic3r::GUI::wxMouseEvent.

◆ on_mouse_leave()

void Slic3r::GUI::SliceInfoPanel::on_mouse_leave ( wxMouseEvent & event)
303{ ; }

References Slic3r::GUI::wxMouseEvent.

◆ on_subtask_print()

void Slic3r::GUI::SliceInfoPanel::on_subtask_print ( wxCommandEvent & evt)
280{
281 ;
282}

Referenced by SliceInfoPanel(), and ~SliceInfoPanel().

Here is the caller graph for this function:

◆ on_thumbnail_enter()

void Slic3r::GUI::SliceInfoPanel::on_thumbnail_enter ( wxMouseEvent & event)
285{
286 /*
287 m_slice_info_popup = std::make_shared<SliceInfoPopup>(this);
288 wxWindow *ctrl = (wxWindow *) event.GetEventObject();
289 wxPoint pos = ctrl->ClientToScreen(wxPoint(0, 0));
290 wxSize sz = ctrl->GetSize();
291 m_slice_info_popup->Position(pos, sz);
292 m_slice_info_popup->Popup();
293 */
294}

References Slic3r::GUI::wxMouseEvent.

Referenced by SliceInfoPanel(), and ~SliceInfoPanel().

Here is the caller graph for this function:

◆ on_thumbnail_leave()

void Slic3r::GUI::SliceInfoPanel::on_thumbnail_leave ( wxMouseEvent & event)
297{
298 if (m_thumbnail_popup) { m_thumbnail_popup->Hide(); }
299}
std::shared_ptr< ImageTransientPopup > m_thumbnail_popup
Definition SliceInfoPanel.hpp:60

References m_thumbnail_popup, and Slic3r::GUI::wxMouseEvent.

Referenced by SliceInfoPanel(), and ~SliceInfoPanel().

Here is the caller graph for this function:

◆ on_webrequest_state()

void Slic3r::GUI::SliceInfoPanel::on_webrequest_state ( wxWebRequestEvent & evt)
306{
307 BOOST_LOG_TRIVIAL(trace) << "monitor: sub_task_panel web request state = " << evt.GetState();
308 switch (evt.GetState()) {
309 case wxWebRequest::State_Completed: {
310 m_thumbnail_img = *evt.GetResponse().GetStream();
311 wxImage resize_img = m_thumbnail_img.Scale(m_bmp_item_thumbnail->GetSize().x, m_bmp_item_thumbnail->GetSize().y);
312 m_bmp_item_thumbnail->SetBitmap(resize_img);
313 break;
314 }
315 case wxWebRequest::State_Failed: {
316 break;
317 }
318 case wxWebRequest::State_Cancelled:
319 case wxWebRequest::State_Unauthorized:
320 case wxWebRequest::State_Active:
321 case wxWebRequest::State_Idle: break;
322 default: break;
323 }
324}
wxImage m_thumbnail_img
Definition SliceInfoPanel.hpp:63
void trace(unsigned int level, const char *message)
Definition utils.cpp:247

References m_bmp_item_thumbnail, m_thumbnail_img, and Slic3r::trace().

Referenced by SliceInfoPanel().

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

◆ SetImages()

void Slic3r::GUI::SliceInfoPanel::SetImages ( wxBitmap & prediction,
wxBitmap & cost,
wxBitmap & printing )
273{
274 m_bmp_item_prediction->SetBitmap(prediction);
275 m_bmp_item_cost->SetBitmap(cost);
276 m_bmp_item_print->SetBitmap(printing);
277}

References m_bmp_item_cost, m_bmp_item_prediction, and m_bmp_item_print.

◆ update()

void Slic3r::GUI::SliceInfoPanel::update ( BBLSliceInfo * info)
327{
328 wxString prediction = wxString::Format("%s", get_bbl_time_dhms(info->prediction));
329 m_text_item_prediction->SetLabelText(prediction);
330
331 wxString weight = wxString::Format("%.2fg", info->weight);
332 m_text_item_cost->SetLabelText(weight);
333
334 m_text_plate_index->SetLabelText(info->index);
335
336 if (web_request.IsOk()) web_request.Cancel();
337
338 if (!info->thumbnail_url.empty()) {
339 web_request = wxWebSession::GetDefault().CreateRequest(this, info->thumbnail_url);
340 BOOST_LOG_TRIVIAL(trace) << "slice info: start reqeust thumbnail, url = " << info->thumbnail_url;
341 web_request.Start();
342 }
343
344 this->Layout();
345}
wxWebRequest web_request
Definition SliceInfoPanel.hpp:59
std::string get_bbl_time_dhms(float time_in_secs)
Definition Utils.hpp:633

References Slic3r::get_bbl_time_dhms(), Slic3r::BBLSliceInfo::index, m_text_item_cost, m_text_item_prediction, m_text_plate_index, Slic3r::BBLSliceInfo::prediction, Slic3r::BBLSliceInfo::thumbnail_url, Slic3r::trace(), web_request, and Slic3r::BBLSliceInfo::weight.

Here is the call graph for this function:

Member Data Documentation

◆ m_bmp_item_cost

wxStaticBitmap* Slic3r::GUI::SliceInfoPanel::m_bmp_item_cost
protected

◆ m_bmp_item_prediction

wxStaticBitmap* Slic3r::GUI::SliceInfoPanel::m_bmp_item_prediction
protected

◆ m_bmp_item_print

wxStaticBitmap* Slic3r::GUI::SliceInfoPanel::m_bmp_item_print
protected

◆ m_bmp_item_thumbnail

wxStaticBitmap* Slic3r::GUI::SliceInfoPanel::m_bmp_item_thumbnail
protected

◆ m_filament_info_sizer

wxGridSizer* Slic3r::GUI::SliceInfoPanel::m_filament_info_sizer
protected

Referenced by SliceInfoPanel().

◆ m_item_top_sizer

wxBoxSizer* Slic3r::GUI::SliceInfoPanel::m_item_top_sizer
protected

Referenced by SliceInfoPanel().

◆ m_slice_info_popup

std::shared_ptr<SliceInfoPopup> Slic3r::GUI::SliceInfoPanel::m_slice_info_popup
protected

◆ m_text_item_cost

wxStaticText* Slic3r::GUI::SliceInfoPanel::m_text_item_cost
protected

Referenced by SliceInfoPanel(), and update().

◆ m_text_item_prediction

wxStaticText* Slic3r::GUI::SliceInfoPanel::m_text_item_prediction
protected

Referenced by SliceInfoPanel(), and update().

◆ m_text_plate_index

wxStaticText* Slic3r::GUI::SliceInfoPanel::m_text_plate_index
protected

Referenced by SliceInfoPanel(), and update().

◆ m_thumbnail_img

wxImage Slic3r::GUI::SliceInfoPanel::m_thumbnail_img
protected

Referenced by on_webrequest_state().

◆ m_thumbnail_popup

std::shared_ptr<ImageTransientPopup> Slic3r::GUI::SliceInfoPanel::m_thumbnail_popup
protected

Referenced by on_thumbnail_leave().

◆ web_request

wxWebRequest Slic3r::GUI::SliceInfoPanel::web_request
protected

Referenced by update().


The documentation for this class was generated from the following files: