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

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

Inheritance diagram for Slic3r::GUI::MaterialItem:
Collaboration diagram for Slic3r::GUI::MaterialItem:

Public Member Functions

 MaterialItem (wxWindow *parent, wxColour mcolour, wxString mname, std::string filament_id=std::string())
 ~MaterialItem ()
void allow_paint_dropdown (bool flag)
void set_ams_text (const wxString &txt)
void set_ams_info (wxColour col, wxString txt, int ctype=0, std::vector< wxColour > cols=std::vector< wxColour >(), bool record_back_info=false)
void set_material_cols (int ctype, const std::vector< wxColour > &cols)
void reset_ams_info ()
virtual void reset_valid_info ()
void set_nozzle_info (const wxString &mapped_nozzle_str)
void disable ()
void enable ()
void on_normal ()
void on_selected ()
void on_warning ()
bool is_selected () const
bool is_warning () const
void msw_rescale ()
void paintEvent (wxPaintEvent &evt)
virtual void render (wxDC &dc)
void match (bool mat)
virtual void doRender (wxDC &dc)

Public Attributes

std::string m_filament_id
wxColour m_material_coloul
int m_material_ctype = 0
std::vector< wxColour > m_material_cols
wxString m_material_name
wxString m_mapped_nozzle_str
wxColour m_ams_coloul
wxString m_ams_name
int m_ams_ctype = 0
std::vector< wxColour > m_ams_cols = std::vector<wxColour>()
wxColour m_back_ams_coloul
wxString m_back_ams_name
int m_back_ams_ctype = 0
std::vector< wxColour > m_back_ams_cols = std::vector<wxColour>()
ScalableBitmap m_arraw_bitmap_gray
ScalableBitmap m_arraw_bitmap_white
ScalableBitmap m_transparent_mitem
ScalableBitmap m_filament_wheel_transparent
ScalableBitmap m_ams_wheel_mitem
ScalableBitmap m_ams_not_match
ScalableBitmap m_rack_nozzle_bitmap
bool m_selected {false}
bool m_warning {false}
bool m_match {true}
bool m_enable {true}

Protected Member Functions

void messure_size ()

Protected Attributes

int m_text_pos_y = -1
bool m_dropdown_allow_painted = true
wxString m_mapping_text

Detailed Description

Constructor & Destructor Documentation

◆ MaterialItem()

Slic3r::GUI::MaterialItem::MaterialItem ( wxWindow * parent,
wxColour mcolour,
wxString mname,
std::string filament_id = std::string() )
84 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
85 {
86 m_arraw_bitmap_gray = ScalableBitmap(this, "drop_down2", FromDIP(8));
87 m_arraw_bitmap_white = ScalableBitmap(this, "topbar_dropdown", 12);
88 m_transparent_mitem = ScalableBitmap(this, "transparent_material_up", 20);
89 m_filament_wheel_transparent = ScalableBitmap(this, "filament_transparent", 25);//wxGetApp().dark_mode() ? "filament_dark_transparent"
90 //m_ams_wheel_mitem = ScalableBitmap(this, "ams_wheel", FromDIP(25));
91 m_ams_wheel_mitem = ScalableBitmap(this, "ams_wheel_narrow", 25);
92 m_ams_not_match = ScalableBitmap(this, "filament_not_mactch", 25);
93 m_rack_nozzle_bitmap = ScalableBitmap(this, "dev_rack_nozzle_print_job", 22);
94
95 m_material_coloul = mcolour;
96 m_material_name = mname;
97 m_ams_coloul = wxColour(0xEE,0xEE,0xEE);
98
99 m_filament_id = filament_id;
100
101#ifdef __WINDOWS__
102 SetDoubleBuffered(true);
103#endif //__WINDOWS__
104
105 messure_size();
106 SetBackgroundColour(*wxWHITE);
107
108 Bind(wxEVT_PAINT, &MaterialItem::paintEvent, this);
109 wxGetApp().UpdateDarkUI(this);
110 }
void messure_size()
Definition AmsMappingPopup.cpp:589
ScalableBitmap m_filament_wheel_transparent
Definition AmsMappingPopup.hpp:164
void paintEvent(wxPaintEvent &evt)
Definition AmsMappingPopup.cpp:223
ScalableBitmap m_ams_not_match
Definition AmsMappingPopup.hpp:166
ScalableBitmap m_ams_wheel_mitem
Definition AmsMappingPopup.hpp:165
ScalableBitmap m_transparent_mitem
Definition AmsMappingPopup.hpp:163
ScalableBitmap m_rack_nozzle_bitmap
Definition AmsMappingPopup.hpp:167
wxColour m_ams_coloul
Definition AmsMappingPopup.hpp:150
wxColour m_material_coloul
Definition AmsMappingPopup.hpp:143
std::string m_filament_id
Definition AmsMappingPopup.hpp:141
ScalableBitmap m_arraw_bitmap_white
Definition AmsMappingPopup.hpp:162
wxString m_material_name
Definition AmsMappingPopup.hpp:146
ScalableBitmap m_arraw_bitmap_gray
Definition AmsMappingPopup.hpp:161

