示例#1
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWndEx::OnCreate(lpCreateStruct) == -1)
		return -1;

	BOOL bNameValid;

	/*if (!m_wndMenuBar.Create(this))
	{
		TRACE0("未能创建菜单栏\n");
		return -1;      // 未能创建
	}

	m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY);*/

	if (!m_OperToolBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_WRAPABLE | TBSTYLE_TOOLTIPS,
		WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_OperToolBar.LoadBitmap(IDB_BOPER) || !m_OperToolBar.SetButtons(style, sizeof(style) / sizeof(UINT)))
	{
		TRACE0("未能创建工具栏\n");
		return -1;      // 未能创建
	}
	m_OperToolBar.SetButtons(style, 7);
	m_OperToolBar.SetButtonInfo(0, ID_START, TBBS_BUTTON, 0);
	m_OperToolBar.SetButtonInfo(1, ID_ZOOMOUT, TBBS_BUTTON, 1);
	m_OperToolBar.SetButtonInfo(2, ID_ZOOMIN, TBBS_BUTTON, 2);
	m_OperToolBar.SetButtonInfo(3, ID_PAUSE, TBBS_BUTTON, 3);
	m_OperToolBar.SetButtonInfo(4, ID_STOP, TBBS_BUTTON, 4);
	m_OperToolBar.SetButtonInfo(5, ID_COLORPANE, TBBS_BUTTON, 5);
	m_OperToolBar.SetButtonInfo(6, ID_DRAWFLAGE, TBBS_BUTTON, 6);


	// 防止菜单栏在激活时获得焦点
	//CMFCPopupMenu::SetForceMenuFocus(FALSE);

	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME))
	{
		TRACE0("未能创建工具栏\n");
		return -1;      // 未能创建
	}



	CString strToolBarName;
	bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD);
	ASSERT(bNameValid);
	m_wndToolBar.SetWindowText(strToolBarName);
	

	CString strCustomize;
	bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
	ASSERT(bNameValid);
	m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);

	// 允许用户定义的工具栏操作: 
	InitUserToolbars(NULL, uiFirstUserToolBarId, uiLastUserToolBarId);

	if (!m_wndStatusBar.Create(this))
	{
		TRACE0("未能创建状态栏\n");
		return -1;      // 未能创建
	}
	m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));

	// TODO:  如果您不希望工具栏和菜单栏可停靠,请删除这五行
	//m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	m_OperToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	//DockPane(&m_wndMenuBar);
	DockPane(&m_wndToolBar);
	DockPane(&m_OperToolBar);

	// 启用 Visual Studio 2005 样式停靠窗口行为
	CDockingManager::SetDockingMode(DT_SMART);
	// 启用 Visual Studio 2005 样式停靠窗口自动隐藏行为
	EnableAutoHidePanes(CBRS_ALIGN_ANY);

	// 创建停靠窗口
	if (!CreateDockingWindows())
	{
		TRACE0("未能创建停靠窗口\n");
		return -1;
	}

	m_wndOutput.EnableDocking(CBRS_ALIGN_ANY);
	DockPane(&m_wndOutput);

	// 基于持久值设置视觉管理器和样式
	OnApplicationLook(theApp.m_nAppLook);

	// 启用工具栏和停靠窗口菜单替换
	EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR);

	// 启用快速(按住 Alt 拖动)工具栏自定义
	CMFCToolBar::EnableQuickCustomization();

	if (CMFCToolBar::GetUserImages() == NULL)
	{
		// 加载用户定义的工具栏图像
		if (m_UserImages.Load(_T(".\\UserImages.bmp")))
		{
			CMFCToolBar::SetUserImages(&m_UserImages);
		}
	}

	// 启用菜单个性化(最近使用的命令)
	// TODO:  定义您自己的基本命令,确保每个下拉菜单至少有一个基本命令。
	CList<UINT, UINT> lstBasicCommands;

	lstBasicCommands.AddTail(ID_FILE_NEW);
	lstBasicCommands.AddTail(ID_FILE_OPEN);
	lstBasicCommands.AddTail(ID_FILE_SAVE);
	lstBasicCommands.AddTail(ID_FILE_PRINT);
	lstBasicCommands.AddTail(ID_APP_EXIT);
	lstBasicCommands.AddTail(ID_EDIT_CUT);
	lstBasicCommands.AddTail(ID_EDIT_PASTE);
	lstBasicCommands.AddTail(ID_EDIT_UNDO);
	lstBasicCommands.AddTail(ID_APP_ABOUT);
	lstBasicCommands.AddTail(ID_VIEW_STATUS_BAR);
	lstBasicCommands.AddTail(ID_VIEW_TOOLBAR);
	lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2003);
	lstBasicCommands.AddTail(ID_VIEW_APPLOOK_VS_2005);
	lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLUE);
	lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_SILVER);
	lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLACK);
	lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_AQUA);
	lstBasicCommands.AddTail(ID_VIEW_APPLOOK_WINDOWS_7);

	CMFCToolBar::SetBasicCommands(lstBasicCommands);
	CString dir;
	m_UserCfg.GetUserPath(m_UserCfg.GetCurUser(), dir);
	((CCoreModelDoc*)GetActiveDocument())->SetCurUser(dir);

	return 0;
}
示例#2
0
void PaletteSubDialog::SaveSettings()
{
    BaseContainer bc;
    ToContainer(bc);
    GetActiveDocument()->BaseList2D::GetDataInstance()->GetContainerInstance(PALETTE_SCENE_HOOK_ID)->SetContainer(m_id, bc);
}
示例#3
0
void CMainFrame::OnEditCommand() 
{
	// TODO: Add your command handler code here
	CCommandDlg dlg(this);
	CMyCommDoc   *Doc   =  (CMyCommDoc   *)GetActiveDocument();
	dlg.m_strName_1    = Doc->m_Command[0].m_strName;
	dlg.m_strCommand_1 = Doc->m_Command[0].m_strCommand;
	dlg.m_IsHex_1      = Doc->m_Command[0].m_IsHex;
	dlg.m_IsScript_1   = Doc->m_Command[0].m_isScript;
	
	dlg.m_strName_2    = Doc->m_Command[1].m_strName;
	dlg.m_strCommand_2 = Doc->m_Command[1].m_strCommand;
	dlg.m_IsHex_2      = Doc->m_Command[1].m_IsHex;
	dlg.m_IsScript_2   = Doc->m_Command[1].m_isScript;

	dlg.m_strName_3    = Doc->m_Command[2].m_strName;
	dlg.m_strCommand_3 = Doc->m_Command[2].m_strCommand;
	dlg.m_IsHex_3      = Doc->m_Command[2].m_IsHex;
	dlg.m_IsScript_3   = Doc->m_Command[2].m_isScript;

	dlg.m_strName_4    = Doc->m_Command[3].m_strName;
	dlg.m_strCommand_4 = Doc->m_Command[3].m_strCommand;
	dlg.m_IsHex_4      = Doc->m_Command[3].m_IsHex;
	dlg.m_IsScript_4   = Doc->m_Command[3].m_isScript;

	dlg.m_strName_5    = Doc->m_Command[4].m_strName;
	dlg.m_strCommand_5 = Doc->m_Command[4].m_strCommand;
	dlg.m_IsHex_5      = Doc->m_Command[4].m_IsHex;
	dlg.m_IsScript_5   = Doc->m_Command[4].m_isScript;

	dlg.m_strName_6    = Doc->m_Command[5].m_strName;
	dlg.m_strCommand_6 = Doc->m_Command[5].m_strCommand;
	dlg.m_IsHex_6      = Doc->m_Command[5].m_IsHex;
	dlg.m_IsScript_6   = Doc->m_Command[5].m_isScript;
	
	dlg.m_strName_7    = Doc->m_Command[6].m_strName;
	dlg.m_strCommand_7 = Doc->m_Command[6].m_strCommand;
	dlg.m_IsHex_7      = Doc->m_Command[6].m_IsHex;
	dlg.m_IsScript_7   = Doc->m_Command[6].m_isScript;
	
	dlg.m_strName_8    = Doc->m_Command[7].m_strName;
	dlg.m_strCommand_8 = Doc->m_Command[7].m_strCommand;
	dlg.m_IsHex_8      = Doc->m_Command[7].m_IsHex;
	dlg.m_IsScript_8   = Doc->m_Command[7].m_isScript;
	
	dlg.m_strName_9    = Doc->m_Command[8].m_strName;
	dlg.m_strCommand_9 = Doc->m_Command[8].m_strCommand;
	dlg.m_IsHex_9      = Doc->m_Command[8].m_IsHex;
	dlg.m_IsScript_9   = Doc->m_Command[8].m_isScript;

	dlg.m_strName_10    = Doc->m_Command[9].m_strName;
	dlg.m_strCommand_10 = Doc->m_Command[9].m_strCommand;
	dlg.m_IsHex_10      = Doc->m_Command[9].m_IsHex;
	dlg.m_IsScript_10   = Doc->m_Command[9].m_isScript;

	dlg.m_strName_11    = Doc->m_Command[10].m_strName;
	dlg.m_strCommand_11 = Doc->m_Command[10].m_strCommand;
	dlg.m_IsHex_11      = Doc->m_Command[10].m_IsHex;
	dlg.m_IsScript_11   = Doc->m_Command[10].m_isScript;

	dlg.m_strName_12    = Doc->m_Command[11].m_strName;
	dlg.m_strCommand_12 = Doc->m_Command[11].m_strCommand;
	dlg.m_IsHex_12      = Doc->m_Command[11].m_IsHex;
	dlg.m_IsScript_12   = Doc->m_Command[11].m_isScript;
	
	dlg.m_strName_13    = Doc->m_Command[12].m_strName;
	dlg.m_strCommand_13 = Doc->m_Command[12].m_strCommand;
	dlg.m_IsHex_13      = Doc->m_Command[12].m_IsHex;
	dlg.m_IsScript_13   = Doc->m_Command[12].m_isScript;


	dlg.m_strName_14    = Doc->m_Command[13].m_strName;
	dlg.m_strCommand_14 = Doc->m_Command[13].m_strCommand;
	dlg.m_IsHex_14      = Doc->m_Command[13].m_IsHex;
	dlg.m_IsScript_14   = Doc->m_Command[13].m_isScript;

	dlg.m_strName_15    = Doc->m_Command[14].m_strName;
	dlg.m_strCommand_15 = Doc->m_Command[14].m_strCommand;
	dlg.m_IsHex_15      = Doc->m_Command[14].m_IsHex;
	dlg.m_IsScript_15   = Doc->m_Command[14].m_isScript;

	dlg.m_strName_16    = Doc->m_Command[15].m_strName;
	dlg.m_strCommand_16 = Doc->m_Command[15].m_strCommand;
	dlg.m_IsHex_16      = Doc->m_Command[15].m_IsHex;
	dlg.m_IsScript_16   = Doc->m_Command[15].m_isScript;

	dlg.m_strName_17    = Doc->m_Command[16].m_strName;
	dlg.m_strCommand_17 = Doc->m_Command[16].m_strCommand;
	dlg.m_IsHex_17      = Doc->m_Command[16].m_IsHex;
	dlg.m_IsScript_17   = Doc->m_Command[16].m_isScript;

	dlg.m_strName_18    = Doc->m_Command[17].m_strName;
	dlg.m_strCommand_18 = Doc->m_Command[17].m_strCommand;
	dlg.m_IsHex_18      = Doc->m_Command[17].m_IsHex;
	dlg.m_IsScript_18   = Doc->m_Command[17].m_isScript;

	dlg.m_strName_19    = Doc->m_Command[18].m_strName;
	dlg.m_strCommand_19 = Doc->m_Command[18].m_strCommand;
	dlg.m_IsHex_19      = Doc->m_Command[18].m_IsHex;
	dlg.m_IsScript_19   = Doc->m_Command[18].m_isScript;

	dlg.m_strName_20    = Doc->m_Command[19].m_strName;
	dlg.m_strCommand_20 = Doc->m_Command[19].m_strCommand;
	dlg.m_IsHex_20      = Doc->m_Command[19].m_IsHex;
	dlg.m_IsScript_20   = Doc->m_Command[19].m_isScript;

    UpdateData(FALSE);
	if (dlg.DoModal()==IDOK)
	{
		UpdateData(TRUE);
		Doc->m_Command[0].m_strName    = dlg.m_strName_1;
		Doc->m_Command[0].m_strCommand = dlg.m_strCommand_1;
		Doc->m_Command[0].m_IsHex = dlg.m_IsHex_1;
		Doc->m_Command[0].m_isScript = dlg.m_IsScript_1;

		Doc->m_Command[1].m_strName    = dlg.m_strName_2;
		Doc->m_Command[1].m_strCommand = dlg.m_strCommand_2;
		Doc->m_Command[1].m_IsHex = dlg.m_IsHex_2;
		Doc->m_Command[1].m_isScript = dlg.m_IsScript_2;

		Doc->m_Command[2].m_strName    = dlg.m_strName_3;
		Doc->m_Command[2].m_strCommand = dlg.m_strCommand_3;
		Doc->m_Command[2].m_IsHex = dlg.m_IsHex_3;
		Doc->m_Command[2].m_isScript = dlg.m_IsScript_3;

		Doc->m_Command[3].m_strName    = dlg.m_strName_4;
		Doc->m_Command[3].m_strCommand = dlg.m_strCommand_4;
		Doc->m_Command[3].m_IsHex = dlg.m_IsHex_4;
		Doc->m_Command[3].m_isScript = dlg.m_IsScript_4;

		Doc->m_Command[4].m_strName    = dlg.m_strName_5;
		Doc->m_Command[4].m_strCommand = dlg.m_strCommand_5;
		Doc->m_Command[4].m_IsHex = dlg.m_IsHex_5;
		Doc->m_Command[4].m_isScript = dlg.m_IsScript_5;

		Doc->m_Command[5].m_strName    = dlg.m_strName_6;
		Doc->m_Command[5].m_strCommand = dlg.m_strCommand_6;
		Doc->m_Command[5].m_IsHex = dlg.m_IsHex_6;
		Doc->m_Command[5].m_isScript = dlg.m_IsScript_6;

		Doc->m_Command[6].m_strName    = dlg.m_strName_7;
		Doc->m_Command[6].m_strCommand = dlg.m_strCommand_7;
		Doc->m_Command[6].m_IsHex = dlg.m_IsHex_7;
		Doc->m_Command[6].m_isScript = dlg.m_IsScript_7;

		Doc->m_Command[7].m_strName    = dlg.m_strName_8;
		Doc->m_Command[7].m_strCommand = dlg.m_strCommand_8;
		Doc->m_Command[7].m_IsHex = dlg.m_IsHex_8;
		Doc->m_Command[7].m_isScript = dlg.m_IsScript_8;

		Doc->m_Command[8].m_strName    = dlg.m_strName_9;
		Doc->m_Command[8].m_strCommand = dlg.m_strCommand_9;
		Doc->m_Command[8].m_IsHex = dlg.m_IsHex_9;
		Doc->m_Command[8].m_isScript = dlg.m_IsScript_9;

		Doc->m_Command[9].m_strName    = dlg.m_strName_10;
		Doc->m_Command[9].m_strCommand = dlg.m_strCommand_10;
		Doc->m_Command[9].m_IsHex = dlg.m_IsHex_10;
		Doc->m_Command[9].m_isScript = dlg.m_IsScript_10;

		Doc->m_Command[10].m_strName    = dlg.m_strName_11;
		Doc->m_Command[10].m_strCommand = dlg.m_strCommand_11;
		Doc->m_Command[10].m_IsHex = dlg.m_IsHex_11;
		Doc->m_Command[10].m_isScript = dlg.m_IsScript_11;

		Doc->m_Command[11].m_strName    = dlg.m_strName_12;
		Doc->m_Command[11].m_strCommand = dlg.m_strCommand_12;
		Doc->m_Command[11].m_IsHex = dlg.m_IsHex_12;
		Doc->m_Command[11].m_isScript = dlg.m_IsScript_12;

		Doc->m_Command[12].m_strName    = dlg.m_strName_13;
		Doc->m_Command[12].m_strCommand = dlg.m_strCommand_13;
		Doc->m_Command[12].m_IsHex = dlg.m_IsHex_13;
		Doc->m_Command[12].m_isScript = dlg.m_IsScript_13;

		Doc->m_Command[13].m_strName    = dlg.m_strName_14;
		Doc->m_Command[13].m_strCommand = dlg.m_strCommand_14;
		Doc->m_Command[13].m_IsHex = dlg.m_IsHex_14;
		Doc->m_Command[13].m_isScript = dlg.m_IsScript_14;

		Doc->m_Command[14].m_strName    = dlg.m_strName_15;
		Doc->m_Command[14].m_strCommand = dlg.m_strCommand_15;
		Doc->m_Command[14].m_IsHex = dlg.m_IsHex_15;
		Doc->m_Command[14].m_isScript = dlg.m_IsScript_15;

		Doc->m_Command[15].m_strName    = dlg.m_strName_16;
		Doc->m_Command[15].m_strCommand = dlg.m_strCommand_16;
		Doc->m_Command[15].m_IsHex = dlg.m_IsHex_16;
		Doc->m_Command[15].m_isScript = dlg.m_IsScript_16;

		Doc->m_Command[16].m_strName    = dlg.m_strName_17;
		Doc->m_Command[16].m_strCommand = dlg.m_strCommand_17;
		Doc->m_Command[16].m_IsHex = dlg.m_IsHex_17;
		Doc->m_Command[16].m_isScript = dlg.m_IsScript_17;

		Doc->m_Command[17].m_strName    = dlg.m_strName_18;
		Doc->m_Command[17].m_strCommand = dlg.m_strCommand_18;
		Doc->m_Command[17].m_IsHex = dlg.m_IsHex_18;

		Doc->m_Command[18].m_strName    = dlg.m_strName_19;
		Doc->m_Command[18].m_strCommand = dlg.m_strCommand_19;
		Doc->m_Command[18].m_IsHex = dlg.m_IsHex_19;
		Doc->m_Command[18].m_isScript = dlg.m_IsScript_19;

		Doc->m_Command[19].m_strName    = dlg.m_strName_20;
		Doc->m_Command[19].m_strCommand = dlg.m_strCommand_20;
		Doc->m_Command[19].m_IsHex = dlg.m_IsHex_20;
		Doc->m_Command[19].m_isScript = dlg.m_IsScript_20;

		//command combox
		CMyCommView * myView = (CMyCommView *)  this->GetActiveView();
		CString myCommandStr;
		myView->m_ctrlCommand.ResetContent();
		for(int i=0 ;i<COMMANDCOUNT ;i++)
		{
			if (!Doc->m_Command[i].m_strName.IsEmpty())
			{
				myCommandStr.Format("%d %s",i+1,Doc->m_Command[i].m_strName);
				myView->m_ctrlCommand.AddString(myCommandStr);
			}
		}
		
	
	}
}
示例#4
0
void
CMainFrame::updateImageInfo()
{
   const CFlyCapDoc* pDoc = (CFlyCapDoc*)GetActiveDocument();
   CView* pView = (CView*)GetActiveView();   
   
   if( m_wndStatusBar &&
      pDoc != NULL && 
      pView != NULL )
   {
      char pszText[ 64 ];
      
      if( m_ImageInfoMode == TIMESTAMP )
      {
         // Setup the timestamp information
         FlyCaptureTimestamp timeStamp = pDoc->m_imageRaw.timeStamp;  
         
#if defined (WIN64)  
         __time64_t  tmpTime = timeStamp.ulSeconds;
         char* pszTemp = ::_ctime64( &tmpTime );
#elif defined (WIN32)
         time_t lTemp = timeStamp.ulSeconds;      
         char* pszTemp = ::ctime( &lTemp );
#else
#error ** No time conversion **
#endif
         if( pszTemp == NULL )
         {
            return;
         }
         int iMilliSec = timeStamp.ulMicroSeconds / 1000;
         sprintf(
            pszText,
            "%.19s.%.03d %s (%03u,%04u)\n",
            pszTemp,
            iMilliSec,
            &pszTemp[ 20 ],
            timeStamp.ulCycleSeconds,
            timeStamp.ulCycleCount );         
      }
      else if( m_ImageInfoMode == CURSOR )
      {
         // Setup the cursor and image information
         CRect rect;
         CPoint pt;
         COLORREF cr;
         int iWidth = 0;
         int iHeight = 0;
         int iSBOffsetX = 0; // the offset of the horizontal scrollbar
         int iSBOffsetY = 0; // the offset of the vertical scrollbar

         // get the position of the scroll bars.
         // used to calculate the co-ordinates of the image.
         iSBOffsetX = pView->GetScrollPos(SB_HORZ);
         iSBOffsetY = pView->GetScrollPos(SB_VERT);
         
         pDoc->getImageSize( &iWidth, &iHeight );
         CDC* pDC = pView->GetDC();
         pDC->GetClipBox( &rect );         
         GetCursorPos( &pt );                  
         pView->ScreenToClient( &pt );
         cr = GetPixel( pDC->GetSafeHdc(), pt.x, pt.y );
         pView->ReleaseDC( pDC );

         // Check that this window is active and 
         // that the cursor is within bounds of the clipping rect
         if( this == GetActiveWindow() &&
            pt.x >= 0 && pt.x < rect.Width() && pt.y >= 0 && pt.y < rect.Height() )
         {
            sprintf( pszText, "Image(%dx%d) Cursor(%d,%d) RGB(%u,%u,%u)", 
               iWidth, 
               iHeight, 
               pt.x + iSBOffsetX,
               pt.y + iSBOffsetY,
               cr & 0xFF, 
               (cr & 0xFF00) >> 8, 
               (cr & 0xFF0000) >> 16 );
         }
示例#5
0
BOOL
CMainFrame::OnNotify( WPARAM wParam, LPARAM lParam, LRESULT* pResult )
{
   const CFlyCapDoc* pDoc = (CFlyCapDoc*)GetActiveDocument();

   NMHDR* pNMHDR = (NMHDR*) lParam;

   //
   // This catches clicks to the status bar fields.
   //
   if( 
      m_wndStatusBar && 
      pDoc != NULL && 
      pNMHDR->hwndFrom == m_wndStatusBar.m_hWnd && 
      pNMHDR->code == NM_CLICK )      
   {
      NMMOUSE* pNMMOUSE = (NMMOUSE*) pNMHDR;
      POINT pt = pNMMOUSE->pt;
      
      CRect itemRect;
      for( int index = 0; index < m_wndStatusBar.GetCount(); index++ )
      {
         m_wndStatusBar.GetItemRect( index, &itemRect );
         if( 
            pt.x > itemRect.left && 
            pt.x < itemRect.right &&
            pt.y > itemRect.top &&
            pt.y < itemRect.bottom )
         {
            //
            // Found the correct item.
            //
            unsigned long* pulMode;
            switch( index )
            {
            case 0:
               // Framerate
               pulMode = (unsigned long*) &m_CameraInfoMode;
               (*pulMode)++;
               if( (*pulMode) >= NUM_CAMERAINFO_MODES )
               {
                  (*pulMode) = 0;
               }
               
               //
               // Update the menu selection
               //
               switch( (*pulMode) )
               {
               case REQUESTED_FPS:
                  GetMenu()->CheckMenuRadioItem( 
                     ID_VIEW_SB_REQUESTEDFPS, 
                     ID_VIEW_SB_DISPLAYEDFPS,
                     ID_VIEW_SB_REQUESTEDFPS,
                     MF_BYCOMMAND );
                  break;
               case PROCESSED_FPS:
                  GetMenu()->CheckMenuRadioItem( 
                     ID_VIEW_SB_REQUESTEDFPS, 
                     ID_VIEW_SB_DISPLAYEDFPS,
                     ID_VIEW_SB_PROCESSEDFPS,
                     MF_BYCOMMAND );
                  break;
               case DISPLAYED_FPS:
                  GetMenu()->CheckMenuRadioItem( 
                     ID_VIEW_SB_REQUESTEDFPS, 
                     ID_VIEW_SB_DISPLAYEDFPS,
                     ID_VIEW_SB_DISPLAYEDFPS,
                     MF_BYCOMMAND );
                  break;
               }
               break;
               case 1:
                  // Image Info
                  pulMode = (unsigned long*) &m_ImageInfoMode;
                  (*pulMode)++;
                  if( (*pulMode) >= NUM_IMAGEINFO_MODES )
                  {
                     (*pulMode) = 0;
                  }
                  
                  //
                  // Update the menu selection
                  //
                  switch( (*pulMode) )
                  {
                  case TIMESTAMP:
                     GetMenu()->CheckMenuRadioItem( 
                        ID_VIEW_SB_TIMESTAMP, 
                        ID_VIEW_SB_CURSOR,
                        ID_VIEW_SB_TIMESTAMP,
                        MF_BYCOMMAND );  
                     break;
                  case CURSOR:
                     GetMenu()->CheckMenuRadioItem( 
                        ID_VIEW_SB_TIMESTAMP, 
                        ID_VIEW_SB_CURSOR,
                        ID_VIEW_SB_CURSOR,
                        MF_BYCOMMAND );  
                     break;
                  }
                  break;
            }               
            return TRUE;
         }
      }    
   }   

   return CFrameWnd::OnNotify( wParam, lParam, pResult );
}
示例#6
0
Bool ApplinkDialog::Command(LONG id, const BaseContainer& msg)
{
	dirty = TRUE;
	saveSettings();

	switch(id)
	{
	case IDC_BTN_EXPORT:
		{
			BaseDocument* doc = GetActiveDocument();
			ApplinkExporter* exporter = gNew ApplinkExporter;
			exporter->Execute(doc, &gPreferences);
			//GePrint("Start export!");

			String exeCoat = gPreferences.GetString(IDC_COAT_EXE_PATH);
			if(gPreferences.GetBool(IDC_CHK_COAT_START) && exeCoat != "")
			{
				if(!Find3DCoat())
				{
					LONG length = exeCoat.GetCStringLen(StXbit) + 1;
					char* buffer = (CHAR*)GeAlloc(length);
					exeCoat.GetCString(buffer, length, StXbit);

					SHELLEXECUTEINFO ExecuteInfo;

					memset(&ExecuteInfo, 0, sizeof(ExecuteInfo));

					ExecuteInfo.cbSize       = sizeof(ExecuteInfo);
					ExecuteInfo.fMask        = 0;                
					ExecuteInfo.hwnd         = 0;                
					ExecuteInfo.lpVerb       = "open";                      // Operation to perform
					ExecuteInfo.lpFile       = buffer;  // Application name
					ExecuteInfo.lpDirectory  = 0;                           // Default directory
					ExecuteInfo.nShow        = SW_SHOWNORMAL;
					ExecuteInfo.hInstApp     = 0;

					if(ShellExecuteEx(&ExecuteInfo) == FALSE)
					// Could not start application -> call 'GetLastError()'
					//if((int)::ShellExecute(NULL, TEXT("open"), buffer, NULL, NULL, SW_SHOWNORMAL) <= 32)
					{
						GePrint("3D-Coat.exe not found!");
					}
				}
				else
				{
					GePrint("3D-Coat.exe is run!");
				}
			}
		}
		break;

	case IDC_BTN_IMPORT:
		{
			GePrint("Start import!");
			BaseDocument* doc = GetActiveDocument();
			ApplinkImporter* importer = gNew ApplinkImporter;
			importer->Execute(doc, &gPreferences);
		}
		break;

	case IDC_CHK_PROMPT:
		{
			Bool b;
			GetBool(IDC_CHK_PROMPT, b);
			if(b) SetTimer(1000);
		}
		break;
	default:
		break;
	}

	return TRUE;
}
示例#7
0
CGumpEditorDoc* CMainFrame::GetGumpDocument()
{
	CDocument* pDoc = GetActiveDocument();
	if (pDoc && pDoc->IsKindOf(RUNTIME_CLASS(CGumpEditorDoc))) return (CGumpEditorDoc*)pDoc;
	return NULL;
}