void CSensorListView::OnInitialUpdate() 
{
	CDocument* pDoc = GetDocument ();
	ASSERT_VALID (pDoc);

	pDoc->SetTitle (_T("Sensor List View"));
}
void CSeriousSkaStudioApp::OnFileOpen() 
{
  CTFileName fnSim;
  // get file name  
  fnSim = _EngineGUI.FileRequester( "Select existing Smc file",
    "ASCII model files (*.smc)\0*.smc\0"
    "All files (*.*)\0*.*\0\0",
    "Open directory", "Models\\", "");
  if (fnSim=="") return;

  CTFileName fnFull;
  fnFull = _fnmApplicationPath + fnSim;

  CModelInstance *pmi = OnOpenExistingInstance(fnSim);
  if(pmi == NULL)
  {
    // if faile to open smc
    theApp.ErrorMessage("Failed to open model instance '%s'",(const char*)fnSim);
    return;
  }
  // create new document
  CDocument* pDocument = m_pdtDocTemplate->CreateNewDocument();
  if (pDocument == NULL)
	{
		TRACE0("CDocTemplate::CreateNewDocument returned NULL.\n");
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		return;
	}
	ASSERT_VALID(pDocument);
  // View creation
	CFrameWnd* pFrame = m_pdtDocTemplate->CreateNewFrame(pDocument, NULL);
	if (pFrame == NULL)
	{
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		delete pDocument;       // explicit delete on error
		return;
	}
	ASSERT_VALID(pFrame);

  pDocument->SetModifiedFlag( FALSE);

  // add file to mru
  CTString strFileName = pmi->mi_fnSourceFile.FileName() + pmi->mi_fnSourceFile.FileExt();
  CString strOpenPath;
  strOpenPath = theApp.GetProfileString(L"SeriousSkaStudio", L"Open directory", L"");
  strOpenPath += pmi->mi_fnSourceFile;

  pDocument->SetPathName(CString(strFileName), TRUE);
  pDocument->SetTitle(CString(strFileName));

  pDocument->SetModifiedFlag( FALSE);
  m_pdtDocTemplate->InitialUpdateFrame(pFrame, pDocument, TRUE);
  // set root model instance
  theApp.GetDocument()->m_ModelInstance = pmi;
  // fill tree view with new model insntance
  ReloadRootModelInstance();
}
Beispiel #3
0
void CStartView::OnInitialUpdate()
{
    CDocument* pDoc = GetDocument();
    ASSERT_VALID(pDoc);

    if (m_Image.GetCount() == 0)
    {
        m_Image.Load(IDR_START);
        m_Image.SetSingleImage();
        m_Image.SetTransparentColor(RGB(255, 0, 255));
    }

    pDoc->SetTitle(_T("Start Page"));
}
void CSeriousSkaStudioApp::OnFileNew()
{
  // add new model instance
  CModelInstance *pmi = OnAddNewModelInstance();
  if(pmi == NULL)
  {
    //delete pDocument;
    theApp.ErrorMessage("Failed to create model instance");
    return;
  }

  CDocument* pDocument = m_pdtDocTemplate->CreateNewDocument();
  if (pDocument == NULL)
	{
		TRACE0("CDocTemplate::CreateNewDocument returned NULL.\n");
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		return;
	}
	ASSERT_VALID(pDocument);
  // View creation
	CFrameWnd* pFrame = m_pdtDocTemplate->CreateNewFrame(pDocument, NULL);
	if (pFrame == NULL)
	{
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		delete pDocument;       // explicit delete on error
		return;
	}
	ASSERT_VALID(pFrame);

  // add file to mru
  CTString strFileName = pmi->mi_fnSourceFile.FileName() + pmi->mi_fnSourceFile.FileExt();
  CString strOpenPath;
  strOpenPath = theApp.GetProfileString(L"SeriousSkaStudio", L"Open directory", L"");
  strOpenPath += pmi->mi_fnSourceFile;

  pDocument->SetPathName(CString(strFileName), TRUE);
  pDocument->SetTitle(CString(strFileName));

  pDocument->SetModifiedFlag( FALSE);
	m_pdtDocTemplate->InitialUpdateFrame(pFrame, pDocument, TRUE);
  // set root model instance
  theApp.GetDocument()->m_ModelInstance = pmi;
  // theApp.SaveRootModel();
  // fill tree view with new model instance
  // ReloadRootModelInstance();
  UpdateRootModelInstance();
}
Beispiel #5
0
bool CFrameWndFactory::CreateFrameWnd(LPCWSTR factoryFile)
{
    CXTPWinDwmWrapper().SetProcessDPIAware();   // Support high DPI on Vista or above.

    std::wstring xtpfile(getTranslationsPath(L"ToolkitPro.Resource.xml"));
    if (PathFileExistsW(xtpfile.c_str()))
        XTPResourceManager()->SetResourceFile(xtpfile.c_str());
    else
        TRACE1("Warning: no translation file '%s'\n", xtpfile.c_str());

    Object<IConfigXml> xmlfile(x3::clsidXmlFile);
    ASSERT_MESSAGE(xmlfile, "Need the configxml plugin.");
    xmlfile->SetFileName((getConfigPath() + factoryFile).c_str());
    ASSERT_MESSAGE(xmlfile->Reload(), "No xml file or need to setup MSXML4.");

    ConfigSection root(xmlfile->GetData()->GetSection(L""));
    ConfigSection mainframe(root.GetSection(L"mainframe"));
    bool mdi = root->GetBool(L"mdi", false);

    g_factoryRoot = root;
    g_factoryRoot->SetString(L"_appid", m_appid.c_str());

    Object<IUIOptionsInit> initOptions(clsidUIOptions);
    initOptions->setFileName((getConfigPath() + 
        root->GetString(L"optionsFile", L"uioptions.xml")).c_str());

    RegisterDocTemplate(mdi, mainframe, root.GetSection(L"views"));
    if (mdi)
    {
        CMainMDIFrame* pFrame = new CMainMDIFrame;
        if (!pFrame->LoadFrame(0))
            return FALSE;

        std::vector<ViewItem>::const_iterator it = s_views.begin();
        for (; it != s_views.end(); ++it)
        {
            if (!it->caption.empty())
            {
                CDocument* pDoc = it->pTemplate->OpenDocumentFile(NULL);
                pDoc->SetTitle(it->caption.c_str());
            }
        }
    }

    return ProcessShellCommand();
}
Beispiel #6
0
// @pymethod |PyCDocument|SetTitle|Set the title of the document (ie, the name
// to appear in the window caption for the document.
static PyObject *
ui_doc_set_title(PyObject *self, PyObject *args)
{
	TCHAR *title;
	PyObject *obtitle;
	if (!PyArg_ParseTuple(args, "O", &obtitle)) // @pyparm string|title||The new title.
		return NULL;
	if (!PyWinObject_AsTCHAR(obtitle, &title, FALSE))
		return NULL;
	CDocument *pDoc;
	if (!(pDoc=PyCDocument::GetDoc(self)))
		return NULL;
	GUI_BGN_SAVE;
	pDoc->SetTitle(title); // @pyseemfc CDocument|SetTitle
	GUI_END_SAVE;
	PyWinObject_FreeTCHAR(title);
	RETURN_NONE;
}
Beispiel #7
0
void CChatFrame::OnLobby( UINT nID )
{
	clearIdleTime();

	int game = nID - ID_GAMES_BEGIN;
	if ( game < 0 || game >= m_Games.size() )
		return;

	// set the current game
	CGCQLApp::sm_Game = m_Games[ game ];
	CGCQLApp::selectGame( CGCQLApp::sm_Game.id, false );

	CDocument * pDoc = GetActiveDocument();
	if ( pDoc != NULL )
		pDoc->SetTitle( CGCQLApp::sm_Game.name );

	//// set timer for updates
	////SetTimer( 0x2, 5000, NULL );
}
Beispiel #8
0
void CMainFrame::OnViewPrediction()
{
	// TODO: Add your command handler code here
	CDocument* pDoc;
	CView* pView;
	CCreateContext context;
	CRect rect;
	pView=(CView*)m_splitter.GetPane(0,0);
	pView->GetWindowRect(rect);
	if(!pView)
	{
		AfxMessageBox("Unexpected error occurs");
		return;
	}
	pDoc=pView->GetDocument();
	CString title=pDoc->GetTitle();
	if(!pDoc)
	{
		AfxMessageBox("Unexpected error occurs");
		return;
	}
	pDoc->m_bAutoDelete=false;
	m_splitter.GetPane(0,0)->DestroyWindow();
	pDoc->m_bAutoDelete=true;
	context.m_pNewViewClass=RUNTIME_CLASS(CPredView);
	context.m_pCurrentDoc=pDoc;
	context.m_pLastView=NULL;
	context.m_pNewDocTemplate=NULL;
	context.m_pCurrentFrame=NULL;
	m_splitter.CreateView(0,0,RUNTIME_CLASS(CPredView),CSize(rect.Width(),rect.Height()),&context);
	((CView*)m_splitter.GetPane(0,0))->OnInitialUpdate();// it is important to call initial update before create a view expecially a CScrollView
	m_splitter.RecalcLayout();
	m_splitter.GetPane(0,0)->SendMessage(WM_PAINT);
	SetActiveView((CScrollView*)m_splitter.GetPane(0,0));
	pDoc->SetTitle(title);
	((CFCCDoc*)pDoc)->MessageCenter(IDS_MESSAGE_MAKEPREDICTION);
	

}
Beispiel #9
0
BOOL CChatFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
	if (! CFrameWnd::OnCreateClient( lpcs, pContext ) )
		return FALSE;

	int nRightSize = PLAYER_VIEW_WIDTH;
	int nLeftSize =  lpcs->cx - nRightSize;

	m_wndSplitter.CreateStatic( this, 1, 2 );
	m_wndSplitter.CreateView( 0, 0, RUNTIME_CLASS( CChatView ), CSize( nLeftSize, lpcs->cy), pContext );
	m_wndSplitter.CreateView( 0, 1, RUNTIME_CLASS( CPlayerView ), CSize( nRightSize, lpcs->cy), pContext );
	m_bSplitterInit = true;

	m_hIcon = AfxGetApp()->LoadIcon( IDR_MAINFRAME );
	m_hMessageIcon = AfxGetApp()->LoadIcon( IDI_PMESSAGE );

	CDocument * pDoc = GetActiveDocument();
	if ( pDoc != NULL )
		pDoc->SetTitle( CGCQLApp::sm_Game.name );

	SetTimer( 0x1, 1000, NULL );

	return TRUE;
}
Beispiel #10
0
BOOL CCafeOrangeApp::InitInstance()
{
	// 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);

	CWinAppEx::InitInstance();


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

	AfxEnableControlContainer();

	EnableTaskbarInteraction();

	// AfxInitRichEdit2() is required to use RichEdit control	
	// AfxInitRichEdit2();

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


	InitContextMenuManager();
	InitShellManager();

	InitKeyboardManager();

	InitTooltipManager();
	CMFCToolTipInfo ttParams;
	ttParams.m_bVislManagerTheme = TRUE;
	theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
		RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);

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

	CMultiDocTemplate* pOpenCVDocTemplate;
	pOpenCVDocTemplate = new CMultiDocTemplate(IDR_CafeOrangeTYPE,
		RUNTIME_CLASS(CCafeOrangeDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(COpenCVView));
	if (!pOpenCVDocTemplate)
		return FALSE;
	AddDocTemplate(pOpenCVDocTemplate);

	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
	{
		delete pMainFrame;
		return FALSE;
	}
	m_pMainWnd = pMainFrame;
	// 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;
	cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
	ParseCommandLine(cmdInfo);

	// Dispatch commands specified on the command line.  Will return FALSE if
	// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;
	// The main window has been initialized, so show and update it
	pMainFrame->ShowWindow(m_nCmdShow);
	//pMainFrame->UpdateWindow();
	
	CDocument* pOpenCVDoc = pOpenCVDocTemplate->OpenDocumentFile(NULL);
	CDocument* pImageEditorDoc = pImageEditorDocTemplate->OpenDocumentFile(NULL);

	pOpenCVDoc->SetTitle("Movie");
	pImageEditorDoc->SetTitle("ImageEditor");

	POSITION OpenCVPosition= pOpenCVDoc->GetFirstViewPosition();
	CView *pOpenCVView = pOpenCVDoc->GetNextView(OpenCVPosition);
	//CMDIChildWndEx* pOpenCVWnd = (CMDIChildWndEx*)pOpenCVView->GetParentFrame();

	POSITION ImageEditorPosition = pImageEditorDoc->GetFirstViewPosition();
	CView *pImageEditorView = pImageEditorDoc->GetNextView(ImageEditorPosition);
	//CMDIChildWndEx* pImageEditorWnd = (CMDIChildWndEx*)pImageEditorView->GetParentFrame();
	
	pMainFrame->InitializeMDIView(pOpenCVView, pImageEditorView);
	pMainFrame->UpdateWindow();


	return TRUE;
}
Beispiel #11
0
void CScriptView::OnScriptMakeModel() 
{
	// First we save script file
  CModelerDoc *pDoc = (CModelerDoc *) GetDocument();
  CTFileName fnScriptName = CTString(pDoc->GetPathName());

  CTFileName fnModelName = fnScriptName.FileDir() + fnScriptName.FileName() + ".mdl";
  try
  {
    fnScriptName.RemoveApplicationPath_t();
  }
  catch( char *err_str)
  {
    AfxMessageBox( err_str);
    return;
  }
  pDoc->OnSaveDocument( pDoc->GetPathName());

	// close mdl document with same name
  POSITION pos = theApp.m_pdtModelDocTemplate->GetFirstDocPosition();
  while (pos!=NULL)
  {
    CModelerDoc *pmdCurrent = (CModelerDoc *)theApp.m_pdtModelDocTemplate->GetNextDoc(pos);
    if( CTFileName( CTString(pmdCurrent->GetPathName())) == fnModelName)
    {
      pmdCurrent->OnCloseDocument();
      break;
    }
  }

	// Now we will create one instance of new document of type CModelerDoc
  CDocument* pDocument = theApp.m_pdtModelDocTemplate->CreateNewDocument();
 	if (pDocument == NULL)
	{
		TRACE0("CDocTemplate::CreateNewDocument returned NULL.\n");
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		return;
	}
	ASSERT_VALID(pDocument);
	
  BOOL bAutoDelete = pDocument->m_bAutoDelete;
	pDocument->m_bAutoDelete = FALSE;   // don't destroy if something goes wrong
	CFrameWnd* pFrame = theApp.m_pdtModelDocTemplate->CreateNewFrame(pDocument, NULL);
	pDocument->m_bAutoDelete = bAutoDelete;
	if (pFrame == NULL)
	{
		AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
		delete pDocument;       // explicit delete on error
		return;
	}
	ASSERT_VALID(pFrame);

  pDocument->SetPathName( fnModelName, FALSE);
  pDocument->SetTitle( fnModelName.FileName() + fnModelName.FileExt());
  
  char strError[ 256];
  if( !((CModelerDoc *)pDocument)->CreateModelFromScriptFile( fnScriptName, strError))
  {
    pDocument->OnCloseDocument();
    AfxMessageBox( strError);
    return;
  }
	theApp.m_pdtModelDocTemplate->InitialUpdateFrame(pFrame, pDocument, TRUE);
  ((CModelerDoc *)pDocument)->m_emEditModel.edm_md.md_bPreparedForRendering = FALSE;
  pDocument->SetModifiedFlag();

  // add textures from .ini file
  CTFileName fnIniFileName = fnScriptName.NoExt() + ".ini";
  try
  {
    ((CModelerDoc *)pDocument)->m_emEditModel.CSerial::Load_t(fnIniFileName);
  }
  catch( char *strError)
  {
    // ignore errors
    (void) strError;
  }
}