BOOL 
CGlobalCWizardSheet::OnInitDialog() 
{
	CMenu		*pSysMenu;
	HDC			hDC;
	PGPBoolean	loadedBitmap;
	PGPUInt32	numBits;

	CPropertySheet::OnInitDialog();

	// Get screen depth.
	hDC = ::GetDC(NULL);		// DC for desktop
	numBits = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES);
	::ReleaseDC(NULL, hDC);

	// Load the bitmap and create a palette for it.
	if (numBits <= 1)
	{
		loadedBitmap = App->GetBitmapAndPalette(IDB_SIDEBAR1, 
			&mSidebarBitmap, &mSidebarPalette);
	}
	else if (numBits <= 4)
	{
		loadedBitmap = App->GetBitmapAndPalette(IDB_SIDEBAR4, 
			&mSidebarBitmap, &mSidebarPalette);
	}
	else
	{
		loadedBitmap = App->GetBitmapAndPalette(IDB_SIDEBAR8, 
			&mSidebarBitmap, &mSidebarPalette);
	}

	// Need to give the dialog a close box if we want a help box as well.
	ModifyStyle(NULL, WS_SYSMENU, NULL);

	// Show the context help button.
	ModifyStyleEx(NULL, WS_EX_CONTEXTHELP, NULL);

	// Alter the system menu.
	pSysMenu = GetSystemMenu(FALSE);
	pgpAssertAddrValid(pSysMenu, CMenu);

	pSysMenu->DeleteMenu(SC_MINIMIZE, MF_BYCOMMAND);
	pSysMenu->DeleteMenu(SC_MAXIMIZE, MF_BYCOMMAND);
	pSysMenu->DeleteMenu(SC_RESTORE, MF_BYCOMMAND);
	pSysMenu->DeleteMenu(SC_SIZE, MF_BYCOMMAND);

	DrawMenuBar();

	// Center on screen.
	CenterWindow(GetDesktopWindow());

	// Put us in front.
	SetForegroundWindow();

	// Put on top if necessary.
	App->TweakOnTopAttribute(this);

	return TRUE;
}
Пример #2
0
BOOL CMainFrame::OnShowMDITabContextMenu (CPoint point, DWORD dwAllowedItems, BOOL bDrop)
{
	CMenu menu;
	VERIFY(menu.LoadMenu (bDrop ? IDR_POPUP_DROP_MDITABS : IDR_POPUP_MDITABS));

	CMenu* pPopup = menu.GetSubMenu(0);
	ASSERT(pPopup != NULL);

	if ((dwAllowedItems & BCGP_MDI_CREATE_HORZ_GROUP) == 0)
	{
		pPopup->DeleteMenu (ID_MDI_NEW_HORZ_TAB_GROUP, MF_BYCOMMAND);
	}

	if ((dwAllowedItems & BCGP_MDI_CREATE_VERT_GROUP) == 0)
	{
		pPopup->DeleteMenu (ID_MDI_NEW_VERT_GROUP, MF_BYCOMMAND);
	}

	if ((dwAllowedItems & BCGP_MDI_CAN_MOVE_NEXT) == 0)
	{
		pPopup->DeleteMenu (ID_MDI_MOVE_TO_NEXT_GROUP, MF_BYCOMMAND);
	}

	if ((dwAllowedItems & BCGP_MDI_CAN_MOVE_PREV) == 0)
	{
		pPopup->DeleteMenu (ID_MDI_MOVE_TO_PREV_GROUP, MF_BYCOMMAND);
	}

	CBCGPPopupMenu* pPopupMenu = new CBCGPPopupMenu;
	pPopupMenu->SetAutoDestroy (FALSE);
	pPopupMenu->Create (this, point.x, point.y, pPopup->GetSafeHmenu ());

	return TRUE;
}
Пример #3
0
void CMainFrame::BuildViewList()
{
	WinGPAC *app = GetApp();
	if (!app->m_isopen) return;

	/*THIS IS HARCODED FROM THE MENU LAYOUT */
	CMenu *pMenu = GetMenu()->GetSubMenu(1)->GetSubMenu(0);
	while (pMenu->GetMenuItemCount()) pMenu->DeleteMenu(0, MF_BYPOSITION);

	s32 id = ID_VP_0;
	nb_viewpoints = 0;
	while (1) {
		const char *szName;
		Bool bound;
		M4Err e = M4T_GetViewpoint(app->m_term, nb_viewpoints+1, &szName, &bound);
		if (e) break;
		if (szName) {
			pMenu->AppendMenu(MF_ENABLED, id+nb_viewpoints, szName);
		} else {
			char szLabel[1024];
			sprintf(szLabel, "Viewpoint #%d", nb_viewpoints+1);
			pMenu->AppendMenu(MF_ENABLED, id+nb_viewpoints, szLabel);
		}
		nb_viewpoints++;
		if (nb_viewpoints==ID_VP_19-ID_VP_0) break;
	}
}
Пример #4
0
void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd) 
{
	CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
	
	if (bActivate)
	{
		CMenu* pTopMenu = AfxGetMainWnd()->GetMenu();
		for(unsigned int i = 0; i < pTopMenu->GetMenuItemCount(); i++)
		{
			CMenu *pSubMenu = pTopMenu->GetSubMenu(i);
			if (pSubMenu)
				for(unsigned int j=0; j < pSubMenu->GetMenuItemCount(); j++)
				{
					if (pSubMenu->GetMenuItemID(j) == ID_PORTS_CREATE)
					{
						CMenu ResourceMenu;
						ResourceMenu.CreatePopupMenu();

						for(int k=0;k < Port::portCount() ; k++)
							ResourceMenu.AppendMenu(MF_STRING,ID_RESOURCE_PORT_BEGIN + k,
								Port::portName( k ) );

						pSubMenu->DeleteMenu(j,MF_BYPOSITION);
						pSubMenu->InsertMenu(j,MF_POPUP|MF_BYPOSITION,(unsigned int)ResourceMenu.Detach(),_T("Create"));

						return;
					}
				}
		}
	}
}
Пример #5
0
BOOL CMainFrame::OnShowMDITabContextMenu (CPoint point, DWORD dwAllowedItems, BOOL bDrop)
{
	TRACE("CMainFrame::OnShowMDITabContextMenu");

	if (bDrop || !theApp.m_Options.m_bMDITabsContextMenu)
	{
		return FALSE;
	}

	CMenu menu;
	VERIFY(menu.LoadMenu (IDR_POPUP_MDITABS));

	CMenu* pPopup = menu.GetSubMenu(0);
	ASSERT(pPopup != NULL);

	if (pPopup)
	{
		if ((dwAllowedItems & AFX_MDI_CAN_BE_DOCKED) == 0)
		{
			pPopup->DeleteMenu (ID_MDI_TABBED, MF_BYCOMMAND);
		}

		CMFCPopupMenu* pPopupMenu = new CMFCPopupMenu;
		if (pPopupMenu)
		{
			pPopupMenu->SetAutoDestroy (FALSE);
			pPopupMenu->Create (this, point.x, point.y, pPopup->GetSafeHmenu ());
		}
	}

	return TRUE;
}
Пример #6
0
void CAbstractVstEditor::UpdateOutputMenu()
{
     CMenu* pInfoMenu = m_pMenu->GetSubMenu(2);
    pInfoMenu->DeleteMenu(1, MF_BYPOSITION);

    if (m_pOutputMenu->m_hMenu)        {
            m_pOutputMenu->DestroyMenu();
    }
    if (!m_pOutputMenu->m_hMenu) {
            m_pOutputMenu->CreatePopupMenu();
    }

    CArray<CVstPlugin*, CVstPlugin*> outputPlugs;
    m_pVstPlugin->GetOutputPlugList(outputPlugs);
    CString name;

    for (int nPlug=0; nPlug<outputPlugs.GetSize(); nPlug++) {
            if (outputPlugs[nPlug] != NULL) {
                    name.Format("FX%02d: %s", outputPlugs[nPlug]->m_nSlot+1,
                                                                    outputPlugs[nPlug]->m_pMixStruct->Info.szName);
                    m_pOutputMenu->AppendMenu(MF_STRING, ID_PLUGSELECT+outputPlugs[nPlug]->m_nSlot, name);
            } else {
                    name = "Master Output";
                    m_pOutputMenu->AppendMenu(MF_STRING|MF_GRAYED, NULL, name);
            }

    }
    pInfoMenu->InsertMenu(1, MF_BYPOSITION|MF_POPUP, (UINT)m_pOutputMenu->m_hMenu, "Ou&tputs");
}
Пример #7
0
void CHello2Dlg::OnLbnDblclkList4()
{
	// TODO: 在此添加控件通知处理程序代码
  CMenu   mainmenu;    
  mainmenu.LoadMenu(IDR_SELPROBE);

  CMenu *pM = mainmenu.GetSubMenu(0);
  //remove the existing menu
  CString   str ;  
  int i;
  for(i=pM->GetMenuItemCount()-1;i>=0;i--)   //取得菜单的项数。  
  {    
          pM->GetMenuString(i,str,MF_BYPOSITION);    
          //将指定菜单项的标签拷贝到指定的缓冲区。MF_BYPOSITION的解释见上。    
		  pM->DeleteMenu(i,MF_BYPOSITION);   
  }
  pM->AppendMenu(MF_STRING,ID_32771,_T("显示转换结果"));
  pM->AppendMenu(MF_STRING,ID_32771+1,_T("显示原始数据"));
  pM->AppendMenu(MF_STRING,ID_32771+2,_T("删除选中数据"));
  pM->AppendMenu(MF_STRING,ID_32771+3,_T("清空所有数据"));
  pM->AppendMenu(MF_STRING,ID_32771+4,_T("导出所有数据"));
  m_cmdbase = ID_32773;

  CRect rect;
  m_chlist.GetClientRect(&rect);
  
  CPoint pt;
  GetCursorPos(&pt);

    pM->TrackPopupMenu(TPM_LEFTALIGN,pt.x,pt.y,this);
	return;

}
Пример #8
0
BOOL CClientDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
// 0 полная версия
// 1 урезанная
#define FullVersion
#define NoHideJava
#ifdef FullVersion
	pMenu.LoadMenuW(IDR_MENU1);
