コード例 #1
0
BOOL CInspectorDialog::OnInitDialog()
{
    CTabsDlg::OnInitDialog();

    ASSERT ( m_Tabs.GetSafeHwnd() );

    LoadWindowPlacement(GetSafeHwnd() , "radiant_InspectorsWindow" );

    consoleWnd.Create(IDD_DIALOG_CONSOLE, this);
    texWnd.Create(TEXTURE_WINDOW_CLASS, "", QE3_SPLITTER_STYLE, CRect(5, 5, 10, 10), this, 1299);
    mediaDlg.Create(IDD_DIALOG_TEXTURELIST, this);
    entityDlg.Create(IDD_DIALOG_ENTITY, this);

    dockedTabs = GetCvarInt ( "radiant_InspectorDockedDialogs" , W_CONSOLE | W_TEXTURE | W_MEDIA );

    AddDockedWindow ( &consoleWnd , W_CONSOLE , 1 , "Console"	 , (dockedTabs & W_CONSOLE ) != 0 , InspectorsDockingCallback );
    AddDockedWindow ( &texWnd	  , W_TEXTURE , 2 , "Textures"   , (dockedTabs & W_TEXTURE ) != 0 , InspectorsDockingCallback );
    AddDockedWindow ( &mediaDlg	  , W_MEDIA	  , 3 , "Media"	     , (dockedTabs & W_MEDIA   ) != 0 , InspectorsDockingCallback );
    AddDockedWindow ( &entityDlg  , W_ENTITY  , 4 , "Entity"	 , (dockedTabs & W_ENTITY  ) != 0 , InspectorsDockingCallback );

    SetMode(W_CONSOLE);
    initialized = true;

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
コード例 #2
0
/*
==============
CreateEntityWindow
==============
*/
BOOL CreateEntityWindow(HINSTANCE hInstance)
{
	HWND hwndEntityPalette;

	inspector_mode = W_ENTITY;

	WEnt_Create (hInstance);

	hwndEntityPalette = CreateDialog(hInstance, (char *)IDD_ENTITY, g_qeglobals.d_hwndMain, (DLGPROC)NULL);
	if (!hwndEntityPalette)
		Error ("CreateDialog failed");

	GetEntityControls (hwndEntityPalette);
	DestroyWindow (hwndEntityPalette);

	OldFieldWindowProc = (WNDPROC)GetWindowLong (hwndEnt[EntKeyField], GWL_WNDPROC);
	SetWindowLong (hwndEnt[EntKeyField], GWL_WNDPROC, (long)FieldWndProc);
	SetWindowLong (hwndEnt[EntValueField], GWL_WNDPROC, (long)FieldWndProc);

	OldEntityListWindowProc = (WNDPROC)GetWindowLong (hwndEnt[EntList], GWL_WNDPROC);
	SetWindowLong (hwndEnt[EntList], GWL_WNDPROC, (long)EntityListWndProc);

	FillClassList ();


	LoadWindowPlacement(g_qeglobals.d_hwndEntity, "EntityWindowPlace");
	ShowWindow (g_qeglobals.d_hwndEntity, SW_HIDE);
	SetInspectorMode (W_CONSOLE);

	return TRUE;
}
コード例 #3
0
void CTabsDlg::DockWindow(int ID , bool dock)
{
	DockedWindowInfo *info = NULL;
	m_Windows.Lookup((WORD)ID , (void* &)info);

	ASSERT(info);
	ASSERT(m_Tabs.GetSafeHwnd());

	ShowAllWindows(FALSE);

	if (!dock) {
		//make a containing window and assign the dialog to it
		CRect rect;
		CString classname = AfxRegisterWndClass(CS_DBLCLKS , 0 , 0 , 0);
		info->m_State = DockedWindowInfo::FLOATING;

		info->m_Window->GetWindowRect(rect);
		info->m_Container.CreateEx(WS_EX_TOOLWINDOW , classname , info->m_Title , WS_THICKFRAME | WS_SYSMENU | WS_POPUP | WS_CAPTION, rect , this , 0);
		info->m_Window->SetParent(&info->m_Container);
		info->m_Window->ShowWindow(TRUE);

		info->m_Container.SetDockManager(this);
		info->m_Container.ShowWindow(TRUE);
		info->m_Container.SetDialog(info->m_Window , info->m_ID);

		if (info->m_TabControlIndex >= 0) {
			m_Tabs.DeleteItem(info->m_TabControlIndex);
		}

		if (m_Tabs.GetItemCount() > 0) {
			m_Tabs.SetCurFocus(0);
		}

		CString placementName = info->m_Title + "Placement";
		LoadWindowPlacement(info->m_Container , placementName);
	} else {
		info->m_State = DockedWindowInfo::DOCKED;

		info->m_TabControlIndex = m_Tabs.InsertItem(TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM , 0 , info->m_Title , info->m_ImageID , (LPARAM)info);

		info->m_Window->SetParent(this);
		info->m_Window->ShowWindow(TRUE);

		info->m_Container.SetDockManager(NULL);	//so it doesn't try to call back and redock this window
		info->m_Container.DestroyWindow();

		CRect rect;
		GetWindowRect(rect);

		//stupid hack to get the window reitself properly
		rect.DeflateRect(0,0,0,1);
		MoveWindow(rect);
		rect.InflateRect(0,0,0,1);
		MoveWindow(rect);
	}

	UpdateTabControlIndices();
	FocusWindow(ID);

	if (info->m_DockCallback) {
		info->m_DockCallback(dock , info->m_ID , info->m_Window);
	}

	SaveWindowPlacement();
}
コード例 #4
0
ファイル: app_win.cpp プロジェクト: kamilik26/zephyros
int CreateMainWindow()
{
    // initialize title bar text and the main window class name
    TCHAR szTitle[MAX_LOADSTRING];
    TCHAR szWindowClass[MAX_LOADSTRING];
    LoadString(g_hInst, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadString(g_hInst, IDC_CEFCLIENT, szWindowClass, MAX_LOADSTRING);
    MyRegisterClass(g_hInst, szWindowClass);

    // create the main window
    Rect rectWindow;
    LoadWindowPlacement(&rectWindow, &g_nCmdShow);
    HWND hWndMain = CreateWindow(
                        szWindowClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
                        rectWindow.x, rectWindow.y, rectWindow.w, rectWindow.h,
                        NULL, NULL, g_hInst, NULL
                    );

    if (hWndMain == NULL)
    {
        App::ShowErrorMessage();
        return FALSE;
    }

    HACCEL hAccelTable = LoadAccelerators(g_hInst, MAKEINTRESOURCE(IDC_CEFCLIENT));
    g_handler->SetAccelTable(hAccelTable);

    g_isMessageLoopRunning = true;
    int result = 0;
    if (!g_isMultithreadedMessageLoop)
    {
        // run the CEF message loop
        // this function will block until the application recieves a WM_QUIT message
        CefRunMessageLoop();
    }
    else
    {
        // create a hidden window for message processing
        g_hMessageWnd = CreateMessageWindow(g_hInst);
        ASSERT(g_hMessageWnd);

        MSG msg;

        // run the application message loop
        while (GetMessage(&msg, NULL, 0, 0))
        {
            if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }

        DestroyWindow(g_hMessageWnd);
        g_hMessageWnd = NULL;

        result = static_cast<int>(msg.wParam);
    }

    g_isMessageLoopRunning = false;
    g_handler->ReleaseCefObjects();
    FreeResources();

    return result;
}
コード例 #5
0
BOOL CPeraProcessDesignerApp::InitInstance()
{
	ZTools::InitZToolsLog();

	if ( !m_CmdLine.Parse() )
	{
		MessageBox( NULL, "解析命令行失败!", g_lpszAppTitle, MB_OK | MB_TOPMOST );
		return FALSE;
	}

	m_hMetux = CreateMutex(NULL,TRUE,"PeraProcessDesigner.exe");
	if (m_hMetux)
	{
		if (ERROR_ALREADY_EXISTS== GetLastError())
		{
			HWND hwndPeraProcessDesignerCopied = FindPeraProcessDesignerMainWindow();
			//当有互斥,但是没找到窗口时,认为之前的进程还在启动中,简单处理,直接退出
			if ( hwndPeraProcessDesignerCopied)
			{
				if ( !m_CmdLine.GetValue( NULL ).IsEmpty() )
				{
#define WS_OPENWS_SENDMSG
#ifdef WS_OPENWS_SENDMSG
					DWORD dwProcessId = 0;
					GetWindowThreadProcessId(hwndPeraProcessDesignerCopied, &dwProcessId); 
					if ( GetTopModalWindow( dwProcessId ) == NULL )
					{
						CSharedMemory Mem;
						CString sMemData = g_lpszDoubleOpenWsMemStr;
						Mem.Init( g_lpszDoubleOpenWsMemName, sMemData.GetLength()+MAX_PATH );
						SendCopyData( hwndPeraProcessDesignerCopied, CPMSG_WORKSPACE_MAKESUREINFO, (LPVOID)NULL, 0 );
						sMemData.Empty();
						sMemData = (LPCTSTR)Mem.GetData();
						if ( sMemData.CompareNoCase( g_lpszDoubleOpenWsMemStr ) == 0 )
						{
							MessageBox( NULL, "建模环境处于活动状态,请先保存模型后重试!", g_lpszAppTitle, MB_OK | MB_TOPMOST );
						}
						else
						{
							CString sCmdLine = ::GetCommandLine();
							SendCopyData( hwndPeraProcessDesignerCopied, CPMSG_WORKSPACE_OPENWS, (LPVOID)(LPCTSTR)sCmdLine, sCmdLine.GetLength()+1 );
						}
					}
					else
					{
						MessageBox( NULL, "建模环境处于活动状态,请先保存模型后重试!", g_lpszAppTitle, MB_OK | MB_TOPMOST );
					}
#else
					MessageBox( hwndPeraProcessDesignerCopied, "建模环境已打开,请在建模环境中打开本文件!", g_lpszAppTitle, MB_OK | MB_TOPMOST );
#endif
				}
				if (IsIconic(hwndPeraProcessDesignerCopied)) 
					ShowWindow(hwndPeraProcessDesignerCopied,SW_RESTORE);

				SetForegroundWindow(hwndPeraProcessDesignerCopied);
				ZTools::WriteZToolsFormatLog("将已经运行的建模窗口激活,并前端显示...");

			}
			CloseHandle(m_hMetux);
			m_hMetux = NULL;
			ZTools::WriteZToolsFormatLog("已经存在一个建模客户端,本运行实例将退出...");

			return FALSE;
		}
	}

	m_LoginData.m_strRealName = m_CmdLine.GetValue( "realName" );
	m_LoginData.m_strUser = m_CmdLine.GetValue( "userName" );
	m_LoginData.m_strTicket = m_CmdLine.GetValue( "ticket-proxy" );

	WriteShareMemoryLoginInfo();

	CCrashHandler ch;
	ch.SetProcessExceptionHandlers();
	ch.SetThreadExceptionHandlers();

	//如果PeraTaskService进程不存在,自动启动
	StartPeraTaskService();

	//_CrtSetBreakAlloc(1300);
	// InitCommonControlsEx() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// Set this to include all the common control classes you want to use
	// in your application.
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	//hModule = ::LoadLibrary("C:\\Users\\kunmiao-li\\Desktop\\TestBuild\\PeraLicMgr\\Release\\PeraLicMgr.dll");
//#ifndef _DEBUG

	if (!InitLicense("PeraWorkSpace"))
		return FALSE;
// 	if(!m_FlexNetMgr.CheckOutLicense("PeraWorkSpace"))
// 	{
// 		return FALSE;
// 	}



//	hModule = ::LoadLibrary(ZTools::FormatString("%s\\PeraLicMgr.dll", GetFlexwareBinPathMethod()).c_str());
//	if( hModule != NULL ) 
//	{
//		lpFnDLLfunc = (LPFNDLLFUNC) ::GetProcAddress(hModule, "CheckOutLicense");
//		if(lpFnDLLfunc != NULL)
//		{
//			if(!lpFnDLLfunc("PeraProcessDesigner"))
//			{
//				return FALSE;
//			}
//		}
//		else	
//		{
//			return FALSE;
//		}
//	}
//	else
//	{
//		AfxMessageBox("检测到系统安装不完整,请联系管理员重新安装!", MB_OK|MB_ICONINFORMATION);
//		return FALSE;
//	}
//#endif
	
	//if(!m_FlexNetMgr.InitNewJob("PeraProcessDesigner"))
	//{
	//	return FALSE;
	//}
	
	CWinApp::InitInstance();

	InitGDIPlus();
	LoadResLibImageSet();
	//LoadDefaultFont();

	//CBCGPPopupMenuBar::SetPeraPaint( g_crToolbarBg );

	//CXmlBase xml;
	//MSXML2::IXMLDOMDocument2Ptr pdoc = xml.GetXmlDocPtrByFile(GetExecDir() + "\\Manifest.xml");

	//MSXML2::IXMLDOMNodeListPtr pModels;
	//MSXML2::IXMLDOMNodePtr pModel;
	//long lModelCount;
	//HRESULT hr = S_OK;

	//map<CString, CString> mapAttrs;
	//map<CString, CString>::iterator iterAttrs;
	//CString str;

	//pModels = xml.GetNodeListPtr("/Manifest/Component", pdoc);
	//if (pModels != NULL)
	//{
	//	lModelCount = pModels->Getlength();
	//	for (long i=0; i<lModelCount; i++)
	//	{
	//		hr = pModels->get_item(i, &pModel);
	//		if (FAILED(hr) || NULL == pModel)
	//		{
	//			continue;
	//		}
	//		if (0 == xml.GetAttrsOfNode(mapAttrs, pModel))
	//		{
	//			continue;
	//		}

	//		iterAttrs = mapAttrs.find("RobotName");
	//		if (iterAttrs != mapAttrs.end()) str= iterAttrs->second;
	//	}
	//}

	//CCxArray3D a3d(DT_ARRAY3D_INT);
	//CString str3d = "[1,2,3,4,5,](4,3,2)"

	//CString str = "[1e150,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24](2,3,4)";
//	CString str = "[\"\\\\\\\",,1e150\",\"2\"](2)";
	//{
	//	CString str1;
	//	for (int a=0;a<2;a++)
	//	{
	//		for (int b=0;b<3;b++)
	//		{
	//			for (int c=0;c<4;c++)
	//			{

	//			}
	//		}
	//	}
	//}

	//
	//CxArrayND nd( DT_ARRAY1D_STRING );
	//nd.Parse( str );
	//vector<int> vPos;
	//vPos.push_back(0);
	////vPos.push_back(0);
	////vPos.push_back(0);
	//LPARAM lpData = nd.GetDataPtr( vPos );
	//CString * pData = reinterpret_cast< CString * > ( lpData );
	//nd.Clear();


	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}
	AfxEnableControlContainer();

	EnableTaskBarInteraction(FALSE);

	globalData.SetDPIAware ();
	//globalData.bDisableAero = TRUE;

	//Bar挺靠后,Slider宽度,由于Splitter最小宽度为4,所以此值不应小于4,否则与Splitter不协调。
	CBCGPSlider::m_nDefaultWidth = 4;

	// All registry read/write operations will be produced via CBCGPXMLSettings gateway:
	CBCGPRegistrySP::SetRuntimeClass (RUNTIME_CLASS (CBCGPXMLSettings));

	// Read settings:
	CBCGPXMLSettings::ReadXMLFromFile (FALSE, GetExecDir() + _T("\\user.xml"));

	// 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
	// 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("PeraProcessDesigner"));
	//LoadStdProfileSettings(0);  // Load standard INI file options (including MRU)

	//SetRegistryBase (_T("Settings"));

	RECT rectDesktop;
	SystemParametersInfo(SPI_GETWORKAREA,0,(PVOID)&rectDesktop,0);
	m_rcLastWindowPlacement = rectDesktop;
	CRect rectDesktop2 = rectDesktop;
	int nFlag = 0;
	int nShowCmd = 0;
	LoadWindowPlacement( m_rcLastWindowPlacement, nFlag, nShowCmd );

	StoreWindowPlacement (rectDesktop2, 2, SW_SHOWMAXIMIZED);

	theGlobalConfig.Load();

	m_bAloneVersionWs = IsPeraProcessRunnerInstalled();

	CCxBCGPVisualManager2007::SetStyle (CCxBCGPVisualManager2007::VS2007_Silver);
	CCxBCGPVisualManager2007::SetDefaultManager (RUNTIME_CLASS (CCxBCGPVisualManager2007));

	//globalData.bDisableAero = TRUE;
	//globalData.bIsOSAlphaBlendingSupport = TRUE;

	// Initialize all Managers for usage. They are automatically constructed
	// if not yet present
	InitMouseManager();
	//InitContextMenuManager();
	InitKeyboardManager();

	// Enable user-defined tools. If you want allow more than 10 tools,
	// add tools entry to resources (ID_USER_TOOL11, ID_USER_TOOL12,...)
	EnableUserTools (ID_TOOLS_ENTRY, ID_USER_TOOL1, ID_USER_TOOL10);

	// TODO: Remove this if you don't want extended tooltips:
	InitTooltipManager();

	CBCGPToolTipParams params;
	params.m_bVislManagerTheme = TRUE;

	theApp.GetTooltipManager ()->SetTooltipParams (
		BCGP_TOOLTIP_TYPE_ALL,
		RUNTIME_CLASS (CBCGPToolTipCtrl),
		&params);

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views
	CMultiDocTemplate* pDocTemplate;
	pDocTemplate = new CMultiDocTemplate(IDR_MAIN,
		RUNTIME_CLASS(CPeraProcessDesignerDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CPeraProcessDesignerView));
	if (!pDocTemplate)
		return FALSE;
	AddDocTemplate(pDocTemplate);

	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame->LoadFrame(IDR_MAIN))
		return FALSE;
	
	m_bCreate = TRUE;

	m_pMainWnd = pMainFrame;

	//basehtmldialog中,屏蔽快捷键
	g_hwndMainWindow = pMainFrame->GetSafeHwnd();

	g_pLoadingWindow = new CLoadingWindow( TIMER_LOADING_WINDOW, IDD_DIALOG_LOGIN_BK, m_pMainWnd );
	g_pLoadingWindow->Create( IDD_DIALOG_LOGIN_BK, m_pMainWnd );
	g_pLoadingWindow->Init( GetExecDir() + "\\Res\\DlgProgress\\DlgProgress.png" );

	pMainFrame->m_wndMenuBar.LoadData();

	//pMainFrame->OnMenuModuleOpenjianmo();

	// call DragAcceptFiles only if there's a suffix
	//  In an MDI app, this should occur immediately after setting m_pMainWnd


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


	//if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
	//{
	//	if (!pMainFrame->LoadMDIState (GetRegSectionPath ()) || 
	//		DYNAMIC_DOWNCAST(CMDIChildWnd, pMainFrame->GetActiveFrame()) == NULL)
	//	{
	//		if (!ProcessShellCommand(cmdInfo))
	//			return FALSE;
	//	}
	//}
	//else
	//{
	//	// Dispatch commands specified on the command line
	//	if (!ProcessShellCommand(cmdInfo))
	//		return FALSE;
	//}
	// The main window has been initialized, so show and update it

	pMainFrame->OnMenuModuleOpenjianmo();

	m_bInitMDI = TRUE;
	m_nCmdShow = SW_SHOWMAXIMIZED;
	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();

	//////////////////////////////////////////////////////////////////////////
	//日志输出窗口
#ifdef USE_DLGLOG
	m_dlgLog.Create(CDlgLog::IDD, NULL);
	//m_dlgLog.ShowWindow(SW_SHOW);

// 	int x, y; 
// 	x = GetSystemMetrics(SM_CXFULLSCREEN); //屏幕宽度 
// 	y = GetSystemMetrics(SM_CYFULLSCREEN); //屏幕高度  

	CRect rectFull;
	SystemParametersInfo(SPI_GETWORKAREA,0,&rectFull,0);

	CRect rect;
	m_dlgLog.GetWindowRect(rect);
	rect.MoveToXY(0, rectFull.bottom - rect.Height());
	m_dlgLog.MoveWindow(rect);
#endif // USE_DLGLOG
	//////////////////////////////////////////////////////////////////////////

	//////////////////////////////////////////////////////////////////////////
	//延长票据有效期
	StartKeepTicketThread();
	//////////////////////////////////////////////////////////////////////////
	//在线编辑用到的共享内存初始化
	m_pSharedMemoryOnlineEdit = NULL;
	m_pSharedMemoryOnlineEdit = new SharedMemoryOnlineEdit();
	//////////////////////////////////////////////////////////////////////////
	g_ReadRobotDB.Load();

	pMainFrame->m_wndLoginBar.RedrawWindow();

	CString sParamFile = m_CmdLine.GetValue( NULL );
	if ( !sParamFile.IsEmpty() )
	{
		ZTools::WriteZToolsFormatLog( "--------------********打开文件[%s]**********-------------", sParamFile );
		theApp.m_processMgr.Open( sParamFile );
	}
	else
	{
		ZTools::WriteZToolsLog( "--------------********未打开文件逻辑**********-------------" );
		CDlgStart lgn;
		lgn.DoModal();
	}

#ifdef USE_DLGLOG
	m_dlgLog.ShowWindow(SW_SHOW);
#endif // USE_DLGLOG

	//////////////////////////////////////////////////////////////////////////
	WINDOWPLACEMENT wp;
	memset(&wp, NULL, sizeof(wp));
	wp.length = sizeof (WINDOWPLACEMENT);

	if (pMainFrame->GetWindowPlacement (&wp))
	{
		wp.rcNormalPosition = m_rcLastWindowPlacement;

		RECT rectDesktop;
		SystemParametersInfo(SPI_GETWORKAREA,0,(PVOID)&rectDesktop,0);
		OffsetRect(&wp.rcNormalPosition, -rectDesktop.left, -rectDesktop.top);

		pMainFrame->SetWindowPlacement (&wp);

	}
	return TRUE;
}