Esempio n. 1
0
BOOL CMainMDIFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	switch (LOWORD(wParam))
	{
	case IDM_FILE_NEW:			return OnFileNew();
	case IDM_FILE_CLOSE:		return OnFileClose();
	case IDM_FILE_OPEN:			return OnFileOpen();
	case IDM_FILE_SAVE:			return OnFileSave();
	case IDM_FILE_SAVEAS:		return OnFileSave();
	case IDM_FILE_PRINT:		return OnFilePrint();
	case IDW_VIEW_STATUSBAR:	return OnViewStatusBar();
	case IDW_VIEW_TOOLBAR:		return OnViewToolBar();
	case IDW_MDI_ARRANGE:		return OnMDIIconArrange();
	case IDW_MDI_CASCADE:		return OnMDICascade();
	case IDW_MDI_CLOSEALL:		return OnMDICloseAll();
	case IDW_MDI_TILE:			return OnMDITile();
	case IDM_FILE_EXIT:			return OnFileExit();
	case IDM_HELP_ABOUT:		return OnHelp();
	default:    // Pass to active child...
		{
			if (GetActiveMDIChild())
				GetActiveMDIChild()->SendMessage(WM_COMMAND, wParam, lParam);
		}
		break ;
	}
	return FALSE;
}
Esempio n. 2
0
BOOL CRaytraceApp::InitInstance()
{
	// 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.

	SetDialogBkColor();        // Set dialog background color to gray
	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	// 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(CRaytraceDoc),
		RUNTIME_CLASS(CMainFrame),     // main SDI frame window
		RUNTIME_CLASS(CRaytraceView));
	AddDocTemplate(pDocTemplate);

	// create a new (empty) document
	OnFileNew();

	if (m_lpCmdLine[0] != '\0')
	{
		// TODO: add command line processing here
	}


	return TRUE;
}
Esempio n. 3
0
BOOL CNotepadApp::InitInstance()
{
	_tsetlocale(LC_ALL, _T(""));

	// Standard initialization

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

	// Register document templates

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

	// open file specified on command line
	if (m_lpCmdLine[0] == 0)
		OnFileNew();
	else
		OpenDocumentFile(m_lpCmdLine);

	return TRUE;
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = Q3MainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: OnFileNew(); break;
        case 1: OnFileEdit(); break;
        case 2: OnFileOpen(); break;
        case 3: OnFileSave(); break;
        case 4: OnFileConfig(); break;
        case 5: OnFileExit(); break;
        case 6: OnSimRun(); break;
        case 7: OnSimPause(); break;
        case 8: OnSimSkip(); break;
        case 9: OnSimStop(); break;
        case 10: OnNetInit(); break;
        case 11: OnNetClose(); break;
        case 12: OnNetServer(); break;
        case 13: OnNetServer((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 14;
    }
    return _id;
}
Esempio n. 5
0
BOOL CDockApp::InitInstance()
{
	// 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.

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

	// 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(CDockDoc),
		RUNTIME_CLASS(CMainFrame),          // standard MDI child frame
		RUNTIME_CLASS(CDockView));
	AddDocTemplate(pDocTemplate);

	// create a new (empty) document
	OnFileNew();

	return TRUE;
}
Esempio n. 6
0
LRESULT CNotePad::OnCommand(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	BOOL bRet = false;
	int wmId, wmEvent;
	wmId    = LOWORD(wParam);
	wmEvent = HIWORD(wParam);
	switch (wmEvent)
	{
	case EN_CHANGE:
		 bRet = 1;
		break;
	case EN_HSCROLL:
		 bRet = 1;
		break;
	}
	// 分析菜单选择:
	switch (wmId)
	{
		case IDM_ABOUT:
			DialogBox(m_hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		case ID_NEW:
			bRet = OnFileNew(hWnd, wParam, lParam);
			break;
		case ID_OPEN:
			bRet = OnFileOpen(hWnd, wParam, lParam);
			break;
		case ID_SAVE:
			bRet = OnFileSave(hWnd, wParam, lParam);
			break;
		case ID_SAVEAS:
			bRet = OnFileSaveAs(hWnd, wParam, lParam);
			break;
		case ID_PRINT:
			bRet = OnFilePrint(hWnd, wParam, lParam);
			break;
		case ID_PAGESET:
			bRet = OnPageSet(hWnd, wParam, lParam);
			break;
		case ID_COPY:
			bRet = OnFileCopy(hWnd, wParam, lParam);
			break;
		case ID_PASTE:
			bRet = OnFilePaste(hWnd, wParam, lParam);
			break;
		case ID_COLOR:
			bRet = OnColor(hWnd, wParam, lParam);
			break;
		case ID_FONT:
			bRet = OnFont(hWnd, wParam, lParam);
			break;
		default:
			return DefWindowProc(hWnd, uMsg, wParam, lParam);
	}

	return bRet;
}
Esempio n. 7
0
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	// Process the messages from the Menu and Tool Bar

	UNREFERENCED_PARAMETER(lParam);

	switch (LOWORD(wParam))
	{
	case IDM_FILE_NEW:			OnFileNew();		return TRUE;
	case IDM_FILE_OPEN:			OnFileOpen();		return TRUE;
	case IDM_FILE_SAVE:			OnFileSave();		return TRUE;
	case IDM_FILE_SAVEAS:		OnFileSaveAs();		return TRUE;
	case IDM_FILE_PRINT:		OnFilePrint();		return TRUE;
	case IDM_PEN_COLOR:			OnPenColor();		return TRUE;
	case IDM_FILE_EXIT:			OnFileExit();		return TRUE;

	case IDW_FILE_MRU_FILE1:
	case IDW_FILE_MRU_FILE2:
	case IDW_FILE_MRU_FILE3:
	case IDW_FILE_MRU_FILE4:
	case IDW_FILE_MRU_FILE5:	OnFileMRU(wParam);	return TRUE;

	case IDW_VIEW_STATUSBAR:	return OnViewStatusBar();
	case IDW_VIEW_TOOLBAR:		return OnViewToolBar();
	case IDM_HELP_ABOUT:		return OnHelp();
	}

	return FALSE;
}
Esempio n. 8
0
void C图片管理器App::OnMyfile()
{
	// TODO: 在此添加命令处理程序代码
	OnFileNew();
	CMainFrame* cm = (CMainFrame*)m_pMainWnd;
	C图片管理器Doc* cd = (C图片管理器Doc*)cm->GetActiveFrame()->GetActiveDocument();
	if (!cd->LoadImage())
		((CChildFrame*)cm->GetActiveFrame())->ExitWithoutQuery();
}
Esempio n. 9
0
void C图片管理器App::OnFileOpen()
{
	OnFileNew();
	CMainFrame* cm = (CMainFrame*)m_pMainWnd;
	C图片管理器Doc* cd = (C图片管理器Doc*)cm->GetActiveFrame()->GetActiveDocument();
	if (!cd) return;
	cd->OnFileOpen();
	return;
	// TODO: 在此添加命令处理程序代码
}
Esempio n. 10
0
BOOL CDrawApp::InitInstance()
{
	// Initialize OLE 2.0 libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}

	// 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.

	Enable3dControls();     // enable 3d controls in dialogs
	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	// 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(CDrawDoc),
		RUNTIME_CLASS(CMainFrame),
		RUNTIME_CLASS(CDrawView));
	pDocTemplate->SetContainerInfo(IDR_SEPEDTTYPE_CNTR_IP);
	AddDocTemplate(pDocTemplate);

	// enable file manager drag/drop and DDE Execute open
	EnableShellOpen();
	RegisterShellFileTypes();

	// simple command line parsing
	if (m_lpCmdLine[0] == '\0')
	{
		// create a new (empty) document
		OnFileNew();
	}
	else
	{
		// open an existing document
		OpenDocumentFile(m_lpCmdLine);
	}

	m_pMainWnd->DragAcceptFiles();

	OnIdle(0);  // updates buttons before showing the window

	return TRUE;
}
Esempio n. 11
0
BOOL LdapApp::InitInstance()
{
	// Standard initialization
#ifdef _WIN32
#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif
#endif

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

	// Register document templates

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

#ifdef _WIN32
	// 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;
#else
	// create a new (empty) document
	OnFileNew();

	if (m_lpCmdLine[0] != '\0')
	{
	}
#endif

	m_dirHost = GetProfileString( "Connection", "host", "localhost" );
	m_dirPort = GetProfileInt( "Connection", "port", 389 );
	m_searchBase = GetProfileString( "Search", "base", "dc=example,dc=com" );

	m_scope = GetProfileInt( "Search", "scope", LDAP_SCOPE_SUBTREE );
	m_searchFilter = GetProfileString( "Search", "filter", "objectclass=*" );

	return TRUE;
}
Esempio n. 12
0
BOOL CMapMgrApp::InitInstance()
{
	if( !FirstInstance() )
		return FALSE;

	// 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


	SetDialogBkColor();        // Set dialog background color to gray
	LoadStdProfileSettings();  // Load standard INI file options (including MRU)
	AfxEnableControlContainer();

	// 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(CMapMgrDoc),
		RUNTIME_CLASS(CMainFrame),     // main SDI frame window
		RUNTIME_CLASS(CPictView));
	AddDocTemplate(pDocTemplate);

	// create a new (empty) document
	OnFileNew();
    ((CMainFrame*)GetMainWnd())->RestorePosition( SW_SHOWNORMAL );

	if (m_lpCmdLine[0] != '\0')
	{
		// TODO: add command line processing here
	}

	m_pMainWnd->SendMessage( WM_COMMAND, ID_APPSTART, 0 );
	return TRUE;
}
Esempio n. 13
0
BOOL CWinNotifyApp::InitInstance()
{
  //Load the two icons which will be used by the main window
  m_hMessageIcon = LoadIcon(IDR_MAINFRAME2);
  m_hNoMessageIcon = LoadIcon(IDR_MAINFRAME);

  //Let the document template manager do its stuff
	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CWinNotifyDoc),
		RUNTIME_CLASS(CMainFrame),
		RUNTIME_CLASS(CWinNotifyView));
	AddDocTemplate(pDocTemplate);
  OnFileNew();

	return TRUE;
}
DeformableRegistration::DeformableRegistration(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	ui.setupUi(this);
	ui.view->pParentDlg = this;
	ui.horizontalLayout->setContentsMargins(0, 0, 0, 0);

	connect(ui.actionNew, SIGNAL(triggered()), this, SLOT(OnFileNew()));
	connect(ui.actionOpenTemplate, SIGNAL(triggered()), this, SLOT(OnFileOpenTemplate()));
	connect(ui.actionOpenTarget, SIGNAL(triggered()), this, SLOT(OnFileOpenTarget()));
	connect(ui.actionSaveTemplate, SIGNAL(triggered()), this, SLOT(OnFileSaveTemplate()));
	connect(ui.actionSaveTarget, SIGNAL(triggered()), this, SLOT(OnFileSaveTarget()));
	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(OnFileExit()));
	
	connect(ui.actionScreencapture, SIGNAL(triggered()), this, SLOT(OnScreenCapture()));
	
	connect(ui.actionPoint, SIGNAL(triggered()), this, SLOT(UpdateViewState()));
	connect(ui.actionWireframe, SIGNAL(triggered()), this, SLOT(UpdateViewState()));
	connect(ui.actionFace, SIGNAL(triggered()), this, SLOT(UpdateViewState()));
	connect(ui.actionSmooth, SIGNAL(triggered()), this, SLOT(UpdateViewState()));
	connect(ui.actionTemplateVisible, SIGNAL(triggered()), this, SLOT(UpdateViewState()));

	connect(ui.actionPoints_2, SIGNAL(triggered()), this, SLOT(UpdateViewState()));
	connect(ui.actionWireframe_2, SIGNAL(triggered()), this, SLOT(UpdateViewState()));
	connect(ui.actionFace_2, SIGNAL(triggered()), this, SLOT(UpdateViewState()));
	connect(ui.actionSmooth_2, SIGNAL(triggered()), this, SLOT(UpdateViewState()));
	connect(ui.actionTargetVisible, SIGNAL(triggered()), this, SLOT(UpdateViewState()));

	connect(ui.actionDecimate, SIGNAL(triggered()), this, SLOT(OnToolsDecimate()));
	connect(ui.actionRANDOM, SIGNAL(triggered()), this, SLOT(OnToolsSample_Random()));
	connect(ui.actionQuadricFitting, SIGNAL(triggered()), this, SLOT(OnToolsSample_Quad()));
	connect(ui.actionDartThrowing, SIGNAL(triggered()), this, SLOT(OnToolsSample_Uniform_Dart()));
	connect(ui.actionEmbededDeformation, SIGNAL(triggered()), this, SLOT(OnToolsEmbededDeformation()));
	srand((unsigned)time(NULL));			// 매번 다른 random number 생성을 위해
	