References m_ams_coloul, m_ams_not_match, m_ams_wheel_mitem, m_arraw_bitmap_gray, m_arraw_bitmap_white, m_filament_id, m_filament_wheel_transparent, m_material_coloul, m_material_name, m_rack_nozzle_bitmap, m_transparent_mitem, messure_size(), and paintEvent().

Referenced by Slic3r::GUI::MaterialSyncItem::MaterialSyncItem().

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

◆ ~MaterialItem()

Slic3r::GUI::MaterialItem::~MaterialItem ( )
112{}

Member Function Documentation

◆ allow_paint_dropdown()

void Slic3r::GUI::MaterialItem::allow_paint_dropdown ( bool flag)
121 {
122 if (m_dropdown_allow_painted != flag) {
124 }
125}
bool m_dropdown_allow_painted
Definition AmsMappingPopup.hpp:103

References m_dropdown_allow_painted.

Referenced by Slic3r::GUI::SyncAmsInfoDialog::generate_override_fix_ams_list().

Here is the caller graph for this function:

◆ disable()

void Slic3r::GUI::MaterialItem::disable ( )
184{
185 if (IsEnabled()) {
186 m_enable = false;
187 }
188}
bool m_enable
Definition AmsMappingPopup.hpp:172
bool IsEnabled()
Definition dark_mode.cpp:32

References m_enable.

◆ doRender()

void Slic3r::GUI::MaterialItem::doRender ( wxDC & dc)
virtual

Reimplemented in Slic3r::GUI::MaterialSyncItem.

