コード例 #1
0
ファイル: ErrorReportDlg.cpp プロジェクト: doo/CrashRpt
LRESULT CErrorReportDlg::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
    // Show popup menu on "Other actions..." button click
    if(g_CrashInfo.m_bQueueEnabled)
    {    
        CPoint pt;
        GetCursorPos(&pt);
        CMenu menu = LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_POPUPMENU));
        CMenu submenu = menu.GetSubMenu(4);

        strconv_t strconv;
        CString sSendLater = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("SendReportLater"));
        CString sCloseTheProgram = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("CloseTheProgram"));

        MENUITEMINFO mii;
        memset(&mii, 0, sizeof(MENUITEMINFO));
        mii.cbSize = sizeof(MENUITEMINFO);
        mii.fMask = MIIM_STRING;

        mii.dwTypeData = sSendLater.GetBuffer(0);  
        submenu.SetMenuItemInfo(ID_MENU5_SENDREPORTLATER, FALSE, &mii);

        mii.dwTypeData = sCloseTheProgram.GetBuffer(0);  
        submenu.SetMenuItemInfo(ID_MENU5_CLOSETHEPROGRAM, FALSE, &mii);

        submenu.TrackPopupMenu(0, pt.x, pt.y, m_hWnd);    
    }  
    else
    {
        // Close dialog
        CloseDialog(wID);  
    }

    return 0;
}
コード例 #2
0
ファイル: ResendDlg.cpp プロジェクト: doo/CrashRpt
LRESULT CResendDlg::OnOtherActions(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
    CPoint pt;
    GetCursorPos(&pt);
    CMenu menu = LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_POPUPMENU));  
    CMenu submenu = menu.GetSubMenu(3);

    strconv_t strconv;
    CString sRemindLater = Utility::GetINIString(
        g_CrashInfo.m_sLangFileName, _T("ResendDlg"), _T("PopupRemindLater"));
    CString sNeverRemind = Utility::GetINIString(
        g_CrashInfo.m_sLangFileName, _T("ResendDlg"), _T("PopupNeverRemind"));

    MENUITEMINFO mii;
    memset(&mii, 0, sizeof(MENUITEMINFO));
    mii.cbSize = sizeof(MENUITEMINFO);
    mii.fMask = MIIM_STRING;

    mii.dwTypeData = sRemindLater.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_MENU4_REMINDLATER, FALSE, &mii);

    mii.dwTypeData = sNeverRemind.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_MENU4_NEVERREMIND, FALSE, &mii);

    submenu.TrackPopupMenu(0, pt.x, pt.y, m_hWnd);
    return 0;
}
コード例 #3
0
ファイル: ResendDlg.cpp プロジェクト: doo/CrashRpt
LRESULT CResendDlg::OnListRClick(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
{
	CPoint pt;
    GetCursorPos(&pt);
    CMenu menu = LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_POPUPMENU));  
    CMenu submenu = menu.GetSubMenu(5);

    strconv_t strconv;
    CString sSelectAll = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ResendDlg"), _T("SelectAll"));
    CString sDeselectAll = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ResendDlg"), _T("DeselectAll"));
	CString sDeleteSelected = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ResendDlg"), _T("DeleteSelected"));
	CString sDeleteAll = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ResendDlg"), _T("DeleteAll"));

    MENUITEMINFO mii;
    memset(&mii, 0, sizeof(MENUITEMINFO));
    mii.cbSize = sizeof(MENUITEMINFO);
    mii.fMask = MIIM_STRING;

    mii.dwTypeData = sSelectAll.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_MENU6_SELECTALL, FALSE, &mii);

    mii.dwTypeData = sDeselectAll.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_MENU6_DESELECTALL, FALSE, &mii);

	mii.dwTypeData = sDeleteSelected.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_MENU6_DELETESELECTED, FALSE, &mii);

	mii.dwTypeData = sDeleteAll.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_MENU6_DELETEALL, FALSE, &mii);

	// Get count of checked list items
	int nItems = 0;
	int nChecked = 0;
	int i;
    for(i=0; i<m_listReports.GetItemCount(); i++)
    {
		nItems++;

		// If list item checked
		if(m_listReports.GetCheckState(i))
			nChecked++;
	}
	
	submenu.EnableMenuItem(ID_MENU6_SELECTALL, nItems>0?MF_ENABLED:MF_DISABLED);
	submenu.EnableMenuItem(ID_MENU6_DESELECTALL, nItems>0?MF_ENABLED:MF_DISABLED);	
	submenu.EnableMenuItem(ID_MENU6_DELETESELECTED, nChecked>0?MF_ENABLED:MF_DISABLED);
	submenu.EnableMenuItem(ID_MENU6_DELETEALL, nItems>0?MF_ENABLED:MF_DISABLED);

	submenu.TrackPopupMenu(0, pt.x, pt.y, m_hWnd);
    return 0;

	return 0;
}
コード例 #4
0
ファイル: ErrorReportDlg.cpp プロジェクト: cpzhang/zen
LRESULT CErrorReportDlg::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{   
	// This method is called when user clicks "Close the program" or "Other actions..." button 
	// (the button is the same, its caption may differ)

	CErrorReportSender* pSender = CErrorReportSender::GetInstance();

    if(pSender->GetCrashInfo()->m_bQueueEnabled)
    {    
		// Show popup menu on "Other actions..." button click.
        CPoint pt;
        GetCursorPos(&pt);
        CMenu menu = LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_POPUPMENU));
        CMenu submenu = menu.GetSubMenu(4);

        strconv_t strconv;
        CString sSendLater = pSender->GetLangStr(_T("MainDlg"), _T("SendReportLater"));
		CString sCloseTheProgram = pSender->GetLangStr(_T("MainDlg"), _T("CloseTheProgram"));

        MENUITEMINFO mii;
        memset(&mii, 0, sizeof(MENUITEMINFO));
        mii.cbSize = sizeof(MENUITEMINFO);
        mii.fMask = MIIM_STRING;

        mii.dwTypeData = sSendLater.GetBuffer(0);  
        submenu.SetMenuItemInfo(ID_MENU5_SENDREPORTLATER, FALSE, &mii);

        mii.dwTypeData = sCloseTheProgram.GetBuffer(0);  
        submenu.SetMenuItemInfo(ID_MENU5_CLOSETHEPROGRAM, FALSE, &mii);

        submenu.TrackPopupMenu(0, pt.x, pt.y, m_hWnd);    
    }  
    else // "Close the program" button clicked
    {
        // Close dialog.
        CloseDialog(wID);  
    }

    return 0;
}
コード例 #5
0
ファイル: ProgressDlg.cpp プロジェクト: doo/CrashRpt
LRESULT CProgressDlg::OnListRClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/)
{  
	// User right-clicks the log area. We should display context menu.

	CErrorReportSender* pSender = CErrorReportSender::GetInstance();
    LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) pnmh;

    POINT pt;
    GetCursorPos(&pt);

    CMenu popup_menu;
    popup_menu.LoadMenu(IDR_POPUPMENU);

    CMenu submenu = popup_menu.GetSubMenu(0);  

    if(lpnmitem->iItem<0)
    {    
        submenu.EnableMenuItem(ID_MENU1_COPYSEL, MF_BYCOMMAND|MF_GRAYED);
    }

    CString sCopySelLines = pSender->GetLangStr(_T("ProgressDlg"), _T("CopySelectedLines"));
	CString sCopyWholeLog = pSender->GetLangStr(_T("ProgressDlg"), _T("CopyTheWholeLog"));

    MENUITEMINFO mii;
    memset(&mii, 0, sizeof(MENUITEMINFO));
    mii.cbSize = sizeof(MENUITEMINFO);
    mii.fMask = MIIM_STRING;

    mii.dwTypeData = sCopySelLines.GetBuffer(0);
    mii.cch = sCopySelLines.GetLength();
    submenu.SetMenuItemInfo(ID_MENU1_COPYSEL, FALSE, &mii);

    mii.dwTypeData = sCopyWholeLog.GetBuffer(0);
    mii.cch = sCopyWholeLog.GetLength();
    submenu.SetMenuItemInfo(ID_MENU1_COPYLOG, FALSE, &mii);

    submenu.TrackPopupMenu(TPM_LEFTALIGN, pt.x, pt.y, m_hWnd); 
    return 0;
}
コード例 #6
0
/**
 * @brief 响应鼠标在震源网格中右键消息,显示右键菜单
 * @note  如果选中某一个震源,则响应消息,显示右键菜单。菜单内容包括停止某一震源、为震源分配炮点编号、
 为某震源通过震源点测线号及道号来确定炮点、清除Ready状态等
 * @param CWnd* pWnd,窗口指针
 * @param CPoint point,鼠标坐标
 * @return void
 */