#ifdef HAO_LI
	connect(ui.actionInitalize_HaoLi, SIGNAL(triggered()), this, SLOT(OnToolsInitHaoLi()));
	connect(ui.actionStart_HaoLi, SIGNAL(triggered()), this, SLOT(OnToolsRunHaoLi()));
	connect(ui.actionGeodesic, SIGNAL(triggered()), this, SLOT(OnToolsGeodesic()));
	connect(ui.actionInitGeo, SIGNAL(triggered()), this, SLOT(OnInitGeo()));
#endif

}
Esempio n. 15
0
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	// Process the messages from the (non-ribbon) Menu and Tool Bar

	UNREFERENCED_PARAMETER(lParam);

	switch (LOWORD(wParam))
	{
	case IDM_FILE_NEW:			OnFileNew();			return TRUE;
	case IDM_FILE_OPEN:			OnFileOpen();			return TRUE;
	case IDM_FILE_SAVE:			OnFileSave();			return TRUE;
	case IDM_FILE_SAVEAS:		OnFileSaveAs();			return TRUE;
	case IDM_FILE_PRINT:		OnFilePrint();			return TRUE;

	case IDM_FILE_EXIT:			OnFileExit();			return TRUE;
	case IDW_FILE_MRU_FILE1:
	case IDW_FILE_MRU_FILE2:
	case IDW_FILE_MRU_FILE3:
	case IDW_FILE_MRU_FILE4:
	case IDW_FILE_MRU_FILE5:
		{
			UINT uMRUEntry = LOWORD(wParam) - IDW_FILE_MRU_FILE1;
			MRUFileOpen(uMRUEntry);
			return TRUE;
		}

	case IDM_PEN_RED:	SetPenColor(RGB(255, 0, 0));	return TRUE;
	case IDM_PEN_BLUE:	SetPenColor(RGB(0, 0, 255));	return TRUE;
	case IDM_PEN_GREEN:	SetPenColor(RGB(0, 196, 0));	return TRUE;
	case IDM_PEN_BLACK:	SetPenColor(RGB(0, 0, 0));		return TRUE;
	
	case IDW_VIEW_STATUSBAR:	return OnViewStatusBar();
	case IDW_VIEW_TOOLBAR:		return OnViewToolBar();
	case IDM_HELP_ABOUT:		return OnHelp();

	}

	return FALSE;
}
Esempio n. 16
0
BOOL CWinApp::ProcessShellCommand( CCommandLineInfo &rCmdInfo )
/*************************************************************/
{
    if( rCmdInfo.m_nShellCommand == CCommandLineInfo::FileNew ) {
        if( !OnCmdMsg( ID_FILE_NEW, 0, NULL, NULL ) ) {
            OnFileNew();
        }
        if( m_pMainWnd == NULL ) {
            return( FALSE );
        }
    } else if( rCmdInfo.m_nShellCommand == CCommandLineInfo::FileOpen ||
               rCmdInfo.m_nShellCommand == CCommandLineInfo::FilePrint ||
               rCmdInfo.m_nShellCommand == CCommandLineInfo::FilePrintTo ) {
        AfxMessageBox(rCmdInfo.m_strFileName);
        CDocument *pDoc = OpenDocumentFile( rCmdInfo.m_strFileName );
        if( pDoc == NULL ) {
            return( FALSE );
        }
    } else if( rCmdInfo.m_nShellCommand == CCommandLineInfo::FileDDE ) {
        m_nCmdShow = SW_HIDE;
    }
    return( TRUE );
}
Esempio n. 17
0
BOOL CDriveApp::InitInstance()
{
	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}

	// 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.

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

	// 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(CDriverDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CDriverView));
	AddDocTemplate(pDocTemplate);

	// create a new (empty) document
	OnFileNew();

	if (m_lpCmdLine[0] != '\0')
	{
		// TODO: add command line processing here
	}

	return TRUE;
}
Esempio n. 18
0
BOOL CMRKApp::InitInstance()
{
    // 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

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

    // 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(CMRKDoc),
        RUNTIME_CLASS(CMainFrame),       // main SDI frame window
        RUNTIME_CLASS(CMRKView));
    AddDocTemplate(pDocTemplate);

    OnFileNew();

    if (m_lpCmdLine[0] != '\0')
    {
        CMDPath=m_lpCmdLine;// TODO: add command line processing here
//		AfxMessageBox(CMDPath);
    }

    return TRUE;
}
Esempio n. 19
0
STDMETHODIMP CMainFrame::Execute(UINT32 nCmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* pCmdExProp)
{
	// This function is called when a ribbon button is pressed. 
	// Refer to IUICommandHandler::Execute in the Windows 7 SDK documentation 

	if (UI_EXECUTIONVERB_EXECUTE == verb)
	{
		switch(nCmdID)
		{
		case IDC_CMD_NEW:		OnFileNew();		break;
		case IDC_CMD_OPEN:		OnFileOpen();		break;
		case IDC_CMD_SAVE:		OnFileSave();		break;
		case IDC_CMD_SAVE_AS:	OnFileSaveAs();		break;
		case IDC_CMD_PRINT:		OnFilePrint();		break;
		case IDC_CMD_COPY:		TRACE("Copy\n");	break;
		case IDC_CMD_CUT:		TRACE("Cut\n");		break;
		case IDC_CMD_PASTE:		TRACE("Paste\n");	break;
		case IDC_CMD_ABOUT:		OnHelp();			break;
		case IDC_CMD_EXIT:		OnFileExit();		break;
		case IDC_RICHFONT:		TRACE("Font dialog\n");		break;
		case IDC_RIBBONHELP:	OnHelp();					break;
		case IDC_MRULIST:		OnMRUList(key, ppropvarValue);		break;
		case IDC_PEN_COLOR:		OnPenColor(ppropvarValue, pCmdExProp);	break;
		case IDC_CUSTOMIZE_QAT:	TRACE("Customize Quick Access ToolBar\n");	break;
		default:
			{
				CString str;
				str.Format(_T("Unknown Button %d\n"),nCmdID);
				TRACE(str);
			}
			break;
		}
	}

	return S_OK;
}
Esempio n. 20
0
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	UNREFERENCED_PARAMETER(lParam);

	// Process the messages from the Menu and Tool Bar
	switch (LOWORD(wParam))
	{
	case IDM_FILE_NEW:			OnFileNew();		return TRUE;
	case IDM_FILE_OPEN:			OnFileOpen();		return TRUE;
	case IDM_FILE_SAVE:			OnFileSave();		return TRUE;
	case IDM_FILE_SAVEAS:		OnFileSaveAs();		return TRUE;
	case IDM_FILE_PRINT:		OnFilePrint();		return TRUE;
	case IDM_PEN_RED:			OnPenRed();			return TRUE;
	case IDM_PEN_BLUE:			OnPenBlue();		return TRUE;
	case IDM_PEN_GREEN:			OnPenGreen();		return TRUE;
	case IDM_PEN_BLACK:			OnPenBlack();		return TRUE;
	case IDW_VIEW_STATUSBAR:	OnViewStatusBar();	return TRUE;
	case IDW_VIEW_TOOLBAR:		OnViewToolBar();	return TRUE;
	case IDM_HELP_ABOUT:		OnHelp();			return TRUE;
	case IDM_FILE_EXIT:			OnFileExit();		return TRUE;
	}

	return FALSE;
}
Esempio n. 21
0
BOOL CWinApp::ProcessShellCommand(CCommandLineInfo& rCmdInfo)
{
	BOOL bResult = TRUE;
	switch (rCmdInfo.m_nShellCommand)
	{
	case CCommandLineInfo::FileNew:
		if (!AfxGetApp()->OnCmdMsg(ID_FILE_NEW, 0, NULL, NULL))
			OnFileNew();
		if (m_pMainWnd == NULL)
			bResult = FALSE;
		break;

		// If we've been asked to open a file, call OpenDocumentFile()

	case CCommandLineInfo::FileOpen:
		if (!OpenDocumentFile(rCmdInfo.m_strFileName))
			bResult = FALSE;
		break;

		// If the user wanted to print, hide our main window and
		// fire a message to ourselves to start the printing

	case CCommandLineInfo::FilePrintTo:
	case CCommandLineInfo::FilePrint:
		m_nCmdShow = SW_HIDE;
		ASSERT(m_pCmdInfo == NULL);
		OpenDocumentFile(rCmdInfo.m_strFileName);
		m_pCmdInfo = &rCmdInfo;
		m_pMainWnd->SendMessage(WM_COMMAND, ID_FILE_PRINT_DIRECT);
		m_pCmdInfo = NULL;
		bResult = FALSE;
		break;

		// If we're doing DDE, hide ourselves

	case CCommandLineInfo::FileDDE:
		m_pCmdInfo = (CCommandLineInfo*)m_nCmdShow;
		m_nCmdShow = SW_HIDE;
		break;

	// If we've been asked to unregister, unregister and then terminate
	case CCommandLineInfo::AppUnregister:
		{
			UnregisterShellFileTypes();
			BOOL bUnregistered = Unregister();

			// if you specify /EMBEDDED, we won't make an success/failure box
			// this use of /EMBEDDED is not related to OLE

			if (!rCmdInfo.m_bRunEmbedded)
			{
				if (bUnregistered)
					AfxMessageBox(AFX_IDP_UNREG_DONE);
				else
					AfxMessageBox(AFX_IDP_UNREG_FAILURE);
			}
			bResult = FALSE;    // that's all we do

			// If nobody is using it already, we can use it.
			// We'll flag that we're unregistering and not save our state
			// on the way out. This new object gets deleted by the
			// app object destructor.

			if (m_pCmdInfo == NULL)
			{
				m_pCmdInfo = new CCommandLineInfo;
				m_pCmdInfo->m_nShellCommand = CCommandLineInfo::AppUnregister;
			}
		}
		break;
	}
	return bResult;
}
Esempio n. 22
0
BOOL CMyglApp::InitInstance()
{

#ifdef _KATMAI
	if (!KatmaiInit()) {
#if 0
		::MessageBox(NULL, "This version requires an Intel Pentium III processor \n Program will be terminated"  
			, _PROGRAM " System Message" , MB_OK | MB_ICONINFORMATION | MB_SYSTEMMODAL | MB_TOPMOST);

		//AfxMessageBox("This version requires an Intel Katmai processor \n Program will be terminated ");
		return FALSE;
#endif

	}
#endif

 	/*
	// Initialize COM Library (for RSX)
	*/
	m_coResult = CoInitialize(NULL);

#ifdef _COM
	// Initialize the ATL Module
	_Module.Init(ObjectMap,m_hInstance);

#endif


	// 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.
	m_ChoosePixelFormat = 0;
	m_ActiveView = 0;


#ifndef _NSPLUGIN
	Enable3dControls();	// VC 2.0
#endif

	//SetDialogBkColor();	     // set dialog background color to gray
	LoadStdProfileSettings();  // Load standard INI file options (including MRU)


	GReporter::SetCurrent(new GReporter);

    // make sure Gv VRML  database is init !!!
    GvDB::init();

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

   AddDocTemplate(pTemplate=new CSingleDocTemplate(IDR_MAINFRAME,
			RUNTIME_CLASS(CMyglDoc),
			RUNTIME_CLASS(CMainFrame),     // main SDI frame window
			RUNTIME_CLASS(CMyglView)));

	// command line processing here
	{
	CString fileArg;
	
	// there is a utility function 
	if (m_lpCmdLine[0] != '\0')
	{
		char *p,*p1;

		p=m_lpCmdLine;
		while (*p) {

		 while (isspace(*p)) p++;
		 
		 if ((*p == '-') || (*p == '/')) { // Option start
		 p++;
		 switch (*p++) {
		 case 'X' :
		 case 'x' :
				m_ChoosePixelFormat = 1;
				break;
		 default :
			Reporter.Error("Unknown commandline option '%c' in %s",*p,m_lpCmdLine);
			break;
		 }
		}
		else {	// file argument
#if 0
			if (fileArg.GetLength()>0) {
				Reporter.Error("too many commandline arguments in %s",m_lpCmdLine);
 				while (!isspace(*p)) { if (!*p) break;p++;}
			}		 
		 	else while (!isspace(*p)) {
		   		if (!*p) break;
		   		fileArg += *p;
		   		p++;
		 	}
#else
			if (*p == '"') {
			    p++;
				while (*p != '"') {
		   			if (!*p) break;
		   			fileArg += *p;
		   			p++;
		 		}
				if (*p == '"') p++;
			    while (isspace(*p)) p++;
				break;
				// to do: rest of commandline
			}
			else 
			   fileArg = p;
			break;
#endif

			}
		
		}
	}

	if (fileArg.GetLength() > 0)
	 	OpenDocumentFile(fileArg);	// directly load a file
	else 
	  // create a new (empty) document
	  OnFileNew();
	}


	RegisterShellFileTypes();

	// register all extensions
	{
	CString strFilterExt,strFileTypeName; //strFileTypeId
	if (pTemplate->GetDocString(strFileTypeId,
	   CDocTemplate::regFileTypeId) && !strFileTypeId.IsEmpty())
		{
			// enough info to register it
			if (!pTemplate->GetDocString(strFileTypeName,
			   CDocTemplate::regFileTypeName))
				strFileTypeName = strFileTypeId;    // use id name

	}

	} // for all extensions
	

	// enable file manager drag/drop and DDE Execute open
	m_pMainWnd->DragAcceptFiles();

	EnableShellOpen();
	// VC 2.0
	// The main window has been initialized, so show and update it.
	//pMainFrame->ShowWindow(m_nCmdShow);
	//pMainFrame->UpdateWindow();

#ifdef _EVALUATION
    // increment runcount 
    int runCount = GetProfileInt("GLView","RunCount",0);
    runCount++;
    WriteProfileInt("GLView","RunCount",runCount);
#endif

    int version = GetProfileInt("GLView","Version",0);
    if (version == 0 || version<_VERSION_INT) {
        version = _VERSION_INT;
        WriteProfileInt("GLView","Version",version);
// Date  WriteProfileInt("GLView","Version",version);
        // increment run-count
    }
	return TRUE;
}
Esempio n. 23
0
BOOL CFREDApp::InitInstance()
{	
	// disable the debug memory stuff
	_CrtSetDbgFlag(~(_CRTDBG_ALLOC_MEM_DF) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));

	// 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

	LoadStdProfileSettings(9);  // Load standard INI file options (including MRU)
	User_interface = GetProfileInt("Preferences", "User interface", User_interface);
	Show_stars = GetProfileInt("Preferences", "Show stars", Show_stars);
	Show_grid_positions = GetProfileInt("Preferences", "Show grid positions", Show_grid_positions);
	Show_coordinates = GetProfileInt("Preferences", "Show coordinates", Show_coordinates);
	Show_compass = GetProfileInt("Preferences", "Show compass", Show_compass);
	Show_ship_models = GetProfileInt("Preferences", "Show ship models", Show_ship_models);
	Show_ship_info = GetProfileInt("Preferences", "Show ship info", Show_ship_info);
	Show_outlines = GetProfileInt("Preferences", "Show outlines", Show_outlines);
	Show_waypoints = GetProfileInt("Preferences", "Show waypoints", Show_waypoints);
	Show_sexp_help = GetProfileInt("Preferences", "Show sexp help", Show_sexp_help);
	physics_speed = GetProfileInt("Preferences", "Physics speed", physics_speed);
	physics_rot = GetProfileInt("Preferences", "Physics rotation", physics_rot);
	Hide_ship_cues = GetProfileInt("Preferences", "Hide ship cues", Hide_ship_cues);
	Hide_wing_cues = GetProfileInt("Preferences", "Hide wing cues", Hide_wing_cues);
	Autosave_disabled = GetProfileInt("Preferences", "Autosave disabled", Autosave_disabled);
	double_fine_gridlines = GetProfileInt("Preferences", "Double fine gridlines", double_fine_gridlines);
	Aa_gridlines = GetProfileInt("Preferences", "Anti aliased gridlines", Aa_gridlines);
	Show_dock_points = GetProfileInt("Preferences", "Show dock points", Show_dock_points);
	Show_paths_fred = GetProfileInt("Preferences", "Show paths", Show_paths_fred);
	read_window("Main window", &Main_wnd_data);
	read_window("Ship window", &Ship_wnd_data);
	read_window("Wing window", &Wing_wnd_data);
	read_window("Waypoint window", &Waypoint_wnd_data);
	read_window("Object window", &Object_wnd_data);
	read_window("Mission goals window", &Mission_goals_wnd_data);
	read_window("Messages window", &Messages_wnd_data);
	read_window("Player window", &Player_wnd_data);
	read_window("Events window", &Events_wnd_data);
	read_window("Bg window", &Bg_wnd_data);
	read_window("Briefing window", &Briefing_wnd_data);
	read_window("Reinforcement window", &Reinforcement_wnd_data);
	read_window("Starfield window", &Starfield_wnd_data);
	read_window("Asteroid window", &Asteroid_wnd_data);
	read_window("Mission notes window", &Mission_notes_wnd_data);
	write_ini_file(1);

	// 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(CFREDDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CFREDView));
	AddDocTemplate(pDocTemplate);

	// Enable DDE Execute open
	EnableShellOpen();
	RegisterShellFileTypes(TRUE);	

	// setup the fred exe directory so CFILE can init properly
	/*
	c = GetCommandLine();
	Assert(c != NULL);
	if(c == NULL){
		return FALSE;
	} 
	tok = strtok(c, " \n");
	Assert(tok != NULL);
	if(tok == NULL){
		return FALSE;		
	}
	// Fred_exe_dir = strdup(c);		
	strcpy(Fred_exe_dir, tok);
	*/
	strcpy(Fred_exe_dir, __argv[0]);

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

	m_nCmdShow = Main_wnd_data.p.showCmd;
	OnFileNew();

	// Enable drag/drop open
	m_pMainWnd->DragAcceptFiles();

	h_cursor_move = LoadCursor(IDC_CURSOR1);
	h_cursor_rotate = LoadCursor(IDC_CURSOR2);
	return TRUE;
}
Esempio n. 24
0
BOOL CGalileoApp::InitInstance()
{
	char iometer_path[MAX_PATH];
	char *p;

	test_state = TestIdle;
	login_state = closed;

	// 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.
#if _MSC_VER < 1300
#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif
#endif

	//init file version strings
	GetAppFileVersionString(&m_pVersionString, &m_pVersionStringWithDebug);

	SetRegistryKey( "Intel" );	// Stores information in the registry under
								// HKEY_CURRENT_USER\Software\Intel.

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

	//
	// Check to see if the end user license agreement should be displayed.
	// If the current version is not stored in the registry, disply the EULA.
	//
#ifndef	_DEBUG
	if ( GetProfileString( "Settings", "Version" ) != m_pVersionString )
	{
		CLegalBox legalDlg;					// Display EULA.
		if ( legalDlg.DoModal() == IDOK )
			// User agrees to terms, so store the version in the registry.
			WriteProfileString( "Settings", "Version", m_pVersionString );
		else
			return FALSE;	// User does not agree to terms so exit.
	}
#endif

	// 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(CGalileoDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CGalileoView));
	AddDocTemplate(pDocTemplate);

	// Enable DDE Execute open
	EnableShellOpen();
	RegisterShellFileTypes(TRUE);

	//
	// Pass the command line info to cmdline.ParseParam().
	// Here is the expected syntax:
	//
	// iometer ?
	// iometer [config_file [result_file [timeout_value]]]
	// iometer [/c config_file] [/r results_file] [/t timeout_value]
	//
	//    ? - show Iometer version number and command line syntax
	//
	//    config_file - the name of the Iometer configuration file to restore
	//       when Iometer starts (must be a valid .icf file)
	//
	//    results_file - the name of a writable text file to which the test
	//       results should be appended.  If the file doesn't exist, it will be
	//       created.
	//
	//    timeout_value - the number of seconds to wait for managers to log in
	//       when restoring a config file.
	//
	//    If both config_file and results_file are specified, Iometer will
	//    attempt to run the test in batch mode, requiring no user intervention
	//    to load the config file, start the tests, stop the tests (if a run time
	//    was specified in the Test Setup tab), and close Iometer.  Batch mode
	//    can be canceled by aborting the manager waiting list dialog or by
	//    manually stopping a test while it is running.
	//
	CWinApp::ParseCommandLine(cmdline);

	// If the command line parser had any trouble, kill the program.
	if ( cmdline.m_bFail )
		return FALSE;

	if ( !OnCmdMsg(ID_FILE_NEW, 0, NULL, NULL) )
	{
		OnFileNew();
	}
	if (m_pMainWnd == NULL)
	{
		ErrorMessage("Error creating application's main frame.  "
			"Please report this as an Iometer bug.");
		return FALSE;
	}

	// Fill in the local address strings.
	IdentifyLocalAddresses();

	// Set the status bar.
	CRect rect;
	m_wndStatusBar.GetWindowRect( &rect );
	int* widths;
	widths = (int*)malloc( sizeof(int) * 3 );
	widths[0] = rect.Width() - 300;
	widths[1] = rect.Width() - 150;
	widths[2] = -1;
	m_wndStatusBar.GetStatusBarCtrl().SetParts( 3, widths );
	free( widths );

	// Set status bar text.
	pView->ClearStatusBar();

	// Disable most buttons.
	pView->ButtonReset();

	// make sure CGalileoApp::OnIdle() gets called at least once in a while
	pView->SetTimer( IDLE_TIMER, IDLE_DELAY, NULL );

	// Get the full pathname for Iometer.exe.
	if ( !GetModuleFileName( NULL, iometer_path, sizeof( iometer_path ) ) )
	{
		ErrorMessage( "Could not get Iometer.exe pathname!" );

		// Set iometer_path to a null string; this will make NEW_WORKER_COMMAND
		// search for Dynamo in the current directory and $PATH
		iometer_path[0] = '\0';
	}

	// Find the last backslash in the pathname, if any
	if ( p = strrchr( iometer_path, '\\' ) )
	{
		// Terminate the string right after the last backslash, leaving
		// the full pathname of the directory containing Iometer.exe.
		p++;
		*p = '\0';
	}

	// Build the command line to launch Dynamo.  We must quote the pathname in case it 
	// contains any spaces, but the "start" command (NEW_WORKER_COMMAND) assumes the
	// first quoted argument is the window title, so we must provide it twice.
	new_manager_command_line_format = (CString) NEW_WORKER_COMMAND 
			+ "\"" + iometer_path + NEW_WORKER_EXECUTABLE + "%s\"" + " "
			+ "\"" + iometer_path + NEW_WORKER_EXECUTABLE + "\"%s";

	if ( cmdline.GetConfigFile().IsEmpty() )
	{
#ifndef	_DEBUG
		// If the default config file exists, load it.
		if ( ::GetFileAttributes(DEFAULT_CONFIG_FILE) != 0xFFFFFFFF )
		{
			OpenDocumentFile(DEFAULT_CONFIG_FILE);
		}
		else
		{
			// If no config file was specified on the command line
			// and the default config file doesn't exist, start a
			// local manager.with no command line options.
			LaunchDynamo();
		}
#endif
	}
	else
	{
		// If a config file was specified on the command line, open it
		OpenDocumentFile( cmdline.GetConfigFile() );
	}

	return TRUE;
}
Esempio n. 25
0
MainWindow::MainWindow()
    : QMainWindow( 0, "MainWindow", WDestructiveClose )
{
	QDockWindow * pNMWindow;
	std::map<QString, ServerCreator>::iterator iterCreator;

	m_pCentralWidget = new QWorkspace(this, "CENTRALWIDGET");
	m_pCentralWidget->setScrollBarsEnabled(true);

	setIcon(app32x32_xpm);

	setCentralWidget(m_pCentralWidget);

	// create menus
	m_pFileMenu = new QPopupMenu(this, "File Menu");
	m_pFileNew = new QAction("&New...", QAccel::stringToKey("Ctrl+N"), this, "file.new");
	m_pFileNew->setToolTip("Create a new simulation file, ending the current simulation");
	connect(m_pFileNew, SIGNAL(activated()), this, SLOT(OnFileNew()));
	m_pFileNew->addTo(m_pFileMenu);
	m_pFileEdit = new QAction("&Edit...", QAccel::stringToKey("Ctrl+E"), this, "file.edit");
	m_pFileEdit->setToolTip("Edit the current simulation file, ending the current simulation");
	connect(m_pFileEdit, SIGNAL(activated()), this, SLOT(OnFileEdit()));
	m_pFileEdit->setEnabled(false);
	m_pFileEdit->addTo(m_pFileMenu);
	m_pFileOpen = new QAction(QPixmap(fileopen), "&Open...", QAccel::stringToKey("Ctrl+O"), this, "file.open");
	m_pFileOpen->setToolTip("Open a simulation file, ending the current simulation");
	connect(m_pFileOpen, SIGNAL(activated()), this, SLOT(OnFileOpen()));
	m_pFileOpen->addTo(m_pFileMenu);
	m_pFileSave = new QAction(QPixmap(filesave), "&Save As...", QAccel::stringToKey("Ctrl+S"), this, "file.save");
	m_pFileSave->setToolTip("Save the current setup to a simulation file (this ends any running simulation)");
	connect(m_pFileSave, SIGNAL(activated()), this, SLOT(OnFileSave()));
	m_pFileSave->setEnabled(false);
	m_pFileSave->addTo(m_pFileMenu);
	m_pFileMenu->insertSeparator();
	m_pFileConfig = new QAction("&Configure...", QKeySequence(), this, "file.config");
	m_pFileConfig->setToolTip("Edit the current configuration");
	connect(m_pFileConfig, SIGNAL(activated()), this, SLOT(OnFileConfig()));
	m_pFileConfig->addTo(m_pFileMenu);
	m_pFileExit = new QAction("E&xit...", QAccel::stringToKey("Ctrl+Q"), this, "file.exit");
	m_pFileExit->setToolTip("Exit the program");
	connect(m_pFileExit, SIGNAL(activated()), this, SLOT(OnFileExit()));
	m_pFileExit->addTo(m_pFileMenu);

	m_pSimMenu = new QPopupMenu(this, "Sim Menu");
	m_pSimRun = new QAction("&Run...", QKeySequence(Qt::Key_F2), this, "sim.run");
	m_pSimRun->setToolTip("Start a new simulation");
	connect(m_pSimRun, SIGNAL(activated()), this, SLOT(OnSimRun()));
	m_pSimRun->setEnabled(false);
	m_pSimRun->addTo(m_pSimMenu);
	m_pSimPause = new QAction("Pause", QKeySequence(Qt::Key_F3), this, "sim.pause");
	m_pSimPause->setToolTip("Pause the currently running simulation");
	m_pSimPause->setEnabled(false);
	connect(m_pSimPause, SIGNAL(activated()), this, SLOT(OnSimPause()));
	m_pSimPause->addTo(m_pSimMenu);
	m_pSimSkip = new QAction("Skip to next", QKeySequence(), this, "sim.skip");
	m_pSimSkip->setToolTip("Skip to the next Monte Carlo iteration of the simulation");
	m_pSimSkip->setEnabled(false);
	connect(m_pSimSkip, SIGNAL(activated()), this, SLOT(OnSimSkip()));
	m_pSimSkip->addTo(m_pSimMenu);
	m_pSimStop = new QAction("&Stop", QKeySequence(Qt::SHIFT | Qt::Key_F2), this, "sim.stop");
	m_pSimStop->setToolTip("Stop the currently running simulation");
	m_pSimStop->setEnabled(false);
	connect(m_pSimStop, SIGNAL(activated()), this, SLOT(OnSimStop()));
	m_pSimStop->addTo(m_pSimMenu);

	m_pNetMenu = new QPopupMenu(this, "Net Menu");
	m_pNetInit = new QAction("&Initialize", QKeySequence(), this, "net.init");
	m_pNetInit->setToolTip("Initialize network devices and connections");
	m_pNetInit->setEnabled(true);
	connect(m_pNetInit, SIGNAL(activated()), this, SLOT(OnNetInit()));
	m_pNetInit->addTo(m_pNetMenu);
	m_pNetClose = new QAction("&Close", QKeySequence(), this, "net.close");
	m_pNetClose->setToolTip("Close network devices and connections");
	m_pNetClose->setEnabled(false);
	connect(m_pNetClose, SIGNAL(activated()), this, SLOT(OnNetClose()));
	m_pNetClose->addTo(m_pNetMenu);
	m_pNetServer = new QAction("&Stop Server", QKeySequence(), this, "net.server");
	m_pNetServer->setToolTip("Stop GrooveNet server");
	connect(m_pNetServer, SIGNAL(activated()), this, SLOT(OnNetServer()));
	m_pNetServerMenu = new QPopupMenu(this, "startserver");
	connect(m_pNetServerMenu, SIGNAL(activated(int)), this, SLOT(OnNetServer(int)));
	for (iterCreator = g_mapServerCreators.begin(); iterCreator != g_mapServerCreators.end(); ++iterCreator)
		m_pNetServerMenu->insertItem(iterCreator->first);
	m_iNetServerMenuID = m_pNetMenu->insertItem("&Start Server", m_pNetServerMenu);

	m_pWindowMenu = new QPopupMenu(this, "Window Menu");
	m_pWindowCascade = new QAction("&Cascade", QKeySequence(), this, "window.cascade");
	m_pWindowCascade->setToolTip("Cascade all open windows");
	connect(m_pWindowCascade, SIGNAL(activated()), m_pCentralWidget, SLOT(cascade()));
	m_pWindowCascade->addTo(m_pWindowMenu);
	m_pWindowTile = new QAction("&Tile", QKeySequence(), this, "window.tile");
	m_pWindowTile->setToolTip("Tile all open windows");
	connect(m_pWindowTile, SIGNAL(activated()), m_pCentralWidget, SLOT(tile()));
	m_pWindowTile->addTo(m_pWindowMenu);
	m_pWindowCloseAll = new QAction("Close &All Windows", QKeySequence(), this, "window.closeall");
	m_pWindowCloseAll->setToolTip("Close all open windows");
	connect(m_pWindowCloseAll, SIGNAL(activated()), m_pCentralWidget, SLOT(closeAllWindows()));
	m_pWindowCloseAll->addTo(m_pWindowMenu);

	menuBar()->insertItem("&File", m_pFileMenu);
	menuBar()->insertItem("&Simulator", m_pSimMenu);
	menuBar()->insertItem("&Network", m_pNetMenu);
	menuBar()->insertItem("&Window", m_pWindowMenu);

	statusBar()->addWidget(m_pLblStatus = new QLabel("Ready", this, "statusbar.label"), 1);
	statusBar()->setSizeGripEnabled(true);

/*	pNMWindow = new QDockWindow(this);
	pNMWindow->setCaption("Network Manager");
	pNMWindow->setHorizontallyStretchable(true);
	pNMWindow->setVerticallyStretchable(false);
	pNMWindow->setResizeEnabled(true);
	pNMWindow->setMovingEnabled(true);
	pNMWindow->setCloseMode(QDockWindow::Always);
	m_pNetworkManager = new QNetworkManager(pNMWindow, "network manager");
	pNMWindow->setWidget(m_pNetworkManager);
	addDockWindow(pNMWindow, Qt::DockBottom, true);
*/
        tabsContainer = new QToolBar(this);
        tabsWidget = new QTabWidget(tabsContainer, "tabs");
        tabsWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
        tabsWidget->setMargin(8);

        tabsContainer->setStretchableWidget(tabsWidget);
        tabsContainer->setLabel(tr("GrooveNet - Tooltabs"));
        addDockWindow(tabsContainer, Qt::DockBottom, TRUE);
        m_pNetworkManager = new QNetworkManager(tabsContainer, "network manager");
        tabsWidget->addTab(m_pNetworkManager, QString("Network Manager"));
	m_pMessageList = new QMessageList(tabsContainer, "message list");
        tabsWidget->addTab(m_pMessageList, QString("Messages"));
        setAppropriate(tabsContainer, false);
        tabsWidget->addTab(NULL, QString("Congestion Info"));
        tabsWidget->addTab(NULL, QString("Playback"));
}
Esempio n. 26
0
File: Reno.cpp Progetto: m1h4/Reno
BOOL CRenoApp::InitInstance()
{
	// Set common controls standard classes
	INITCOMMONCONTROLSEX commonControls;
	commonControls.dwSize = sizeof(commonControls);
	commonControls.dwICC = ICC_WIN95_CLASSES;

	// Initialize common controls
	if(!InitCommonControlsEx(&commonControls))
	{
		AfxMessageBox(IDP_CONTROLS_INIT_FAILED);
		return FALSE;
	}

	// Initialize winsock
	if(!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	// Set settings registry key, if not set the ini file will be used
	//SetRegistryKey(TEXT("Miha Software"));

	// Get the current directory and add it to the ini path so the ini does not get stored into win.ini
	TCHAR directory[MAX_PATH];
	GetModuleFileName(NULL,directory,sizeof(directory)/sizeof(TCHAR));
	PathRemoveFileSpec(directory);
	PathAppend(directory,m_pszProfileName);
 
	// Store the ini file path
	free((LPVOID)m_pszProfileName);
	m_pszProfileName = _tcsdup(directory);	// String gets free'd by mfc on app exit

	// Initialize super
	if(!CRenoSocketApp::InitInstance())
		return FALSE;

	// Initialize fonts
	if(!InitFonts())
		return FALSE;

	// Create the main window
	CMDIFrameWnd* pFrame = new CRenoMainFrame;
	if(!pFrame)
		return FALSE;

	// Set our local member pointer to the frame instance
	m_pMainWnd = pFrame;

	// Create main MDI frame window
	if(!pFrame->LoadFrame(IDR_MAINFRAME))
		return FALSE;

	// Try to load shared MDI menus and accelerator table
	// TODO Add additional member variables and load calls for additional menu types your application may need

	m_hCommandMenu = ::LoadMenu(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_COMMANDFRAME));
	m_hCommandAccelerator = ::LoadAccelerators(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_COMMANDFRAME));

	m_hChatMenu = ::LoadMenu(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_CHATFRAME));
	m_hChatAccelerator = ::LoadAccelerators(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_CHATFRAME));

	// Load the settings
	LoadSettings();

	// TODO Load the previous window placement

	// The main window has been initialized, so show and update it
	pFrame->ShowWindow(m_nCmdShow);
	pFrame->UpdateWindow();

	// Create a inital command window
	// TODO Make it an option
	OnFileNew();

	return TRUE;
}
Esempio n. 27
0
void 	CWedApp::NewFile()
{
	OnFileNew();
}
Esempio n. 28
0
/*************
 * DESCRIPTION:	do initializations for an instance
 * INPUT:			-
 * OUTPUT:			-
 *************/
