Fixed accelerators not showing up on menus.

This commit is contained in:
leo 2012-02-10 23:07:42 +00:00
parent 643f56ae43
commit 2881fdbbfc
2 changed files with 31 additions and 20 deletions

View file

@ -206,13 +206,16 @@ BOOL CCADApp::InitInstance()
RUNTIME_CLASS(CCADView));
AddDocTemplate(pDocTemplate);
EnableShellOpen();
EnableShellOpen();
RegisterShellFileTypes(TRUE);
UINT cmdshow = m_nCmdShow;
m_nCmdShow = SW_HIDE;
pDocTemplate->OpenDocumentFile(NULL);
CMainFrame* MainFrame = (CMainFrame*)AfxGetMainWnd();
MainFrame->UpdateMenuAccelerators();
// Show something in the piece preview window.
PieceInfo* Info = lcGetPiecesLibrary()->FindPieceInfo("3005");
if (!Info)
@ -221,8 +224,8 @@ BOOL CCADApp::InitInstance()
if (Info)
{
lcGetActiveProject()->SetCurrentPiece(Info);
((CMainFrame*)(AfxGetMainWnd()))->m_wndPiecesBar.m_wndPiecePreview.SetPieceInfo(Info);
((CMainFrame*)(AfxGetMainWnd()))->m_wndPiecesBar.m_wndPiecePreview.PostMessage(WM_PAINT);
MainFrame->m_wndPiecesBar.m_wndPiecePreview.SetPieceInfo(Info);
MainFrame->m_wndPiecesBar.m_wndPiecePreview.PostMessage(WM_PAINT);
}
/*
@ -280,7 +283,7 @@ BOOL CCADApp::InitInstance()
if (AfxGetApp()->GetProfileInt("Settings", "CheckUpdates", 1))
_beginthread(CheckForUpdates, 0, NULL);
return TRUE;
return TRUE;
}
int CCADApp::ExitInstance()
@ -325,5 +328,5 @@ void CCADApp::OnHelpHomePage()
void CCADApp::OnHelpEmail()
{
ShellExecute(::GetDesktopWindow(), _T("open"), _T("mailto:leonardo@centroin.com.br?subject=LeoCAD"), NULL, NULL, SW_NORMAL);
ShellExecute(::GetDesktopWindow(), _T("open"), _T("mailto:leozide@gmail.com?subject=LeoCAD"), NULL, NULL, SW_NORMAL);
}

View file

@ -1370,8 +1370,9 @@ void CMainFrame::UpdateMenuAccelerators()
0, // LC_EDIT_ACTION_ROTATE_VIEW
0, // LC_EDIT_ACTION_ROLL
};
/*
m_bmpMenu.Attach(m_hMenuDefault);
LPACCEL AccelTable = new ACCEL[2 * KeyboardShortcutsCount];
int AccelCount = 0;
for (int i = 0; i < KeyboardShortcutsCount; i++)
{
@ -1384,32 +1385,39 @@ void CMainFrame::UpdateMenuAccelerators()
if (Cmd.Key1)
{
ACCEL& Accel = AccelTable[AccelCount++];
Accel.cmd = ID;
Accel.key = Cmd.Key1;
Accel.fVirt = FVIRTKEY;
if (Cmd.Flags & LC_KEYMOD1_SHIFT)
str += "Shift+";
Accel.fVirt |= FSHIFT;
if (Cmd.Flags & LC_KEYMOD1_CONTROL)
str += "Ctrl+";
str += GetKeyName(Cmd.Key1);
Accel.fVirt |= FCONTROL;
if (Cmd.Key2)
{
str += ", ";
ACCEL& Accel = AccelTable[AccelCount++];
Accel.cmd = ID;
Accel.key = Cmd.Key2;
Accel.fVirt = FVIRTKEY;
if (Cmd.Flags & LC_KEYMOD2_SHIFT)
str += "Shift+";
Accel.fVirt |= FSHIFT;
if (Cmd.Flags & LC_KEYMOD2_CONTROL)
str += "Ctrl+";
str += GetKeyName(Cmd.Key2);
Accel.fVirt |= FCONTROL;
}
}
m_bmpMenu.ChangeMenuItemShortcut(str, ID);
}
m_bmpMenu.Detach();
*/
CKeyboardManager* KeyboardManager = theApp.GetKeyboardManager();
KeyboardManager->UpdateAccelTable(NULL, AccelTable, AccelCount, this);
delete[] AccelTable;
}
void CMainFrame::OnDropFiles(HDROP hDropInfo)