FIX: [STUDIO-4122] PopupMenu from main frame

Change-Id: Iabf60abcd7039c29e18d8957b5dd695702cb9058
Jira: STUDIO-4122
This commit is contained in:
chunmao.guo 2023-08-25 16:24:15 +08:00 committed by Lane.Wei
parent ea8f299f6d
commit 664a4a76a0
3 changed files with 4 additions and 5 deletions

View File

@ -583,7 +583,7 @@ void BBLTopbar::OnFileToolItem(wxAuiToolBarEvent& evt)
tb->SetToolSticky(evt.GetId(), true); tb->SetToolSticky(evt.GetId(), true);
if (!m_skip_popup_file_menu) { if (!m_skip_popup_file_menu) {
this->PopupMenu(m_file_menu, wxPoint(FromDIP(1), this->GetSize().GetHeight() - 2)); GetParent()->PopupMenu(m_file_menu, wxPoint(FromDIP(1), this->GetSize().GetHeight() - 2));
} }
else { else {
m_skip_popup_file_menu = false; m_skip_popup_file_menu = false;
@ -600,7 +600,7 @@ void BBLTopbar::OnDropdownToolItem(wxAuiToolBarEvent& evt)
tb->SetToolSticky(evt.GetId(), true); tb->SetToolSticky(evt.GetId(), true);
if (!m_skip_popup_dropdown_menu) { if (!m_skip_popup_dropdown_menu) {
PopupMenu(&m_top_menu, wxPoint(FromDIP(1), this->GetSize().GetHeight() - 2)); GetParent()->PopupMenu(&m_top_menu, wxPoint(FromDIP(1), this->GetSize().GetHeight() - 2));
} }
else { else {
m_skip_popup_dropdown_menu = false; m_skip_popup_dropdown_menu = false;
@ -618,7 +618,7 @@ void BBLTopbar::OnCalibToolItem(wxAuiToolBarEvent &evt)
if (!m_skip_popup_calib_menu) { if (!m_skip_popup_calib_menu) {
auto rec = this->GetToolRect(ID_CALIB); auto rec = this->GetToolRect(ID_CALIB);
PopupMenu(&m_calib_menu, wxPoint(rec.GetLeft(), this->GetSize().GetHeight() - 2)); GetParent()->PopupMenu(&m_calib_menu, wxPoint(rec.GetLeft(), this->GetSize().GetHeight() - 2));
} else { } else {
m_skip_popup_calib_menu = false; m_skip_popup_calib_menu = false;
} }

View File

@ -2736,7 +2736,6 @@ void MainFrame::init_menubar_as_editor()
// Help menu // Help menu
auto helpMenu = generate_help_menu(); auto helpMenu = generate_help_menu();
#ifndef __APPLE__ #ifndef __APPLE__
m_topbar->SetFileMenu(fileMenu); m_topbar->SetFileMenu(fileMenu);
if (editMenu) if (editMenu)

View File

@ -12766,7 +12766,7 @@ bool Plater::PopupMenu(wxMenu *menu, const wxPoint& pos)
SuppressBackgroundProcessingUpdate sbpu; SuppressBackgroundProcessingUpdate sbpu;
// When tracking a pop-up menu, postpone error messages from the slicing result. // When tracking a pop-up menu, postpone error messages from the slicing result.
m_tracking_popup_menu = true; m_tracking_popup_menu = true;
bool out = this->wxPanel::PopupMenu(menu, pos); bool out = wxGetApp().mainframe->PopupMenu(menu, pos);
m_tracking_popup_menu = false; m_tracking_popup_menu = false;
if (! m_tracking_popup_menu_error_message.empty()) { if (! m_tracking_popup_menu_error_message.empty()) {
// Don't know whether the CallAfter is necessary, but it should not hurt. // Don't know whether the CallAfter is necessary, but it should not hurt.