FIX:fixed move wrong pos when amsmapping window popup first time
Change-Id: I5a9830141ef897399097dc21e70bfddd5113bcff
This commit is contained in:
parent
5468573e27
commit
9c402384ac
|
@ -273,6 +273,14 @@ void MaterialItem::doRender(wxDC &dc)
|
||||||
SetSizer(m_sizer_main);
|
SetSizer(m_sizer_main);
|
||||||
Layout();
|
Layout();
|
||||||
Fit();
|
Fit();
|
||||||
|
|
||||||
|
Bind(wxEVT_SHOW, [this](wxShowEvent& e) {
|
||||||
|
if (e.IsShown() && m_parent_item) {
|
||||||
|
wxPoint pos = m_parent_item->ClientToScreen(wxPoint(0, 0));
|
||||||
|
pos.y += m_parent_item->GetRect().height;
|
||||||
|
this->Move(pos);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString AmsMapingPopup::format_text(wxString &m_msg)
|
wxString AmsMapingPopup::format_text(wxString &m_msg)
|
||||||
|
|
|
@ -130,7 +130,6 @@ class AmsMapingPopup : public PopupWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AmsMapingPopup(wxWindow *parent);
|
AmsMapingPopup(wxWindow *parent);
|
||||||
wxString format_text(wxString &m_msg);
|
|
||||||
~AmsMapingPopup(){};
|
~AmsMapingPopup(){};
|
||||||
|
|
||||||
wxStaticText * m_warning_text{nullptr};
|
wxStaticText * m_warning_text{nullptr};
|
||||||
|
@ -144,7 +143,9 @@ public:
|
||||||
std::string m_tag_material;
|
std::string m_tag_material;
|
||||||
wxBoxSizer *m_sizer_main{nullptr};
|
wxBoxSizer *m_sizer_main{nullptr};
|
||||||
wxBoxSizer *m_sizer_list{nullptr};
|
wxBoxSizer *m_sizer_list{nullptr};
|
||||||
|
wxWindow *m_parent_item{nullptr};
|
||||||
|
|
||||||
|
wxString format_text(wxString &m_msg);
|
||||||
void update_materials_list(std::vector<std::string> list);
|
void update_materials_list(std::vector<std::string> list);
|
||||||
void set_tag_texture(std::string texture);
|
void set_tag_texture(std::string texture);
|
||||||
void update_ams_data(std::map<std::string, Ams *> amsList);
|
void update_ams_data(std::map<std::string, Ams *> amsList);
|
||||||
|
@ -156,6 +157,7 @@ public:
|
||||||
virtual void OnDismiss() wxOVERRIDE;
|
virtual void OnDismiss() wxOVERRIDE;
|
||||||
virtual bool ProcessLeftDown(wxMouseEvent &event) wxOVERRIDE;
|
virtual bool ProcessLeftDown(wxMouseEvent &event) wxOVERRIDE;
|
||||||
void paintEvent(wxPaintEvent &evt);
|
void paintEvent(wxPaintEvent &evt);
|
||||||
|
void set_parent_item(wxWindow* item) {m_parent_item = item;};
|
||||||
std::vector<TrayData> parse_ams_mapping(std::map<std::string, Ams*> amsList);
|
std::vector<TrayData> parse_ams_mapping(std::map<std::string, Ams*> amsList);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3192,9 +3192,10 @@ void SelectMachineDialog::set_default()
|
||||||
if (m_mapping_popup.IsShown()) return;
|
if (m_mapping_popup.IsShown()) return;
|
||||||
wxPoint pos = item->ClientToScreen(wxPoint(0, 0));
|
wxPoint pos = item->ClientToScreen(wxPoint(0, 0));
|
||||||
pos.y += item->GetRect().height;
|
pos.y += item->GetRect().height;
|
||||||
m_mapping_popup.Position(pos, wxSize(0, 0));
|
m_mapping_popup.Move(pos);
|
||||||
|
|
||||||
if (obj_ && obj_->has_ams() && ams_check->GetValue()) {
|
if (obj_ && obj_->has_ams() && ams_check->GetValue()) {
|
||||||
|
m_mapping_popup.set_parent_item(item);
|
||||||
m_mapping_popup.set_current_filament_id(extruder);
|
m_mapping_popup.set_current_filament_id(extruder);
|
||||||
m_mapping_popup.set_tag_texture(materials[extruder]);
|
m_mapping_popup.set_tag_texture(materials[extruder]);
|
||||||
m_mapping_popup.update_ams_data(obj_->amsList);
|
m_mapping_popup.update_ams_data(obj_->amsList);
|
||||||
|
|
Loading…
Reference in New Issue