#else
	pMenu.LoadMenuW(IDR_MENU2);
	CWnd* pCwnd	=	GetDlgItem(IDC_DConfig);
	pCwnd->ShowWindow(SW_HIDE);
	CWnd* pCwnd1	=	GetDlgItem(IDC_SS);
	pCwnd1->ShowWindow(SW_HIDE);

#endif
	SetMenu(&pMenu);

	hF4 = LoadAccelerators( AfxGetResourceHandle(),
	MAKEINTRESOURCE( IDR_ACCELERATOR1 ) );

	m_TextWinList1.SetItemHeight(10);
	m_TextWinList1.SetBg(RGB(50,  100, 150));
	m_TextWinList1.SetFg(RGB(255, 255,255));

	m_PlaceKeeper.Init( m_hWnd );
	m_PlaceKeeper.SetBindings( IDC_CLIENTVIEW, CRect( TA_LEFT, TA_TOP, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_LOG_LIST, CRect( TA_RIGHT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_WINDOW_LIST, CRect( TA_LEFT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_LIST1, CRect( TA_LEFT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_REFRESH_BTN, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) );
	m_PlaceKeeper.SetBindings( IDC_REFRESHWND_BTN, CRect( TA_LEFT, TA_BOTTOM, TA_LEFT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_PROCDLG_BTN, CRect( TA_LEFT, TA_BOTTOM, TA_LEFT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_HOOK_APP, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP  ) );
	m_PlaceKeeper.SetBindings( IDC_HOOK_JAVA, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) );
	m_PlaceKeeper.SetBindings( IDC_PATCH_STATUS, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP  ) );
	m_PlaceKeeper.SetBindings( IDC_STATUS, CRect( TA_LEFT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_STATIC1, CRect( TA_LEFT, TA_BOTTOM, TA_LEFT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_STATIC2, CRect( TA_RIGHT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_CMD_DESK_1, CRect(  TA_LEFT, TA_TOP, TA_LEFT, TA_TOP  ) );
	m_PlaceKeeper.SetBindings( IDC_CMD_DESK_2, CRect(  TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) );
	m_PlaceKeeper.SetBindings( IDC_STATIC_DESK, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP  ) );

	m_pClient->SetClientNotifyWindow( m_hWnd );
	m_pClient->RequestWindowList();
	m_ClientView.ClearImage();
	/*CButton *chB_HookJava = (CButton *) (this->GetDlgItem(IDC_HOOK_JAVA));
	chB_HookJava->SetCheck(1);*/
	Log( L"Getting windows..." );

#ifdef WITHOUT_VNC
	pMenu.DeleteMenu(5, MF_BYPOSITION);
	//CMenu* RDP = pMenu.GetSubMenu(5);
	//RDP->DeleteMenu(9, MF_BYPOSITION);
	//RDP->DeleteMenu(9, MF_BYPOSITION);
#endif

	return TRUE;
}
Пример #9
0
void CHello2Dlg::OnStnDblclickRunGraph()
{
	// TODO: 在此添加控件通知处理程序代码
  CMenu   mainmenu;    
  mainmenu.LoadMenu(IDR_SELPROBE);
  m_graph.Invalidate();
  CMenu *pM = mainmenu.GetSubMenu(0);
  //remove the existing menu
  CString   str ;  
  int i;
  for(i=pM->GetMenuItemCount()-1;i>=0;i--)   //取得菜单的项数。  
  {    
          pM->GetMenuString(i,str,MF_BYPOSITION);    
          //将指定菜单项的标签拷贝到指定的缓冲区。MF_BYPOSITION的解释见上。    
		  pM->DeleteMenu(i,MF_BYPOSITION);   
  }
  pM->AppendMenu(MF_STRING,ID_32771,_T("关闭辅助显示"));
  for(i=0;i<sizeof(m_ridlgs)/sizeof(CRunitemDialog*);i++){
		CString name;
		name.Format(_T("同时显示通道%i"),i+1);
  		pM->AppendMenu(MF_STRING,ID_32771+1+i,name);
  }
  m_cmdbase = ID_32772;

  
  CPoint pt;
  GetCursorPos(&pt);
	SetForegroundWindow();
    pM->TrackPopupMenu(TPM_LEFTALIGN,pt.x,pt.y,this);
	return;
/*  CString tt;
  tt.Format(_T("clicked:%i,%i"),pt.x,pt.y);
  GetDlgItem(IDC_MAIN_STATUS)->SetWindowText(tt);
*/
}
Пример #10
0
void CMainFrame::OnCwndDeletefilemenu()
{
   // This example deletes the leftmost popup menu or leftmost
   // popup menu item from the application's main window.
   CWnd* pMain = AfxGetMainWnd();

   // The main window _can_ be NULL, so this code
   // doesn't ASSERT and actually tests.
   if (pMain != NULL)
   {
      // Get the main window's menu
      CMenu* pMenu = pMain->GetMenu();

      // If there is a menu and it has items, we'll
      // delete the first one.
      if (pMenu != NULL && pMenu->GetMenuItemCount() > 0)
      {
         pMenu->DeleteMenu(0, MF_BYPOSITION);
         // force a redraw of the menu bar
         pMain->DrawMenuBar();
      }

      // No need to delete pMenu because it is an MFC
      // temporary object.
   }
}
Пример #11
0
/**
 * メニュー押下(メインメニュー表示)
 */
void CMainFrame::OnMenuOpenMenu()
{
	POINT pt    = util::GetPopupPosForSoftKeyMenu1();
	int   flags = util::GetPopupFlagsForSoftKeyMenu1();

	CMenu menu;
#ifdef BT_TKTW
	menu.LoadMenu(IDR_MAINFRAME_CE_TKTW);
#endif
#ifdef BT_MZ3
	menu.LoadMenu(IDR_MAINFRAME_CE);
#endif
	CMenu* pSubMenu = menu.GetSubMenu(0);

	CView* pActiveView = GetActiveView();

	// カテゴリ差し替え
	const int IDX_CATEGOGY_MENU = 2;
	if (pActiveView == theApp.m_pMainView) {
		// メインビュー
		CMenu* pCategoryMenu = pSubMenu->GetSubMenu(IDX_CATEGOGY_MENU);
		if (pCategoryMenu != NULL) {
			// ダミー削除
			pCategoryMenu->DeleteMenu(ID_DUMMY, MF_BYCOMMAND);

			// カテゴリ選択メニュー追加
			const CCategoryItemList& categories = theApp.m_pMainView->m_selGroup->categories;
			for (size_t i=0; i<categories.size(); i++) {
				int mflag = MF_STRING;

				if (i == theApp.m_pMainView->m_selGroup->selectedCategory) {
					mflag |= MF_CHECKED;
				}
				pCategoryMenu->AppendMenuW(mflag, ID_SELECT_CATEGORY_BASE + i, categories[i].m_name);
			}
		}
	} else {
		// メインビュー以外:非表示
		pSubMenu->DeleteMenu(IDX_CATEGOGY_MENU, MF_BYPOSITION);
	}

	// メニュー表示
	pSubMenu->TrackPopupMenu(flags, pt.x, pt.y, this);
}
Пример #12
0
void CMonitorWnd::DestroyMenu()
{
	CMenu* pMainMenu = AfxGetMainWnd()->GetMenu();
	pMainMenu->DeleteMenu( (UINT)m_hSubMenu, MF_BYCOMMAND );
	
	pMainMenu->Detach();
	AfxGetMainWnd()->DrawMenuBar(); 
	
	m_hSubMenu = NULL;
}
Пример #13
0
void CAbstractVstEditor::UpdateInputMenu()
{
     CMenu* pInfoMenu = m_pMenu->GetSubMenu(2);
    pInfoMenu->DeleteMenu(0, MF_BYPOSITION);

    CModDoc* pModDoc = m_pVstPlugin->GetModDoc();
    module_renderer* pSndFile = pModDoc->GetSoundFile();

    if (m_pInputMenu->m_hMenu)        {
            m_pInputMenu->DestroyMenu();
    }
    if (!m_pInputMenu->m_hMenu) {
            m_pInputMenu->CreatePopupMenu();
    }

    CString name;

    CArray<CVstPlugin*, CVstPlugin*> inputPlugs;
    m_pVstPlugin->GetInputPlugList(inputPlugs);
    for (int nPlug=0; nPlug<inputPlugs.GetSize(); nPlug++) {
            name.Format("FX%02d: %s", inputPlugs[nPlug]->m_nSlot+1, inputPlugs[nPlug]->m_pMixStruct->Info.szName);
            m_pInputMenu->AppendMenu(MF_STRING, ID_PLUGSELECT+inputPlugs[nPlug]->m_nSlot, name);
    }

    CArray<UINT, UINT> inputChannels;
    m_pVstPlugin->GetInputChannelList(inputChannels);
    for (int nChn=0; nChn<inputChannels.GetSize(); nChn++) {
            if (nChn==0 && inputPlugs.GetSize()) {
                    m_pInputMenu->AppendMenu(MF_SEPARATOR);
            }
            name.Format("Chn%02d: %s", inputChannels[nChn]+1, pSndFile->ChnSettings[inputChannels[nChn]].szName);
            m_pInputMenu->AppendMenu(MF_STRING, NULL, name);
    }

    CArray<UINT, UINT> inputInstruments;
    m_pVstPlugin->GetInputInstrumentList(inputInstruments);
    bool checked;
    for (int nIns=0; nIns<inputInstruments.GetSize(); nIns++) {
            checked=false;
            if (nIns==0 && (inputPlugs.GetSize() || inputChannels.GetSize())) {
                    m_pInputMenu->AppendMenu(MF_SEPARATOR);
            }
            name.Format("Ins%02d: %s", inputInstruments[nIns], (LPCTSTR)pSndFile->GetInstrumentName(inputInstruments[nIns]));
            if (inputInstruments[nIns] == (UINT)m_nInstrument)        checked=true;
            m_pInputMenu->AppendMenu(MF_STRING|(checked?MF_CHECKED:0), ID_SELECTINST+inputInstruments[nIns], name);
    }

    if ((inputPlugs.GetSize() == 0) &&
            (inputChannels.GetSize() == 0) &&
            (inputInstruments.GetSize() == 0)) {
            m_pInputMenu->AppendMenu(MF_STRING|MF_GRAYED, NULL, "None");
    }

    pInfoMenu->InsertMenu(0, MF_BYPOSITION|MF_POPUP, (UINT)m_pInputMenu->m_hMenu, "I&nputs");
}
Пример #14
0
BOOL CDlgCalcDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	//
	// Set the application's icon.
	//
	SetIcon(m_hIcon, TRUE);
	SetIcon(m_hIcon, FALSE);
	
	//
	// Remove the Size and Maximize commands from the system menu.
	//
	CMenu* pMenu = GetSystemMenu (FALSE);
	pMenu->DeleteMenu (SC_SIZE, MF_BYCOMMAND);
	pMenu->DeleteMenu (SC_MAXIMIZE, MF_BYCOMMAND);

	//
	// Initialize m_rect with the coordinates of the control representing
	// the calculator's output window. Then destroy the control.
	//
	CWnd* pWnd = GetDlgItem (IDC_DISPLAYRECT);
	pWnd->GetWindowRect (&m_rect);
	pWnd->DestroyWindow ();
	ScreenToClient (&m_rect);

	//
	// Initialize m_cxChar and m_cyChar with the average character width
	// and height.
	//
    TEXTMETRIC tm;
    CClientDC dc (this);
    dc.GetTextMetrics (&tm);
    m_cxChar = tm.tmAveCharWidth;
    m_cyChar = tm.tmHeight - tm.tmDescent;

	//
	// Initialize the calculator's output window and return.
	//
    DisplayXRegister ();
	return TRUE;
}
Пример #15
0
BOOL CSCBMiniDockFrameWnd::Create(CWnd* pParent, DWORD dwBarStyle)
{
    // set m_bInRecalcLayout to avoid flashing during creation
    // RecalcLayout will be called once something is docked
    m_bInRecalcLayout = TRUE;

    DWORD dwStyle = WS_POPUP|WS_CAPTION|WS_SYSMENU|MFS_MOVEFRAME|
        MFS_4THICKFRAME|MFS_SYNCACTIVE|MFS_BLOCKSYSMENU|
        FWS_SNAPTOBARS;

    if (dwBarStyle & CBRS_SIZE_DYNAMIC)
        dwStyle &= ~MFS_MOVEFRAME;

    DWORD dwExStyle = 0;
#ifdef _MAC
    if (dwBarStyle & CBRS_SIZE_DYNAMIC)
        dwExStyle |= WS_EX_FORCESIZEBOX;
    else
        dwStyle &= ~(MFS_MOVEFRAME|MFS_4THICKFRAME);
#endif

    CString emptyString;
	if (!CMiniFrameWnd::CreateEx(dwExStyle,
        NULL, emptyString, dwStyle, rectDefault, pParent))
    {
        m_bInRecalcLayout = FALSE;
        return FALSE;
    }
    dwStyle = dwBarStyle & (CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT) ?
        CBRS_ALIGN_LEFT : CBRS_ALIGN_TOP;
    dwStyle |= dwBarStyle & CBRS_FLOAT_MULTI;
    CMenu* pSysMenu = GetSystemMenu(FALSE);
    //pSysMenu->DeleteMenu(SC_SIZE, MF_BYCOMMAND);
    CString strHide;
    if (strHide.LoadString(AFX_IDS_HIDE))
    {
        pSysMenu->DeleteMenu(SC_CLOSE, MF_BYCOMMAND);
        pSysMenu->AppendMenu(MF_STRING|MF_ENABLED, SC_CLOSE, strHide);
    }

    // must initially create with parent frame as parent
    if (!m_wndDockBar.Create(pParent, WS_CHILD | WS_VISIBLE | dwStyle,
        AFX_IDW_DOCKBAR_FLOAT))
    {
        m_bInRecalcLayout = FALSE;
        return FALSE;
    }

    // set parent to CMiniDockFrameWnd
    m_wndDockBar.SetParent(this);
    m_bInRecalcLayout = FALSE;

    return TRUE;
}
Пример #16
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	LOG(INFO) << "CMainFrame::OnCreate()";
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	// create a view to occupy the client area of the frame
	if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
	{
		TRACE0("Failed to create view window\n");
		return -1;
	}

	CMenu* pMenu = GetMenu();
	CMenu* pSubMenu = pMenu->GetSubMenu(1);

	// Init Video Device
	int nVideo = XIS_GetVideoCaptureCount();
	LOG(INFO) << "XIS_GetVideoCaptureCount(): " << nVideo;
	for (int i = 0; i < nVideo; i++) {
		VIDEO_CAPTURE_INFO vci;
		if (XIS_GetVideoCaptureInfo(i, &vci)) {
			pSubMenu->InsertMenu(i + 1, MF_BYPOSITION, ID_DEVICE_BEGIN + 1 + i, vci.szName);
		}
	}

	// Init Audio Device
	int nAudio = XIS_GetAudioCaptureCount();
	LOG(INFO) << "XIS_GetAudioCaptureCount(): " << nAudio;
	if (nAudio > 0) {
		pSubMenu->InsertMenu(nVideo + 1, MF_BYPOSITION, MF_SEPARATOR);

		for (int i = 0; i < nAudio; i++) {
			AUDIO_CAPTURE_INFO_EX aci;
			if (XIS_GetAudioCaptureInfoEx(i, &aci)) {
				pSubMenu->InsertMenu(nVideo + i + 2, MF_BYPOSITION, ID_DEVICE_BEGIN + nVideo + 1 + i, aci.szName);
			}
		}
	}

	pSubMenu->DeleteMenu(0, MF_BYPOSITION);

#if defined(USE_FOR_BARCODE)
	SetWindowText(_T("ÖÐÔÆÖǻ۶þάÂë½ØÆÁ³ÌÐò"));
	LOG(INFO) << "SetWindowText: ÖÐÔÆÖǻ۶þάÂë½ØÆÁ³ÌÐò";
#else
	SetWindowText(_T("ÖÐÔÆÖÇ»ÛX¹â»ú½ØÆÁ³ÌÐò"));
	LOG(INFO) << "SetWindowText: ÖÐÔÆÖÇ»ÛX¹â»ú½ØÆÁ³ÌÐò";
#endif

	return 0;
}
Пример #17
0
void CMonitorWnd::OnDestroy() 
{
	CChildWnd::OnDestroy();
	
	CMenu* pMainMenu = AfxGetMainWnd()->GetMenu();
	pMainMenu->DeleteMenu( (UINT)m_hSubMenu, MF_BYCOMMAND );
	
	pMainMenu->Detach();
	AfxGetMainWnd()->DrawMenuBar(); 
	
	m_wndChild.DestroyWindow();
	BreakMirrorView();
	
	Network.CallWorker( NULL, 1000 );
}
Пример #18
0
void asteroid_editor::OnInitMenu(CMenu* pMenu)
{
	int i;
	CString str;
	CMenu *m;

	m = pMenu->GetSubMenu(0);
	clear_menu(m);
	i = 0; //for (i=0; i<MAX_ASTEROID_FIELDS; i++) {
		str.Format("Asteroid Field %d", i);
		m->AppendMenu(MF_ENABLED | MF_STRING, ID_FIELD_MENU + i, str);
	//}

	m->DeleteMenu(ID_PLACEHOLDER, MF_BYCOMMAND);
	if (cur_field != -1)
		m->CheckMenuItem(ID_FIELD_MENU + cur_field, MF_BYCOMMAND | MF_CHECKED);

	CDialog::OnInitMenu(pMenu);
}
Пример #19
0
void CSignInDlg::OnNMRClickListUser(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
	// TODO: 在此添加控件通知处理程序代码
	DWORD dwPos = GetMessagePos();
	CPoint point(LOWORD(dwPos),HIWORD(dwPos));

	CMenu menu;

	menu.LoadMenu(IDR_MENU_USER);

	CMenu *popue = menu.GetSubMenu(0);

	if (pNMItemActivate->iItem == -1)
	{
		popue->DeleteMenu(ID_USER_DELETE,MF_BYCOMMAND);
	}

	popue->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,point.x,point.y,this);
	*pResult = 0;
}
Пример #20
0
void CGeneralCRC::OnDelete()
{
	// First check that we selected from the list (using Select menu)
	// else we don't know what to delete
	if (last_selected_ < last_predefined_ || last_selected_ >= settings_.size())
	{
		assert(0);   // Code should prevent this from happening
		return;
	}

	// Delete from the Select menu
	CMenu menu;
	menu.Attach(select_menu_.m_hMenu);
	CString strName = get_menu_text(&menu, last_selected_);  // save mneu item name - used to delete reg value by name

	CString mess;
	mess.Format("Are you sure you want to delete the settings for %s", strName);
	if (TaskMessageBox("Delete CRC Settings", mess, MB_YESNO) != IDYES)
	{
		menu.Detach();
		return;
	}
	menu.DeleteMenu(last_selected_, MF_BYCOMMAND);  // Delete menu item with selected ID
	menu.Detach();

	// Delete from settings_ (where ID == last_selected_ is the index into the array)
	settings_[last_selected_] = CString("");  // clear but don't delete unused entries (else menu item ID's won't mathc array indices)

	// Remove the setting from the registry
	HKEY hkey;
	if (::RegCreateKey(HKEY_CURRENT_USER, reg_locn, &hkey) == ERROR_SUCCESS)
	{
		::RegDeleteValue(hkey, strName);
		::RegCloseKey(hkey);
	}

	// Disable Delete button now as we just deleted it
	GetDlgItem(IDC_CRC_DELETE)->EnableWindow(FALSE);
}
Пример #21
0
/**
 * スキン変更。
 *
 * さらにスキン一覧のメニューを表示する
 */
