Skip to content

Commit

Permalink
[New] Templates can now be opened from the "New" icon in the main too…
Browse files Browse the repository at this point in the history
  • Loading branch information
sagamusix committed Apr 9, 2024
1 parent 7f1874b commit 993b0cb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mptrack/Mainbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,17 @@ void CMainToolBar::OnTbnDropDownToolBar(NMHDR *pNMHDR, LRESULT *pResult)
switch(pToolBar->iItem)
{
case ID_FILE_NEW:
CMainFrame::GetMainFrame()->GetFileMenu()->GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pToolBar->rcButton.left, pToolBar->rcButton.bottom, this);
{
auto *mainFrm = CMainFrame::GetMainFrame();
CMenu *newMenu = mainFrm->GetFileMenu()->GetSubMenu(0);
CMenu *templateMenu = mainFrm->GetFileMenu()->GetSubMenu(2);
const bool hasTemplates = templateMenu->GetMenuItemID(0) != 0;
if(hasTemplates)
newMenu->AppendMenu(MF_POPUP, reinterpret_cast<UINT_PTR>(templateMenu->m_hMenu), _T("&Templates"));
newMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pToolBar->rcButton.left, pToolBar->rcButton.bottom, this);
if(hasTemplates)
newMenu->RemoveMenu(newMenu->GetMenuItemCount() - 1, MF_BYPOSITION);
}
break;
case ID_MIDI_RECORD:
// Show a list of MIDI devices
Expand Down

0 comments on commit 993b0cb

Please sign in to comment.