320{
321 wxSize size = GetSize();
322 auto mcolor = m_material_coloul;
323 auto acolor = m_ams_coloul;
324 change_the_opacity(acolor);
325
326 if (mcolor.Alpha() == 0)
327 {
328 dc.DrawBitmap(m_transparent_mitem.bmp(), FromDIP(1), FromDIP(1));
329 }
330
331 if (!IsEnabled())
332 {
333 mcolor = wxColour(0x90, 0x90, 0x90);
334 acolor = wxColour(0x90, 0x90, 0x90);
335 }
336
337 //top
338 dc.SetPen(*wxTRANSPARENT_PEN);
339 if (m_material_cols.size() > 1 && IsEnabled()) {
340 int top_h = FromDIP(20);
341 bool drawn = false;
342
343 wxGraphicsContext* gc = dc.GetGraphicsContext();
344 if (gc) {
345 double r = FromDIP(5);
346 auto make_path = [&](double x, double w, bool left_round, bool right_round) {
347 wxGraphicsPath p = gc->CreatePath();
348 double rl = left_round ? std::min<double>(r, std::min<double>(w, top_h)) : 0.0;
349 double rr = right_round ? std::min<double>(r, std::min<double>(w, top_h)) : 0.0;
350 p.MoveToPoint(x, top_h);
351 p.AddLineToPoint(x, rl);
352 if (rl > 0) p.AddArc(x + rl, rl, rl, M_PI, -M_PI / 2, true);
353 p.AddLineToPoint(x + w - rr, 0);
354 if (rr > 0) p.AddArc(x + w - rr, rr, rr, -M_PI / 2, 0, true);
355 p.AddLineToPoint(x + w, top_h);
356 p.CloseSubpath();
357 return p;
358 };
359
360 if (m_material_ctype == 0) {
361 wxGraphicsPath path = make_path(0, size.x, true, true);
362 wxGraphicsGradientStops stops(m_material_cols.front(), m_material_cols.back());
363 for (size_t i = 1; i + 1 < m_material_cols.size(); i++) {
364 float pos = (float)i / (m_material_cols.size() - 1);
365 stops.Add(m_material_cols[i], pos);
366 }
367 gc->SetBrush(gc->CreateLinearGradientBrush(0, 0, size.x, 0, stops));
368 gc->FillPath(path);
369 } else {
370 int cols_size = m_material_cols.size();
371 for (int i = 0; i < cols_size; i++) {
372 double x0 = (double)size.x * i / cols_size;
373 double w = (i == cols_size - 1) ? (size.x - x0) : ((double)size.x / cols_size);
374 wxGraphicsPath seg = make_path(x0, w, i == 0, i == cols_size - 1);
375 gc->SetBrush(gc->CreateBrush(wxBrush(m_material_cols[i])));
376 gc->FillPath(seg);
377 }
378 }
379 drawn = true;
380 }
381
382 if (!drawn) {
383 if (m_material_ctype == 0) {
384 int seg = m_material_cols.size() - 1;
385 int gw = std::round((double)size.x / seg);
386 for (int i = 0; i < seg; i++) {
387 int x0 = gw * i;
388 int w = (i == seg - 1) ? (size.x - x0) : gw;
389 fill_gradient_rect_east(dc, wxRect(x0, 0, w, top_h), m_material_cols[i], m_material_cols[i + 1]);
390 }
391 } else {
392 int cols_size = m_material_cols.size();
393 int cw = std::round((double)size.x / cols_size);
394 for (int i = 0; i < cols_size; i++) {
395 dc.SetBrush(wxBrush(m_material_cols[i]));
396 int x0 = cw * i;
397 int w = (i == cols_size - 1) ? (size.x - x0) : cw;
398 dc.DrawRectangle(x0, 0, w, top_h);
399 }
400 }
401 }
402 } else {
403 dc.SetBrush(wxBrush(mcolor));
404 dc.DrawRoundedRectangle(0, 0, size.x, FromDIP(20), 5);
405
406 dc.SetPen(*wxTRANSPARENT_PEN);
407 dc.SetBrush(wxBrush(mcolor));
408 dc.DrawRectangle(0, FromDIP(10), size.x, FromDIP(10));
409 }
410
411 // materials name
412 auto up = 0;
413 auto material_name_colour = mcolor.GetLuminance() < 0.6 ? *wxWHITE : wxColour(0x26, 0x2E, 0x30);
414 if (mcolor.Alpha() == 0) { material_name_colour = wxColour(0x26, 0x2E, 0x30); }
415 dc.SetTextForeground(material_name_colour);
416
417 dc.SetFont(::Label::Body_12);
418 if (dc.GetTextExtent(m_material_name).x > GetSize().x - 10)
419 {
420 dc.SetFont(::Label::Body_10);
421 }
422
423 auto material_txt_size = dc.GetTextExtent(m_material_name);
424 dc.DrawText(m_material_name, wxPoint((GetSize().x - material_txt_size.x) / 2, (FromDIP(20) - material_txt_size.y) / 2));
425
426 dc.SetPen(wxColour(0xAC, 0xAC, 0xAC));
427 dc.DrawLine(FromDIP(1), FromDIP(20), FromDIP(size.x), FromDIP(20));
428 up += FromDIP(20);
429 up += FromDIP(2); // spacing
430
431 //bottom rectangle in wheel bitmap, size is MATERIAL_REC_WHEEL_SIZE(22)
432 auto paint_recty = up + (m_ams_wheel_mitem.GetBmpSize().y - MATERIAL_REC_WHEEL_SIZE.y) / 2;
433 auto left = (size.x / 2 - MATERIAL_REC_WHEEL_SIZE.x) / 2 + FromDIP(3);
434 auto right = left + MATERIAL_REC_WHEEL_SIZE.x - FromDIP(3);
435 dc.SetPen(*wxTRANSPARENT_PEN);
436 //bottom
437 if (m_ams_cols.size() > 1)
438 {
439 int gwidth = std::round(MATERIAL_REC_WHEEL_SIZE.x / (m_ams_cols.size() - 1));
440 //gradient
441 if (m_ams_ctype == 0)
442 {
443 for (int i = 0; i < m_ams_cols.size() - 1; i++)
444 {
445 auto rect = wxRect(left, paint_recty, right - left, MATERIAL_REC_WHEEL_SIZE.y);
446 fill_gradient_rect_east(dc, rect, m_ams_cols[i], m_ams_cols[i + 1]);
447 left += gwidth;
448 }
449 }
450 else
451 {
452 int cols_size = m_ams_cols.size();
453 for (int i = 0; i < cols_size; i++)
454 {
455 dc.SetBrush(wxBrush(m_ams_cols[i]));
456 float x = left + ((float)MATERIAL_REC_WHEEL_SIZE.x) * i / cols_size;
457 if (i != cols_size - 1)
458 {
459 dc.DrawRoundedRectangle(x - FromDIP(LEFT_OFFSET), paint_recty, ((float)MATERIAL_REC_WHEEL_SIZE.x) / cols_size + FromDIP(3), MATERIAL_REC_WHEEL_SIZE.y, 3);
460 }
461 else
462 {
463 dc.DrawRoundedRectangle(x - FromDIP(LEFT_OFFSET), paint_recty, ((float)MATERIAL_REC_WHEEL_SIZE.x) / cols_size - FromDIP(1), MATERIAL_REC_WHEEL_SIZE.y, 3);
464 }
465 }
466 }
467 }
468 else
469 {
470 if (m_match)
471 {
472 dc.SetPen(*wxTRANSPARENT_PEN);
473 dc.SetBrush(wxBrush(wxColour(acolor)));
474 dc.DrawRectangle((size.x / 2 - MATERIAL_REC_WHEEL_SIZE.x) / 2 + FromDIP(3) - FromDIP(LEFT_OFFSET), paint_recty, MATERIAL_REC_WHEEL_SIZE.x - FromDIP(1),
476 }
477 }
478
479 if (m_match)
480 {
481 dc.SetPen(wxPen(wxGetApp().dark_mode() ? wxColour(107, 107, 107) : wxColour(0xAC, 0xAC, 0xAC), FromDIP(1)));
482 }
483 else
484 {
485 dc.SetPen(wxPen(wxColour(234, 31, 48), FromDIP(1)));
486 }
487
488 dc.SetBrush(*wxTRANSPARENT_BRUSH);
489 dc.DrawRoundedRectangle(FromDIP(0), FromDIP(0), size.x - FromDIP(0), size.y, 5);
490
491 if (m_selected)
492 {
493 dc.SetPen(wxPen(wxColour("#009688"), FromDIP(2))); // ORCA selected item border color (Orca accent)
494 dc.SetBrush(*wxTRANSPARENT_BRUSH);
495 dc.DrawRoundedRectangle(FromDIP(1), FromDIP(1), size.x - FromDIP(1), size.y - FromDIP(1), 5);
496 } else if (m_warning) {
497 dc.SetPen(wxPen(wxColour(0xFF, 0x6F, 0x00), FromDIP(2)));
498 dc.SetBrush(*wxTRANSPARENT_BRUSH);
499 dc.DrawRoundedRectangle(FromDIP(1), FromDIP(1), size.x - FromDIP(1), size.y - FromDIP(1), 5);
500 }
501 //#endif
502
503 auto wheel_left = (GetSize().x / 2 - m_ams_wheel_mitem.GetBmpSize().x) / 2 + FromDIP(2) - FromDIP(LEFT_OFFSET);
504 auto wheel_top = up;
505
506 if (!m_match)
507 {
508 wheel_left = (size.x - m_ams_not_match.GetBmpWidth()) / 2 - FromDIP(LEFT_OFFSET);
509 dc.DrawBitmap(m_ams_not_match.bmp(), wheel_left, wheel_top);
510 }
511 else
512 {
513 if (acolor.Alpha() == 0)
514 {
515 dc.DrawBitmap(m_filament_wheel_transparent.bmp(), wheel_left, wheel_top);
516 }
517 else
518 {
519 dc.DrawBitmap(m_ams_wheel_mitem.bmp(), wheel_left, wheel_top);
520 }
521 }
522
523 // text and arrow
524 dc.SetTextForeground(StateColor::darkModeColorFor(wxColour(0x26, 0x2E, 0x30)));
525
526 int text_pos_x = 0;
527 int text_pos_y = 0;
528 auto mapping_txt_size = wxSize(0, 0);
529 if (m_mapping_text.size() >= 4)
530 {
531 m_mapping_text.insert(m_mapping_text.size() / 2, "\n");
533 mapping_txt_size = dc.GetTextExtent(m_mapping_text);
534 text_pos_y = up + (m_ams_wheel_mitem.GetBmpSize().y - mapping_txt_size.y) / 2;
535 text_pos_x = mapping_txt_size.x / 4;
536 }
537 else
538 {
539 dc.SetFont(::Label::Head_12);
540 mapping_txt_size = dc.GetTextExtent(m_mapping_text);
541 text_pos_y = up + (m_ams_wheel_mitem.GetBmpSize().y - mapping_txt_size.y) / 2;
542 text_pos_x = 0;
543 }
544
545 int arrow_left = size.x - m_arraw_bitmap_white.GetBmpSize().x - FromDIP(4) - FromDIP(LEFT_OFFSET);
546 if (m_match)
547 {
548 dc.DrawText(m_mapping_text, wxPoint(GetSize().x / 2 + (GetSize().x / 2 - mapping_txt_size.x) / 2 - FromDIP(8) - FromDIP(LEFT_OFFSET) + text_pos_x, text_pos_y));
549
550 int arrow_y = text_pos_y + (mapping_txt_size.y - m_arraw_bitmap_white.GetBmpHeight()) / 2;
551 if ((acolor.Red() > 160 && acolor.Green() > 160 && acolor.Blue() > 160) && (acolor.Red() < 180 && acolor.Green() < 180 && acolor.Blue() < 180))
552 {
553 dc.DrawBitmap(m_arraw_bitmap_white.bmp(), arrow_left, arrow_y);
554 }
555 else
556 {
557 dc.DrawBitmap(m_arraw_bitmap_gray.bmp(), arrow_left, arrow_y);
558 }
559 }
560
561 up += m_ams_wheel_mitem.GetBmpSize().y;
562
563
564 if (!m_mapped_nozzle_str.IsEmpty()) {
565 wxPen dashed_pen(wxColour("#CECECE"), 1, wxPENSTYLE_SHORT_DASH); // Orca: WXCOLOUR_GREY400 macro not in scope here
566 dc.SetPen(dashed_pen);
567 up += FromDIP(4); // spacing
568 dc.DrawLine(FromDIP(1), up, FromDIP(size.x), up);
569
570 int bitmap_y = up + (size.y - up - m_rack_nozzle_bitmap.GetBmpHeight()) / 2;
571 int bitmap_l = wheel_left + (m_ams_wheel_mitem.GetBmpWidth() - m_rack_nozzle_bitmap.GetBmpWidth()) / 2 + FromDIP(2);
572 dc.DrawBitmap(m_rack_nozzle_bitmap.bmp(), bitmap_l, bitmap_y);
573
574 const wxString wrapped_nozzle_str = s_wrap_mapped_nozzle_str(m_mapped_nozzle_str);
575 dc.SetFont(::Label::Head_12);
576 // Orca: no box-fit get_suitable_font_size overload here; the wrapped slot string is short, so the
577 // fixed Head_12 label font (set above) renders it cleanly.
578 const auto& text_size = dc.GetTextExtent(wrapped_nozzle_str);
579 int text_x = (size.x + bitmap_l + m_rack_nozzle_bitmap.GetBmpWidth() - text_size.x) / 2;
580 int text_y = up + (size.y - up - text_size.y) / 2;
581 dc.DrawText(wrapped_nozzle_str, text_x, text_y);
582 }
583}
#define MATERIAL_REC_WHEEL_SIZE
Definition AmsMappingPopup.cpp:76
#define M_PI
Definition ExtrusionSimulator.cpp:31
static wxFont Head_12
Definition Label.hpp:47
static wxFont Body_12
Definition Label.hpp:55
static wxFont Body_10
Definition Label.hpp:56
bool m_warning
Definition AmsMappingPopup.hpp:170
std::vector< wxColour > m_ams_cols
Definition AmsMappingPopup.hpp:153
wxString m_mapping_text
Definition AmsMappingPopup.hpp:104
bool m_selected
Definition AmsMappingPopup.hpp:169
int m_material_ctype
Definition AmsMappingPopup.hpp:144
wxString m_mapped_nozzle_str
Definition AmsMappingPopup.hpp:147
int m_ams_ctype
Definition AmsMappingPopup.hpp:152
bool m_match
Definition AmsMappingPopup.hpp:171
std::vector< wxColour > m_material_cols
Definition AmsMappingPopup.hpp:145
static void get_suitable_font_size(int max_height, wxDC &dc)
Definition WxFontUtils.cpp:309
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219
const int LEFT_OFFSET
Definition AmsMappingPopup.cpp:81
static wxString s_wrap_mapped_nozzle_str(const wxString &text)
Definition AmsMappingPopup.cpp:268
void fill_gradient_rect_east(wxDC &dc, const wxRect &rect, const wxColour &from, const wxColour &to)
Definition FilamentBitmapUtils.cpp:76
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16
void change_the_opacity(wxColour &colour)
Definition DeviceManager.cpp:6154
@ up
Definition MarchingSquares.hpp:192
@ right
Definition MarchingSquares.hpp:190
@ left
Definition MarchingSquares.hpp:188

References Label::Body_10, Label::Body_12, Slic3r::change_the_opacity(), StateColor::darkModeColorFor(), Slic3r::GUI::fill_gradient_rect_east(), Slic3r::GUI::WxFontUtils::get_suitable_font_size(), Label::Head_12, Slic3r::GUI::LEFT_OFFSET, m_ams_coloul, m_ams_cols, m_ams_ctype, m_ams_not_match, m_ams_wheel_mitem, m_arraw_bitmap_gray, m_arraw_bitmap_white, m_filament_wheel_transparent, m_mapped_nozzle_str, m_mapping_text, m_match, m_material_coloul, m_material_cols, m_material_ctype, m_material_name, M_PI, m_rack_nozzle_bitmap, m_selected, m_transparent_mitem, m_warning, MATERIAL_REC_WHEEL_SIZE, and Slic3r::GUI::s_wrap_mapped_nozzle_str().

Referenced by render().

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

◆ enable()

void Slic3r::GUI::MaterialItem::enable ( )
191{
192 if (!IsEnabled()) {
193 m_enable = true;
194 }
195}

References m_enable.

◆ is_selected()

bool Slic3r::GUI::MaterialItem::is_selected ( ) const
inline
132{ return m_selected;}

References m_selected.

◆ is_warning()

bool Slic3r::GUI::MaterialItem::is_warning ( ) const
inline
133{ return m_warning;}

References m_warning.

◆ match()

void Slic3r::GUI::MaterialItem::match ( bool mat)
261{
262 m_match = mat;
263 Refresh();
264}

References m_match.

◆ messure_size()

void Slic3r::GUI::MaterialItem::messure_size ( )
protected
590{
591 if (m_mapped_nozzle_str.empty()) {
592 SetSize(wxSize(FromDIP(65), FromDIP(50)));
593 SetMinSize(wxSize(FromDIP(65), FromDIP(50)));
594 SetMaxSize(wxSize(FromDIP(65), FromDIP(50)));
595 } else {
597 const int item_height = FromDIP(84 + std::max(0, line_count - 1) * 10);
598 SetSize(wxSize(FromDIP(65), item_height));
599 SetMinSize(wxSize(FromDIP(65), item_height));
600 SetMaxSize(wxSize(FromDIP(65), item_height));
601 }
602}
static int s_get_mapped_nozzle_str_line_count(const wxString &text)
Definition AmsMappingPopup.cpp:310

References m_mapped_nozzle_str, and Slic3r::GUI::s_get_mapped_nozzle_str_line_count().

Referenced by MaterialItem(), reset_ams_info(), set_ams_info(), set_ams_text(), and set_nozzle_info().

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

◆ msw_rescale()

void Slic3r::GUI::MaterialItem::msw_rescale ( )
114 {
115 m_arraw_bitmap_gray.msw_rescale();
116 m_arraw_bitmap_white.msw_rescale();
117 m_transparent_mitem.msw_rescale();
118 m_ams_wheel_mitem.msw_rescale();
119}

References m_ams_wheel_mitem, m_arraw_bitmap_gray, m_arraw_bitmap_white, and m_transparent_mitem.

◆ on_normal()

void Slic3r::GUI::MaterialItem::on_normal ( )
214{
215 if (m_selected || m_warning) {
216 m_selected = false;
217 m_warning = false;
218 Refresh();
219 }
220}

References m_selected, and m_warning.

Referenced by Slic3r::GUI::SelectMachineDialog::reset_and_sync_ams_list(), Slic3r::GUI::SyncAmsInfoDialog::reset_and_sync_ams_list(), Slic3r::GUI::SelectMachineDialog::set_default_from_sdcard(), and Slic3r::GUI::SendMultiMachinePage::sync_ams_list().

Here is the caller graph for this function:

◆ on_selected()

void Slic3r::GUI::MaterialItem::on_selected ( )
198{
199 if (!m_selected) {
200 m_selected = true;
201 Refresh();
202 }
203}

References m_selected.

Referenced by Slic3r::GUI::SelectMachineDialog::reset_and_sync_ams_list(), Slic3r::GUI::SyncAmsInfoDialog::reset_and_sync_ams_list(), Slic3r::GUI::SelectMachineDialog::set_default_from_sdcard(), and Slic3r::GUI::SendMultiMachinePage::sync_ams_list().

Here is the caller graph for this function:

◆ on_warning()

void Slic3r::GUI::MaterialItem::on_warning ( )
206{
207 if (!m_warning) {
208 m_warning = true;
209 Refresh();
210 }
211}

References m_warning.

◆ paintEvent()

void Slic3r::GUI::MaterialItem::paintEvent ( wxPaintEvent & evt)
224{
225 wxPaintDC dc(this);
226 render(dc);
227}
virtual void render(wxDC &dc)
Definition AmsMappingPopup.cpp:229

References render().

Referenced by MaterialItem().

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

◆ render()

void Slic3r::GUI::MaterialItem::render ( wxDC & dc)
virtual

Reimplemented in Slic3r::GUI::MaterialSyncItem.

230{
231 if (m_ams_name.empty()) {
232 m_mapping_text = "-";
233 } else {
235 }
236
237 if (m_mapping_text == "-") { m_match = false;}
238 else {m_match = true;}
239
240#ifdef __WXMSW__
241 wxSize size = GetSize();
242 wxMemoryDC memdc;
243 wxBitmap bmp(size.x, size.y);
244 memdc.SelectObject(bmp);
245 memdc.Blit({0, 0}, size, &dc, {0, 0});
246
247 {
248 wxGCDC dc2(memdc);
249 doRender(dc2);
250 }
251
252 memdc.SelectObject(wxNullBitmap);
253 dc.DrawBitmap(bmp, 0, 0);
254#else
255 doRender(dc);
256#endif
257}
virtual void doRender(wxDC &dc)
Definition AmsMappingPopup.cpp:319
wxString m_ams_name
Definition AmsMappingPopup.hpp:151

References doRender(), m_ams_name, m_mapping_text, and m_match.

Referenced by paintEvent().

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

◆ reset_ams_info()

void Slic3r::GUI::MaterialItem::reset_ams_info ( )
173 {
174 m_ams_name = "-";
175 m_ams_coloul = wxColour(0xCE, 0xCE, 0xCE);
176 m_ams_cols.clear();
177 m_ams_ctype = 0;
178 m_mapped_nozzle_str.Clear();
179 messure_size();
180 Refresh();
181}

References m_ams_coloul, m_ams_cols, m_ams_ctype, m_ams_name, m_mapped_nozzle_str, and messure_size().

Referenced by Slic3r::GUI::SyncAmsInfoDialog::reset_ams_material().

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

◆ reset_valid_info()

void Slic3r::GUI::MaterialItem::reset_valid_info ( )
virtual
585 {
587}
void set_ams_info(wxColour col, wxString txt, int ctype=0, std::vector< wxColour > cols=std::vector< wxColour >(), bool record_back_info=false)
Definition AmsMappingPopup.cpp:136
std::vector< wxColour > m_back_ams_cols
Definition AmsMappingPopup.hpp:159
wxString m_back_ams_name
Definition AmsMappingPopup.hpp:157
wxColour m_back_ams_coloul
Definition AmsMappingPopup.hpp:156
int m_back_ams_ctype
Definition AmsMappingPopup.hpp:158

References m_back_ams_coloul, m_back_ams_cols, m_back_ams_ctype, m_back_ams_name, and set_ams_info().

Here is the call graph for this function:

◆ set_ams_info()

void Slic3r::GUI::MaterialItem::set_ams_info ( wxColour col,
wxString txt,
int ctype = 0,
std::vector< wxColour > cols = std::vector<wxColour>(),
bool record_back_info = false )
137{
138 auto need_refresh = false;
139 if (record_back_info) {
141 m_back_ams_ctype = ctype;
142 m_back_ams_coloul = col;
143 m_back_ams_name = txt;
144 }
145 if (m_ams_cols != cols) { m_ams_cols = cols; need_refresh = true; }
146 if (m_ams_ctype != ctype) { m_ams_ctype = ctype; need_refresh = true; }
147 if (m_ams_coloul != col) { m_ams_coloul = col; need_refresh = true;}
148 if (m_ams_name != txt) { m_ams_name = txt; need_refresh = true; }
149 if (need_refresh) {
150 messure_size();
151 Refresh();
152 }
153 BOOST_LOG_TRIVIAL(info) << "set_ams_info " << m_ams_name;
154}
size_t cols(const T &raster)
Definition MarchingSquares.hpp:173

References m_ams_coloul, m_ams_cols, m_ams_ctype, m_ams_name, m_back_ams_coloul, m_back_ams_cols, m_back_ams_ctype, m_back_ams_name, and messure_size().

Referenced by Slic3r::GUI::SelectMachineDialog::on_set_finish_mapping(), Slic3r::GUI::SendMultiMachinePage::on_set_finish_mapping(), Slic3r::GUI::SendMultiMachinePage::OnSelectRadio(), Slic3r::GUI::SelectMachineDialog::reset_ams_material(), reset_valid_info(), Slic3r::GUI::SendMultiMachinePage::sync_ams_list(), and Slic3r::GUI::SelectMachineDialog::sync_ams_mapping_result().

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

◆ set_ams_text()

void Slic3r::GUI::MaterialItem::set_ams_text ( const wxString & txt)
128{
129 if (m_ams_name != txt) {
130 m_ams_name = txt;
131 messure_size();
132 Refresh();
133 }
134}

References m_ams_name, and messure_size().

Here is the call graph for this function:

◆ set_material_cols()

void Slic3r::GUI::MaterialItem::set_material_cols ( int ctype,
const std::vector< wxColour > & cols )
165 {
166 if (m_material_ctype != ctype || m_material_cols != cols) {
167 m_material_ctype = ctype;
169 Refresh();
170 }
171}

References m_material_cols, and m_material_ctype.

◆ set_nozzle_info()

void Slic3r::GUI::MaterialItem::set_nozzle_info ( const wxString & mapped_nozzle_str)
157{
158 if (m_mapped_nozzle_str != mapped_nozzle_str) {
159 m_mapped_nozzle_str = mapped_nozzle_str;
160 messure_size();
161 Refresh();
162 }
163}

References m_mapped_nozzle_str, and messure_size().

Referenced by Slic3r::GUI::SelectMachineDialog::on_set_finish_mapping(), Slic3r::GUI::SelectMachineDialog::reset_ams_material(), and Slic3r::GUI::SelectMachineDialog::sync_ams_mapping_result().

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

Member Data Documentation

◆ m_ams_coloul

◆ m_ams_cols

std::vector<wxColour> Slic3r::GUI::MaterialItem::m_ams_cols = std::vector<wxColour>()

◆ m_ams_ctype

int Slic3r::GUI::MaterialItem::m_ams_ctype = 0

◆ m_ams_name

◆ m_ams_not_match

ScalableBitmap Slic3r::GUI::MaterialItem::m_ams_not_match

Referenced by MaterialItem(), and doRender().

◆ m_ams_wheel_mitem

ScalableBitmap Slic3r::GUI::MaterialItem::m_ams_wheel_mitem

◆ m_arraw_bitmap_gray

ScalableBitmap Slic3r::GUI::MaterialItem::m_arraw_bitmap_gray

◆ m_arraw_bitmap_white

ScalableBitmap Slic3r::GUI::MaterialItem::m_arraw_bitmap_white

◆ m_back_ams_coloul

wxColour Slic3r::GUI::MaterialItem::m_back_ams_coloul

Referenced by reset_valid_info(), and set_ams_info().

◆ m_back_ams_cols

std::vector<wxColour> Slic3r::GUI::MaterialItem::m_back_ams_cols = std::vector<wxColour>()

Referenced by reset_valid_info(), and set_ams_info().

◆ m_back_ams_ctype

int Slic3r::GUI::MaterialItem::m_back_ams_ctype = 0

Referenced by reset_valid_info(), and set_ams_info().

◆ m_back_ams_name

wxString Slic3r::GUI::MaterialItem::m_back_ams_name

Referenced by reset_valid_info(), and set_ams_info().

◆ m_dropdown_allow_painted

bool Slic3r::GUI::MaterialItem::m_dropdown_allow_painted = true
protected

◆ m_enable

◆ m_filament_id

std::string Slic3r::GUI::MaterialItem::m_filament_id

Referenced by MaterialItem().

◆ m_filament_wheel_transparent

ScalableBitmap Slic3r::GUI::MaterialItem::m_filament_wheel_transparent

◆ m_mapped_nozzle_str

wxString Slic3r::GUI::MaterialItem::m_mapped_nozzle_str

◆ m_mapping_text

wxString Slic3r::GUI::MaterialItem::m_mapping_text
protected

Referenced by doRender(), and render().

◆ m_match

◆ m_material_coloul

◆ m_material_cols

std::vector<wxColour> Slic3r::GUI::MaterialItem::m_material_cols

Referenced by doRender(), and set_material_cols().

◆ m_material_ctype

int Slic3r::GUI::MaterialItem::m_material_ctype = 0

Referenced by doRender(), and set_material_cols().

◆ m_material_name

◆ m_rack_nozzle_bitmap

ScalableBitmap Slic3r::GUI::MaterialItem::m_rack_nozzle_bitmap

Referenced by MaterialItem(), and doRender().

◆ m_selected

◆ m_text_pos_y

int Slic3r::GUI::MaterialItem::m_text_pos_y = -1
protected

◆ m_transparent_mitem

ScalableBitmap Slic3r::GUI::MaterialItem::m_transparent_mitem

◆ m_warning

bool Slic3r::GUI::MaterialItem::m_warning {false}
170{false};

Referenced by doRender(), is_warning(), on_normal(), and on_warning().


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