From 054162a192178f3409e6736fe173d843b736347f Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Mon, 20 Jan 2025 12:17:52 +0800 Subject: [PATCH] FIX:change control for two dialog jira: STUDIO-10038 Change-Id: Ia88ebc9c5a61920108cdec2ae33fdf73cf6e0b00 (cherry picked from commit 4c9d8917007a7eea742253e2417b3faeab1985db) --- src/slic3r/GUI/Plater.cpp | 31 ++++++++++++++++------------ src/slic3r/GUI/Plater.hpp | 1 + src/slic3r/GUI/SyncAmsInfoDialog.cpp | 10 +++++---- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 40067f53cb..910b618328 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2679,10 +2679,17 @@ void Sidebar::update_sync_status(const MachineObject *obj) p->update_sync_status(obj); } -void Sidebar::get_big_btn_sync_pos_size(wxPoint &pt, wxSize &size) { +int Sidebar::get_sidebar_pos_right_x() +{ + return this->GetScreenPosition().x + this->GetSize().x; +} + +void Sidebar::get_big_btn_sync_pos_size(wxPoint &pt, wxSize &size) +{ size =btn_sync->GetSize(); pt = btn_sync->GetScreenPosition(); } + void Sidebar::get_small_btn_sync_pos_size(wxPoint &pt, wxSize &size) { size = ams_btn->GetSize(); pt = ams_btn->GetScreenPosition(); @@ -2736,13 +2743,8 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn) } wxGetApp().plater()->update_all_plate_thumbnails(true);//preview thumbnail for sync_dlg SyncAmsInfoDialog::SyncInfo temp_info; - temp_info.use_dialog_pos = true; + temp_info.use_dialog_pos = false; temp_info.cancel_text_to_later = is_from_big_sync_btn; - wxPoint small_btn_pt; - wxSize small_btn_size; - get_small_btn_sync_pos_size(small_btn_pt, small_btn_size); - auto cur_dialog_pos = small_btn_pt + wxPoint(small_btn_size.x * 3.6 + 5, 0); - temp_info.dialog_pos = cur_dialog_pos; temp_info.connected_printer = true; SyncAmsInfoDialog sync_dlg(this, temp_info); int dlg_res{(int) wxID_CANCEL}; @@ -2892,8 +2894,14 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn) } Layout(); + wxPoint small_btn_pt; + wxSize small_btn_size; + get_small_btn_sync_pos_size(small_btn_pt, small_btn_size); + FinishSyncAmsDialog::InputInfo temp_fsa_info; - temp_fsa_info.dialog_pos = cur_dialog_pos; + auto same_dialog_pos_x = get_sidebar_pos_right_x() + FromDIP(5); + temp_fsa_info.dialog_pos.x = same_dialog_pos_x; + temp_fsa_info.dialog_pos.y = small_btn_pt.y; if (m_fna_dialog) { m_fna_dialog.reset(); } @@ -3006,11 +3014,8 @@ void Sidebar::deal_btn_sync() { wxGetApp().plater()->sidebar().get_big_btn_sync_pos_size(big_btn_pt, big_btn_size); temp_na_info.dialog_pos = big_btn_pt + wxPoint(big_btn_size.x, big_btn_size.y) + wxPoint(FromDIP(big_btn_size.x / 10.f - 5), FromDIP(big_btn_size.y / 10.f)); - wxPoint small_btn_pt; - wxSize small_btn_size; - get_small_btn_sync_pos_size(small_btn_pt, small_btn_size); - auto cur_dialog_pos = small_btn_pt + wxPoint(small_btn_size.x * 3.6 + 5, 0); - temp_na_info.dialog_pos.x = cur_dialog_pos.x; + int same_dialog_pos_x = get_sidebar_pos_right_x()+ FromDIP(5); + temp_na_info.dialog_pos.x = same_dialog_pos_x; temp_na_info.dialog_pos.y += FromDIP(2); temp_na_info.only_external_material = only_external_material; if (m_sna_dialog) { diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index f05358613b..40947fd6d1 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -175,6 +175,7 @@ public: bool sync_extruder_list(); bool need_auto_sync_extruder_list_after_connect_priner(const MachineObject* obj); void update_sync_status(const MachineObject* obj); + int get_sidebar_pos_right_x(); void get_big_btn_sync_pos_size(wxPoint &pt, wxSize &size); void get_small_btn_sync_pos_size(wxPoint &pt, wxSize &size); // Orca diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index 28c5080103..e18cc17070 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -4377,8 +4377,9 @@ SyncNozzleAndAmsDialog::SyncNozzleAndAmsDialog(wxWindow *parent, InputInfo &inpu image_sizer->AddStretchSpacer(); text_sizer->Add(image_sizer); text_sizer->AddSpacer(FromDIP(5)); - auto finish_text = new wxStaticText(this, wxID_ANY, _L("Successfully synchronized nozzle and AMS number information.")); - finish_text->Wrap(win_width - 40); + auto finish_text = new Label(this, _L("Successfully synchronized nozzle and AMS number information."), LB_AUTO_WRAP); + finish_text->SetMinSize(wxSize(FromDIP(win_width - 40), -1)); + finish_text->SetMaxSize(wxSize(FromDIP(win_width - 40), -1)); finish_text->SetForegroundColour(wxColour(255, 255, 255, 255)); text_sizer->Add(finish_text, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 0); text_sizer->AddSpacer(FromDIP(20)); @@ -4481,8 +4482,9 @@ FinishSyncAmsDialog::FinishSyncAmsDialog(wxWindow *parent, InputInfo &input_info image_sizer->AddStretchSpacer(); text_sizer->Add(image_sizer); text_sizer->AddSpacer(FromDIP(5)); - auto finish_text = new wxStaticText(this, wxID_ANY, _L("Successfully synchronized color and type of filament from printer.")); - finish_text->Wrap(win_width - 40); + auto finish_text = new Label(this, _L("Successfully synchronized color and type of filament from printer."), LB_AUTO_WRAP); + finish_text->SetMinSize(wxSize(FromDIP(win_width - 40), -1)); + finish_text->SetMaxSize(wxSize(FromDIP(win_width - 40), -1)); finish_text->SetForegroundColour(wxColour(255, 255, 255, 255)); text_sizer->Add(finish_text, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 0); text_sizer->AddSpacer(FromDIP(20));