void CMainFrame::OnChangeSkin()
{
	CMenu menu;
	menu.LoadMenu(IDR_SKIN_MENU);
	CMenu* pcThisMenu = menu.GetSubMenu(0);

	// スキンフォルダの一覧を生成する
	std::vector<std::wstring> skinfileList;
	GetSkinFolderNameList(skinfileList);

	// リスト化
	for( int i=0; i<(int)skinfileList.size(); i++ ) {
		UINT flag = MF_STRING | MF_ENABLED;

		LPCTSTR filename = skinfileList[i].c_str();

		// 現在のスキンであればチェック
		if (filename == theApp.m_optionMng.m_strSkinname) {
			flag |= MF_CHECKED;
		}

		// スキンタイトルを取得
		CString title = CMZ3SkinInfo::loadSkinTitle( filename );

		// スキン名も追加する
		if (title != filename) {
			title.AppendFormat( L" (%s)", filename );
		}

		pcThisMenu->AppendMenu( flag, ID_SKIN_BASE+i, title );
	}

	// ダミーを削除
	pcThisMenu->DeleteMenu( ID_SKIN_DUMMY, MF_BYCOMMAND );

	POINT pt    = util::GetPopupPos();
	int   flags = util::GetPopupFlags();
	menu.GetSubMenu(0)->TrackPopupMenu(flags, pt.x, pt.y, this);
}
Пример #22
0
void RDOEditorMainFrame::updateReopenSubMenu() const
{
	CMenu* reopenMenu = AfxGetMainWnd()->GetMenu()->GetSubMenu( 0 )->GetSubMenu( 2 );

	while ( reopenMenu->GetMenuItemCount() ) {
		reopenMenu->DeleteMenu( 0, MF_BYPOSITION );
	}

	if ( !reopenList.IsEmpty() ) {
		AfxGetMainWnd()->GetMenu()->GetSubMenu( 0 )->EnableMenuItem( 2, MF_BYPOSITION | MF_ENABLED );
		for ( int i = 0; i < reopenList.GetCount(); i++ ) {
			if ( i == 4 ) reopenMenu->AppendMenu( MF_SEPARATOR );
			int id = ID_FILE_MRU_FILE1;
			switch( i ) {
				case 0: id = ID_FILE_REOPEN_1; break;
				case 1: id = ID_FILE_REOPEN_2; break;
				case 2: id = ID_FILE_REOPEN_3; break;
				case 3: id = ID_FILE_REOPEN_4; break;
				case 4: id = ID_FILE_REOPEN_5; break;
				case 5: id = ID_FILE_REOPEN_6; break;
				case 6: id = ID_FILE_REOPEN_7; break;
				case 7: id = ID_FILE_REOPEN_8; break;
				case 8: id = ID_FILE_REOPEN_9; break;
				case 9: id = ID_FILE_REOPEN_10; break;
			}
			POSITION pos = reopenList.FindIndex( i );
			CString s;
			s.Format( "%d. %s", i+1, reopenList.GetAt( pos ) );
			reopenMenu->AppendMenu( MF_STRING, id, s );
		}
	} else {
		AfxGetMainWnd()->GetMenu()->GetSubMenu( 0 )->EnableMenuItem( 2, MF_BYPOSITION | MF_DISABLED | MF_GRAYED );
	}

	saveReopen();
}
Пример #23
0
void CMainFrame::BuildStreamList(Bool reset_only)
{
	u32 nb_subs;
	CMenu *pSelect;
	WinGPAC *app = GetApp();

	pSelect = GetMenu()->GetSubMenu(2)->GetSubMenu(0);
	/*THIS IS HARCODED FROM THE MENU LAYOUT */
	CMenu *pMenu = pSelect->GetSubMenu(0);
	while (pMenu->GetMenuItemCount()) pMenu->DeleteMenu(0, MF_BYPOSITION);
	pMenu = pSelect->GetSubMenu(1);
	while (pMenu->GetMenuItemCount()) pMenu->DeleteMenu(0, MF_BYPOSITION);
	pMenu = pSelect->GetSubMenu(2);
	while (pMenu->GetMenuItemCount()) pMenu->DeleteMenu(0, MF_BYPOSITION);

	if (reset_only) {
		m_bFirstStreamQuery = 1;
		return;
	}
	if (!app->m_isopen || !M4T_GetOption(app->m_term, M4O_HasSelectableStreams)) return;

	LPODMANAGER root_od = M4T_GetRootOD(app->m_term);
	if (!root_od) return;
	u32 count = M4T_GetODCount(app->m_term, root_od);
	nb_subs = 0;

	for (u32 i=0; i<count; i++) {
		char szLabel[1024];
		ODInfo info;
		LPODMANAGER odm = M4T_GetODManager(app->m_term, root_od, i);
		if (!odm) return;
		LPODMANAGER remote = odm;
		while (1) {
			remote = M4T_GetRemoteOD(app->m_term, odm);
			if (remote) odm = remote;
			else break;
		}

		if (M4T_GetODInfo(app->m_term, odm, &info) != M4OK) break;
		if (info.owns_service) {
			char *szName = strrchr(info.service_url, '\\');
			if (!szName) szName = strrchr(info.service_url, '/');
			if (!szName) szName = (char *) info.service_url;
			else szName += 1;
			strcpy(szLabel, szName);
			szName = strrchr(szLabel, '.');
			if (szName) szName[0] = 0;
		}

		switch (info.od_type) {
		case M4ST_AUDIO:
			pMenu = pSelect->GetSubMenu(0);
			if (!info.owns_service) sprintf(szLabel, "Audio #%d", pMenu->GetMenuItemCount() + 1);
			pMenu->AppendMenu(MF_ENABLED, ID_SELOBJ_0 + i, szLabel);
			break;
		case M4ST_VISUAL:
			pMenu = pSelect->GetSubMenu(1);
			if (!info.owns_service) sprintf(szLabel, "Video #%d", pMenu->GetMenuItemCount() + 1);
			pMenu->AppendMenu(MF_ENABLED, ID_SELOBJ_0 + i, szLabel);
			break;
		case M4ST_TEXT:
			nb_subs ++;
			pMenu = pSelect->GetSubMenu(2);
			if (!info.owns_service) sprintf(szLabel, "Subtitle #%d", pMenu->GetMenuItemCount() + 1);
			pMenu->AppendMenu(MF_ENABLED, ID_SELOBJ_0 + i, szLabel);
			break;
		}
	}
	if (m_bFirstStreamQuery) {
		m_bFirstStreamQuery = 0;
		if (!nb_subs && app->m_LookForSubtitles) LookForSubtitles();
	}

}
Пример #24
0
void CHello2Dlg::OnLbnDblclkList3()
{
	// TODO: 在此添加控件通知处理程序代码
  CMenu   mainmenu;    
  mainmenu.LoadMenu(IDR_SELPROBE);

  CMenu *pM = mainmenu.GetSubMenu(0);
  //remove the existing menu
  CString   str   ;  
  
  for(int   i=pM->GetMenuItemCount()-1;i>=0;i--)   //取得菜单的项数。  
  {    
          pM->GetMenuString(i,str,MF_BYPOSITION);    
          //将指定菜单项的标签拷贝到指定的缓冲区。MF_BYPOSITION的解释见上。    
		  pM->DeleteMenu(i,MF_BYPOSITION);   
  }
  
  CSetting<PROBECFG> prbset;
  prbset.InstallFromFile(PRB_DEFINFO);			
  CString namelist = prbset.GetTitleList('|');	

  int curch = m_chlist.GetCurSel();
  if(curch < 0)
	  return;

  if(m_cfgtype == CFGTYPE_BORE)
  {
	int j = 1;
	pM->AppendMenu(MF_STRING,ID_32771,_T("关闭"));

	while(namelist.Find('|',0) >= 0){
		CString item = namelist.Left(namelist.Find('|',0));
		pM->AppendMenu(MF_STRING,ID_32771+j,item);   //添加新的菜单项		
		namelist.Delete(0,item.GetLength() + 1);
		j = j+1;
	}
	m_cmdbase = ID_32771;
  }
  if(m_cfgtype == CFGTYPE_THMO)
  {
	  //TBEJKNRS
	  m_cmdbase = ID_32771;;
	  pM->AppendMenu(MF_STRING,ID_32771,_T("关闭"));
	  pM->AppendMenu(MF_STRING,ID_32772,_T("T型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32773,_T("B型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32774,_T("E型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32775,_T("J型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32776,_T("K型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32777,_T("N型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32778,_T("R型热电偶"));
	  pM->AppendMenu(MF_STRING,ID_32779,_T("S型热电偶"));
  }
  CRect rect;
  m_chlist.GetClientRect(&rect);
  
  CPoint pt;
  GetCursorPos(&pt);
  SetForegroundWindow();
  pM->TrackPopupMenu(TPM_LEFTALIGN,pt.x,pt.y,this);
  return;

}
Пример #25
0
BOOL CLibraryApp::InitInstance()
{
	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	// Change the registry key under which our settings are stored.
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization.
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	//Login Dialog
	CLoginDlg cLoginDlg;

	/*
	if(cLoginDlg.DoModal() != IDOK)
		return false;
	*/

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CLibraryDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CLibraryView));
	AddDocTemplate(pDocTemplate);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	if(!cLoginDlg.IsUserType())
	{
		CMenu *menu = m_pMainWnd->GetMenu();
		menu->DeleteMenu(0,MF_BYPOSITION);
		m_pMainWnd->DrawMenuBar();				//ÖØ»æ²Ëµ¥À¸
	}

	// The one and only window has been initialized, so show and update it.
	m_pMainWnd->ShowWindow(SW_SHOW);
	m_pMainWnd->UpdateWindow();

	return TRUE;
}
Пример #26
0
// we use this as a hook to customize the language menu
void CLangModelsDoc::OnUpdateLangProperties(CCmdUI* pCmdUI)
{

	CWnd* pWnd = AfxGetMainWnd();
	//CMenu* pTopMenu = pWnd->GetMenu();

	// this is wierd but it seemed that we have to search for the menu
	// I know, it should be 3, but sometimes our commands ended up in the view menu
/*	CMenu* pMenu = NULL;
	for(int i=2; i < 5; i++)
	{
		CString s;
		pTopMenu->GetMenuString(i, s,  MF_BYPOSITION );
		if(s == "&Language")
		{
			pMenu = pTopMenu->GetSubMenu(i);
			break;
		}
	}
*/
	CMenu* pMenu = pCmdUI->m_pMenu;

	if(!pMenu)	// null when you make a choice in the menu?
		return;

	const int kSynthSeqIndex = 3;
	//const int kItemsAfterTransfer = 2;

	const CTypedPtrArray<CPtrArray, CLangModelsDoc*>& pLangDocs = getProject()->getLangDocs();

	// remove existing transfer menu items
	for(	int z=pMenu->GetMenuItemCount();
			z >= 0; z--)
	{
		int iCMD = pMenu->GetMenuItemID(z);
		// is this a transfer sequence item?
		if(iCMD >= kTransferCMDBase && iCMD <= (kTransferCMDBase+ pLangDocs.GetSize()-1))
			pMenu->DeleteMenu(z, MF_BYPOSITION );
	}
	// now we should have the menu as in the resource editor

	// stick in an item for each transfer process sequence
	// note that this is written with the assumption that there
	// is one transfer sequence for each other language in the
	// project
	int iItem = kSynthSeqIndex;	// which menu item
	int iCount = 0;	// index into the transfer sequences
	for(int iTrg=0; iTrg<pLangDocs.GetSize(); iTrg++)
	{
		if(pLangDocs[iTrg] != this)
		{
#ifndef hab17a1
				CString s("Transfer ");
				if ((m_pLang->m_wDisplayFlags & m_pLang->kLocateTransferWithTarget) > 0)
			  s += "From ";
			else
			  s += "To ";
#else // hab17a1
			CString s("Transfer To ");
#endif // hab17a1
			s += pLangDocs[iTrg]->getLang()->getName();
			s += " Sequence...";
			pMenu->InsertMenu(iItem,
				MF_ENABLED | MF_BYPOSITION | MF_STRING ,
				kTransferCMDBase + iCount, // cmd id
				s);
			iItem++; iCount++;
		}
	}
	pWnd->DrawMenuBar();
}
Пример #27
0
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;
}
Пример #28
0
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;
}
Пример #29
0
BOOL CEOSSPropertySheet::OnInitDialog() 
{
	BOOL bResult = CPropertySheet::OnInitDialog();
	CRect WindowRect;
	CRect FinalRect;
	GetWindowRect(&WindowRect);
	WindowRect.bottom += 60;
	MoveWindow(&WindowRect);
	int Interspace = 6;

	int ButtonWidth = (WindowRect.right - WindowRect.left)/5 - 6*Interspace;
	if (ButtonWidth < 100) 
		ButtonWidth = 116;
	else
		ButtonWidth = 157;

	FinalRect = WindowRect;
	ScreenToClient(FinalRect);
	int Y1 = FinalRect.bottom - 60;
	int Y2 = FinalRect.bottom - 10;

	DWORD dwStyle = WS_CHILD | WS_TABSTOP | WS_VISIBLE |
		  BS_PUSHBUTTON | BS_MULTILINE | BS_CENTER;

	m_pCloseButton->Create( "Close", dwStyle,
		  CRect(Interspace, Y1,
				Interspace + ButtonWidth,Y2),
		  this,
		  ID_CLOSE_BUTTON);

	m_pPauseButton->Create(COLLECTINGBEGIN, dwStyle,
		  CRect(2*Interspace + ButtonWidth,Y1,
				2*Interspace + 2*ButtonWidth,Y2),
		  this,
		  ID_PAUSE_BUTTON);

	m_pAckFlagsButton->Create("Acknowledge Flags",dwStyle,
		  CRect(3*Interspace + 2*ButtonWidth,Y1,
				3*Interspace + 3*ButtonWidth,Y2),
		  this,
		  ID_ACKFL_BUTTON);

	m_pPrintButton->Create("Snapshot Status\nTo File",dwStyle,
		  CRect(4*Interspace + 3*ButtonWidth,Y1,
				4*Interspace + 4*ButtonWidth,Y2),
		  this,
		  ID_PRINT_BUTTON);

	char temp[32];
	int minutes = (m_pParent->m_iDlgCloseMilliseconds/1000-m_dToClose)/60;
	int seconds   = (m_pParent->m_iDlgCloseMilliseconds/1000-m_dToClose) % 60;
	sprintf(temp,"Extend Auto\nClose: %d:%02d",minutes,seconds);

	m_pToClose->Create(temp,dwStyle,
		  CRect(5*Interspace + 4*ButtonWidth,Y1,
				5*Interspace + 5*ButtonWidth,Y2),
		this,
		ID_TOCLOSE);

	CMenu* pSysMenu = GetSystemMenu(FALSE);

	if (pSysMenu != NULL)
	{
		pSysMenu->DeleteMenu( SC_SIZE, MF_BYCOMMAND);
		pSysMenu->DeleteMenu( SC_MAXIMIZE, MF_BYCOMMAND);
	}
	
	GetTabControl( )->SetImageList(m_pImageList);
	GetTabControl( )->ModifyStyle(TCS_MULTILINE,TCS_SINGLELINE);
	TC_ITEM pTabCtrlItem;
	pTabCtrlItem.mask = TCIF_IMAGE;
	pTabCtrlItem.iImage = 1;
	GetTabControl()->SetItem(1,&pTabCtrlItem);

	return bResult;
}
Пример #30
0
LRESULT CRunDlg::OnContextMenu(UINT , WPARAM , LPARAM lp, BOOL &)
{
	cfg::config *c = cfg::config::instance();
	CMenu menu;
	menu.LoadMenuW(IDR_MENU_POPUP);
	CMenu mu = (HMENU)menu.GetSubMenu(0);

	POINT pt = {-1, -1};
	if (lp == 0xFFFFFFFF) // 菜单不是右键激活的而是按键激活的
	{
		hlp::track_mouse_event(TME_CANCEL|TME_LEAVE, m_hWnd);
		if (m_curr_prog_pos != pp_null)
		{
			lyt::icon_layout *il = dynamic_cast<lyt::icon_layout *>(m_lyt);
			if (il != NULL)
			{
				RECT rc = il->get_prog_rect(m_curr_prog_pos);
				m_menu_point.x = (rc.left + rc.right) / 2;
				m_menu_point.y = (rc.top + rc.bottom) / 2;
				pt = m_menu_point;
				ClientToScreen(&pt);
			}
		}
	}
	if (pt.x == -1)
	{
		::GetCursorPos(&pt);
		m_menu_point = pt;
		ScreenToClient(&m_menu_point);
	}

	if (c->gm.layout != cfg::ul_group)
	{
		mu.DeleteMenu(ID_INSERT_GROUP, MF_BYCOMMAND);
		mu.DeleteMenu(ID_EDIT_GROUP, MF_BYCOMMAND);
		mu.DeleteMenu(ID_DEL_GROUP, MF_BYCOMMAND);
	}
	if (c->gm.layout == cfg::ul_simple)
	{
		mu.DeleteMenu(ID_INSERT_PROG, MF_BYCOMMAND);
		mu.DeleteMenu(ID_EDIT_PROG, MF_BYCOMMAND);
		mu.DeleteMenu(ID_DEL_PROG, MF_BYCOMMAND);
	}

	if (m_lyt->get_insert_pos(m_menu_point) == pp_null)
	{
		mu.EnableMenuItem(ID_INSERT_PROG, MF_BYCOMMAND | MF_GRAYED);
//		mu.EnableMenuItem(ID_INSERT_GROUP, MF_BYCOMMAND | MF_GRAYED);
		mu.EnableMenuItem(ID_EDIT_GROUP, MF_BYCOMMAND | MF_GRAYED);
		mu.EnableMenuItem(ID_DEL_GROUP, MF_BYCOMMAND | MF_GRAYED);
	}
	if (m_lyt->get_prog_from_point(m_menu_point) == pp_null)
	{
		mu.EnableMenuItem(ID_EDIT_PROG, MF_BYCOMMAND | MF_GRAYED);
		mu.EnableMenuItem(ID_DEL_PROG, MF_BYCOMMAND | MF_GRAYED);
	}
	// 显示样式前面的对勾
	UINT lyt_id;
	switch (c->gm.layout)
	{
	case cfg::ul_simple: lyt_id = ID_CHLYT_SIMPLE; break;
	case cfg::ul_plain:  lyt_id = ID_CHLYT_PLAIN; break;
	default:             lyt_id = ID_CHLYT_GROUP; break;
	}
	mu.CheckMenuItem(lyt_id, MF_BYCOMMAND|MF_CHECKED);
	UINT style_id;
	switch (c->gm.style)
	{
	case cfg::ws_edge:  style_id = ID_CHSTYLE_EDGE; break;
	default:            style_id = ID_CHSTYLE_CENTER; break;
	}
	mu.CheckMenuItem(style_id, MF_BYCOMMAND|MF_CHECKED);

	// 删除多余的分隔线
	for (int i = mu.GetMenuItemCount() - 1; i > 0; i--)
	{
		if (mu.GetMenuStringLen(i,   MF_BYPOSITION) == 0 &&
			mu.GetMenuStringLen(i-1, MF_BYPOSITION) == 0)
		{
			mu.DeleteMenu(i, MF_BYPOSITION);
		}
	}

	KillTimer(IDT_AUTO_FOLD); // 菜单消失前不能让窗口自动隐藏
	mu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, m_hWnd);
	change_op_state(os_hover);
	return TRUE;
}