void CActiveSourceWnd::OnContextMenu(CWnd* pWnd, CPoint point)
{
	// TODO: 在此处添加消息处理程序代码
	CBCGPGridCtrl* pGridCtrl = GetGridCtrl();
	if(NULL==pGridCtrl)
		return;
	// 如果没有选择震源或者网格中某一行,则不弹出菜单
	CBCGPGridRow* pRow= pGridCtrl->GetCurSel();
	if(NULL==pRow)
		return;
	CMenu menu;
	// 加载右击菜单
	VERIFY(menu.LoadMenu (IDR_POPUP_ACTIVESOURCE));
	CMenu* pPopup = menu.GetSubMenu(0);
	ASSERT(pPopup != NULL);	
	// CMainFrame* pFrm = (CMainFrame*)AfxGetMainWnd();
	CString  strTemp;
	// 每一行的数据等于震源的编号
	strTemp.Format(_T("Source %d"),pRow->GetData());
	
	// pPopup->ModifyMenu(MF_BYCOMMAND,MF_STRING,ID_ACTIVESOURCE_SOURCE,strTemp);
	// pPopup->ModifyMenu(MF_BYPOSITION,MF_STRING,0,_T("AAAAA"));
	// 更改第一个菜单的标题,显示为“Source”+震源编号
	MENUITEMINFO info;
	info.cbSize = sizeof (MENUITEMINFO);		// must fill up this field
	info.fMask = MIIM_STRING;					// get the state of the menu item
	info.dwTypeData = strTemp.GetBuffer();
	info.cch = strTemp.GetLength();
	VERIFY(pPopup->SetMenuItemInfo(ID_ACTIVESOURCE_SOURCE, &info,FALSE));
	strTemp.ReleaseBuffer();
	/*
	int  nSourceState = pRow->GetItem(0)->GetImage();
	if(nSourceState==SHOTSOURCE_FOCUS)
	{	
		info.cbSize = sizeof (MENUITEMINFO);		// must fill up this field
		info.fMask = MIIM_STATE;
		info.fState = MFS_DISABLED;
		// 如果正处于采集过程中,禁止更改放炮点
		pPopup->SetMenuItemInfo(ID_ACTIVESOURCE_DISASSOCIATEVP, &info,FALSE);
		pPopup->SetMenuItemInfo(ID_ACTIVESOURCE_ASSOCIATEVP, &info,FALSE);
		pPopup->SetMenuItemInfo(ID_ACTIVESOURCE_ASSOCIATESPLSPN, &info,FALSE);
		
		// pPopup->EnableMenuItem(ID_ACTIVESOURCE_DISASSOCIATEVP,MF_BYCOMMAND|MF_DISABLED);
		// pPopup->EnableMenuItem(ID_ACTIVESOURCE_ASSOCIATEVP,MF_BYCOMMAND|MF_DISABLED);
		// pPopup->EnableMenuItem(ID_ACTIVESOURCE_ASSOCIATESPLSPN,MF_BYCOMMAND|MF_DISABLED);
	}*/
	CBCGPPopupMenu* pPopupMenu = new CBCGPPopupMenu;
	pPopupMenu->Create(this, point.x, point.y,pPopup->Detach(),FALSE,TRUE);

}
コード例 #7
0
ファイル: ResendDlg.cpp プロジェクト: doo/CrashRpt
LRESULT CResendDlg::OnTrayIcon(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
    if(LOWORD(lParam)==WM_LBUTTONDOWN || 
        LOWORD(lParam)==WM_LBUTTONDBLCLK ||
        LOWORD(lParam)==NIN_BALLOONUSERCLICK)
    {
        KillTimer(0);
        ShowWindow(SW_SHOW);
    }

    if(LOWORD(lParam)==WM_RBUTTONDOWN)
    {
        CPoint pt;
        GetCursorPos(&pt);
        CMenu menu = LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_POPUPMENU));
        CMenu submenu = menu.GetSubMenu(2);

        strconv_t strconv;
        CString sShow = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ResendDlg"), _T("PopupShow"));
        CString sExit = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ResendDlg"), _T("PopupExit"));

        MENUITEMINFO mii;
        memset(&mii, 0, sizeof(MENUITEMINFO));
        mii.cbSize = sizeof(MENUITEMINFO);
        mii.fMask = MIIM_STRING;

        mii.dwTypeData = sShow.GetBuffer(0);  
        submenu.SetMenuItemInfo(ID_MENU3_SHOW, FALSE, &mii);

        mii.dwTypeData = sExit.GetBuffer(0);  
        submenu.SetMenuItemInfo(ID_MENU3_EXIT, FALSE, &mii);

        submenu.TrackPopupMenu(0, pt.x, pt.y, m_hWnd);
    }

    return 0;
}
コード例 #8
0
ファイル: ProgressDlg.cpp プロジェクト: doo/CrashRpt
LRESULT CProgressDlg::OnListRClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/)
{  
  LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) pnmh;

  POINT pt;
  GetCursorPos(&pt);

  CMenu popup_menu;
  popup_menu.LoadMenu(IDR_POPUPMENU);

  CMenu submenu = popup_menu.GetSubMenu(0);  

  if(lpnmitem->iItem<0)
  {    
    submenu.EnableMenuItem(ID_MENU1_COPYSEL, MF_BYCOMMAND|MF_GRAYED);
  }

  CString sCopySelLines = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("CopySelectedLines"));
  CString sCopyWholeLog = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("CopyTheWholeLog"));

  MENUITEMINFO mii;
  memset(&mii, 0, sizeof(MENUITEMINFO));
  mii.cbSize = sizeof(MENUITEMINFO);
  mii.fMask = MIIM_STRING;

  mii.dwTypeData = sCopySelLines.GetBuffer(0);
  mii.cch = sCopySelLines.GetLength();
  submenu.SetMenuItemInfo(ID_MENU1_COPYSEL, FALSE, &mii);

  mii.dwTypeData = sCopyWholeLog.GetBuffer(0);
  mii.cch = sCopyWholeLog.GetLength();
  submenu.SetMenuItemInfo(ID_MENU1_COPYLOG, FALSE, &mii);

  submenu.TrackPopupMenu(TPM_LEFTALIGN, pt.x, pt.y, m_hWnd); 
  return 0;
}
コード例 #9
0
ファイル: DetailDlg.cpp プロジェクト: doo/CrashRpt
LRESULT CDetailDlg::OnListRClick(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
{
	CErrorReportSender* pSender = CErrorReportSender::GetInstance();

	CPoint pt;
    GetCursorPos(&pt);
    CMenu menu = LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_POPUPMENU));  
    CMenu submenu = menu.GetSubMenu(6);

    strconv_t strconv;
	CString sOpen = pSender->GetLangStr(_T("DetailDlg"), _T("Open"));
	CString sDeleteSelected = pSender->GetLangStr(_T("DetailDlg"), _T("DeleteSelected"));
	CString sAttachMoreFiles = pSender->GetLangStr(_T("DetailDlg"), _T("AttachMoreFiles"));
	

    MENUITEMINFO mii;
    memset(&mii, 0, sizeof(MENUITEMINFO));
    mii.cbSize = sizeof(MENUITEMINFO);
    mii.fMask = MIIM_STRING;

    mii.dwTypeData = sOpen.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_MENU7_OPEN, FALSE, &mii);
	    
	mii.dwTypeData = sDeleteSelected.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_MENU7_DELETESELECTEDFILE, FALSE, &mii);

	mii.dwTypeData = sAttachMoreFiles.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_MENU7_ATTACHMOREFILES, FALSE, &mii);

	// Get count of selected list items
	int nItems = 0;
	int nSelected = 0;
	BOOL bAllowDelete = TRUE;
	int i;
    for(i=0; i<m_list.GetItemCount(); i++)
    {
		nItems++;

		// If list item checked
		if(m_list.GetItemState(i, LVIS_SELECTED)!=0)
			nSelected++;
		else
			continue;

		// Find file item in error report
		int nItem = (int)m_list.GetItemData(i);
		ERIFileItem* pfi = pSender->GetCrashInfo()->GetReport(m_nCurReport)->GetFileItemByIndex(nItem);
		if(!pfi->m_bAllowDelete)
			bAllowDelete = FALSE;
	}
	
	submenu.EnableMenuItem(ID_MENU7_OPEN, (nSelected==1)?MF_ENABLED:MF_DISABLED);
	submenu.EnableMenuItem(ID_MENU7_DELETESELECTEDFILE, (nSelected>0 && bAllowDelete)?MF_ENABLED:MF_DISABLED);	

	if(!pSender->GetCrashInfo()->m_bAllowAttachMoreFiles)
	{
		submenu.DeleteMenu(ID_MENU7_ATTACHMOREFILES, MF_BYCOMMAND);	
	}

	submenu.TrackPopupMenu(0, pt.x, pt.y, m_hWnd);
    return 0;
}
コード例 #10
0
ファイル: DetailDlg.cpp プロジェクト: doo/CrashRpt
LRESULT CDetailDlg::OnPreviewRClick(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
{
	// This method is called when user right-clicks the preview area.
	// We need to display popup menu.

	CErrorReportSender* pSender = CErrorReportSender::GetInstance();
	
    CPoint pt;
    GetCursorPos(&pt);

    CMenu menu;
    menu.LoadMenu(IDR_POPUPMENU);

    CMenu submenu = menu.GetSubMenu(1);
    MENUITEMINFO mii;
    memset(&mii, 0, sizeof(MENUITEMINFO));
    mii.cbSize = sizeof(MENUITEMINFO);
    mii.fMask = MIIM_STRING;

    strconv_t strconv;
	CString sAuto = pSender->GetLangStr(_T("DetailDlg"), _T("PreviewAuto"));
	CString sText = pSender->GetLangStr(_T("DetailDlg"), _T("PreviewText"));
	CString sHex = pSender->GetLangStr(_T("DetailDlg"), _T("PreviewHex"));
	CString sImage = pSender->GetLangStr(_T("DetailDlg"), _T("PreviewImage"));
	CString sEncoding = pSender->GetLangStr(_T("DetailDlg"), _T("Encoding"));

    mii.dwTypeData = sAuto.GetBuffer(0);  
    submenu.SetMenuItemInfo(ID_PREVIEW_AUTO, FALSE, &mii);

    mii.dwTypeData = sHex.GetBuffer(0);
    submenu.SetMenuItemInfo(ID_PREVIEW_HEX, FALSE, &mii);

    mii.dwTypeData = sText.GetBuffer(0);
    submenu.SetMenuItemInfo(ID_PREVIEW_TEXT, FALSE, &mii);

    mii.dwTypeData = sImage.GetBuffer(0);
    submenu.SetMenuItemInfo(ID_PREVIEW_IMAGE, FALSE, &mii);

    UINT uItem = ID_PREVIEW_AUTO;
    if(m_previewMode==PREVIEW_HEX)
        uItem = ID_PREVIEW_HEX;
    else if(m_previewMode==PREVIEW_TEXT)
        uItem = ID_PREVIEW_TEXT;
    else if(m_previewMode==PREVIEW_IMAGE)
        uItem = ID_PREVIEW_IMAGE;

    submenu.CheckMenuRadioItem(ID_PREVIEW_AUTO, ID_PREVIEW_IMAGE, uItem, MF_BYCOMMAND); 

    if(m_filePreview.GetPreviewMode()!=PREVIEW_TEXT)
    {
        submenu.DeleteMenu(5, MF_BYPOSITION);
        submenu.DeleteMenu(4, MF_BYPOSITION);
    }
    else
    {
        CMenuHandle TextEncMenu = submenu.GetSubMenu(5);
        mii.dwTypeData = sEncoding.GetBuffer(0);
        submenu.SetMenuItemInfo(5, TRUE, &mii);


        UINT uItem2 = ID_ENCODING_AUTO;
        if(m_textEncoding==ENC_AUTO)
            uItem2 = ID_ENCODING_AUTO;
        else if(m_textEncoding==ENC_ASCII)
            uItem2 = ID_ENCODING_ASCII;
        else if(m_textEncoding==ENC_UTF8)
            uItem2 = ID_ENCODING_UTF8;
        else if(m_textEncoding==ENC_UTF16_LE)
            uItem2 = ID_ENCODING_UTF16;
        else if(m_textEncoding==ENC_UTF16_BE)
            uItem2 = ID_ENCODING_UTF16BE;

        TextEncMenu.CheckMenuRadioItem(ID_ENCODING_AUTO, ID_ENCODING_UTF16BE, uItem2, MF_BYCOMMAND); 
    }

    submenu.TrackPopupMenu(TPM_LEFTBUTTON, pt.x, pt.y, m_hWnd);

    return 0;
}