BOOL CTheApp::InitInstance()
{
    KEYGETINFO keyGetInfo;
    HMODULE hKeyFile;
    OSVERSIONINFO OSVersionInfo;
    char szBuf[15];

    OSVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

    if (!GetVersionEx(&OSVersionInfo))
        return FALSE;

    if (OSVersionInfo.dwMajorVersion < 4)
    {
        AfxMessageBox(IDS_ERR_PLATFORM);
        return FALSE;
    }

    // This is just for setting the current working directory in rsi.dll
    rsiInit();

    // Standard initialization
    // 3d controls and grey background
    Enable3dControls();
    SetDialogBkColor();

    // Drag and drop support
    AfxOleInit();

    strcpy(szBuf, "ke");

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

    getcwd(szWorkingDirectory, 256);


    // get user name and serial number out of keyfile
    strcpy(szUserName, "");
    strcat(szBuf, "yfil");

    nUserSernum = 0;

    strcat(szBuf, "e.dll");

    hKeyFile = LoadLibrary(szBuf);
    if (hKeyFile)
    {
        keyGetInfo = (KEYGETINFO)GetProcAddress(hKeyFile, (LPCSTR)2);
        keyGetInfo(szUserName, &nUserSernum);
        FreeLibrary(hKeyFile);
    }

    // Register document templates
    CSingleDocTemplate *pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(IDR_MAINFRAME,
                                          RUNTIME_CLASS(CDoc),
                                          RUNTIME_CLASS(CMainFrame),       // main SDI frame window
                                          RUNTIME_CLASS(CCamView));

    AddDocTemplate(pDocTemplate);

    OnFileNew();

    return TRUE;
}
Esempio n. 29
0
BOOL CMDITabsDemoApp::InitInstance()
{
	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}

	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.

	// 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("Microsoft\\MFC\\Samples"));
	LoadStdProfileSettings();  // Load standard INI file options (including MRU)
	SetRegistryBase (_T("Settings"));

	m_Options.Load ();

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

	CMFCToolTipInfo params;
	params.m_bVislManagerTheme = TRUE;

	GetTooltipManager ()->SetTooltipParams (
		AFX_TOOLTIP_TYPE_ALL,
		RUNTIME_CLASS (CMFCToolTipCtrl),
		&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_MDITABTYPE,
		RUNTIME_CLASS(CMDITabsDemoDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CMDITabsDemoView));
	AddDocTemplate(pDocTemplate);

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

	// 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;

	OnFileNew ();
	OnFileNew ();
	OnFileNew ();
	
	// The main window has been initialized, so show and update it.
	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();

	if (afxGlobalData.m_nBitsPerPixel < 16)
	{
		AfxMessageBox(IDS_WRONG_DISPLAY_SETTINGS);
	}

	return TRUE;
}
Esempio n. 30
0
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
    CTabbedMDI* pTabbedMDI = (CTabbedMDI*)m_DockTabbedMDI.GetView();

    // OnCommand responds to menu and and toolbar input
    switch (LOWORD(wParam)) {
    case IDM_FILE_NEW:
        OnFileNew();
        return TRUE;

    case IDM_FILE_NEWSIMPLE:
        pTabbedMDI->AddMDIChild(new CViewSimple, _T("Simple"), ID_MDI_SIMPLE);
        return TRUE;

    case IDM_FILE_NEWRECT:
        pTabbedMDI->AddMDIChild(new CViewRect, _T("Rectangles"), ID_MDI_RECT);
        return TRUE;

    case IDM_FILE_NEWTEXT:
        pTabbedMDI->AddMDIChild(new CViewText, _T("TextView"), ID_MDI_TEXT);
        return TRUE;

    case IDM_FILE_NEWTREE:
        pTabbedMDI->AddMDIChild(new CViewClasses, _T("TreeView"), ID_MDI_CLASSES);
        return TRUE;

    case IDM_FILE_NEWLIST:
        pTabbedMDI->AddMDIChild(new CViewFiles, _T("ListView"), ID_MDI_FILES);
        return TRUE;

    case IDM_FILE_EXIT:
        // End the application
        ::PostQuitMessage(0);
        return TRUE;

    case IDM_CONTAINER_TOP:
        OnContainerTabsAtTop();
        return TRUE;

    case IDM_TABBEDMDI_TOP:
        OnMDITabsAtTop();
        return TRUE;

    case IDM_LAYOUT_DEFAULT:
        SetRedraw(FALSE);
        m_DockTabbedMDI.CloseAllDockers();
        m_DockTabbedMDI.GetTabbedMDI()->CloseAllMDIChildren();
        LoadDefaultDockers();
        LoadDefaultMDIs();
        SetRedraw(TRUE);
        RedrawWindow(0, 0, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN);
        return TRUE;

    case IDM_LAYOUT_CLOSE_DOCKERS:
        m_DockTabbedMDI.CloseAllDockers();
        return TRUE;

    case IDM_LAYOUT_CLOSE_MDIS:
        m_DockTabbedMDI.GetTabbedMDI()->CloseAllMDIChildren();
        return TRUE;

    case IDW_VIEW_STATUSBAR:
        OnViewStatusBar();
        return TRUE;

    case IDW_VIEW_TOOLBAR:
        OnViewToolBar();
        return TRUE;

    case IDM_HELP_ABOUT:
        // Display the help dialog
        OnHelp();
        return TRUE;

    default:
        // Pass the command on to the view window of the last active docker
    {
        if (m_pLastActiveDocker == &m_DockTabbedMDI)
            m_DockTabbedMDI.GetTabbedMDI()->GetActiveMDIChild()->SendMessage(WM_COMMAND, wParam, lParam);
        else if (m_pLastActiveDocker->IsDocked())
            m_pLastActiveDocker->GetContainer()->GetActiveView()->SendMessage(WM_COMMAND, wParam, lParam);
    }
    }

    return FALSE;
}