void CNuGenDimensionDoc::OnSTLImport()
{
	CString     Path;

	CFileDialog dlg(
		TRUE,
		NULL,               // Open File Dialog
		_T("*.stl"),              // Default extension
		OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, // No default filename
		_T("STL (*.stl)|*.stl||"));// Filter string

	if (dlg.DoModal() != IDOK)
		return;
	Path = dlg.GetPathName();

	GetDocTemplate()->OpenDocumentFile(NULL);

	sgFileManager::ImportSTL(sgGetScene(),Path.GetBuffer());

	POSITION pos = GetFirstViewPosition();
	while (pos != NULL)
	{
		CView* pView = GetNextView(pos);
		pView->OnInitialUpdate();
	}
	//AfxMessageBox("Sorry, its DEMO");
}
Пример #2
0
void CMainFrame::SwitchToView(eView nView)
{
	CView* pOldActiveView = GetActiveView();
	CView* pNewActiveView = (CView*) GetDlgItem(nView);
	if (pNewActiveView == NULL) {
		switch (nView) {
		case STRING:
			pNewActiveView = (CView*) new CStringView;
			break;
		case HEX:
			pNewActiveView = (CView*) new CHexView;
			break;
		}
		CCreateContext context;
		context.m_pCurrentDoc = pOldActiveView->GetDocument();
		pNewActiveView->Create(NULL, NULL, WS_BORDER,
			CFrameWnd::rectDefault, this, nView, &context);
		pNewActiveView->OnInitialUpdate();
	}
	SetActiveView(pNewActiveView);
	pNewActiveView->ShowWindow(SW_SHOW);
	pOldActiveView->ShowWindow(SW_HIDE);
	pOldActiveView->SetDlgCtrlID(
		pOldActiveView->GetRuntimeClass() == 
		RUNTIME_CLASS(CStringView) ? STRING : HEX);
	pNewActiveView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
	RecalcLayout();
}
Пример #3
0
void CMainFrame::SwitchView(ViewType nType)
{
	CView* pOldView = GetActiveView();
	CView* pNewView = (CView*)GetDlgItem(nType);

	if(pNewView == NULL)
	{
		switch(nType)
		{
		case FORMVIEW:
			pNewView = (CView*)new CMultiLookView;
			break;
		case FONTVIEW:
			pNewView = (CView*)new CFontView;
			break;
		case PAINTVIEW:
			pNewView = (CView*)new CPaintView;
			break;
		}

		CCreateContext context;
		context.m_pCurrentDoc = pOldView->GetDocument();
		pNewView->Create(NULL, NULL, WS_BORDER, 
			CFrameWnd::rectDefault, this, nType, &context);
		pNewView->OnInitialUpdate();
	}

	SetActiveView(pNewView);
	pNewView->ShowWindow(SW_SHOW);
	pOldView->ShowWindow(SW_HIDE);
	if(pOldView->GetRuntimeClass() == RUNTIME_CLASS(CMultiLookView))
		pOldView->SetDlgCtrlID(FORMVIEW);
	if(pOldView->GetRuntimeClass() == RUNTIME_CLASS(CFontView))
		pOldView->SetDlgCtrlID(FONTVIEW);
	if(pOldView->GetRuntimeClass() == RUNTIME_CLASS(CPaintView))
		pOldView->SetDlgCtrlID(PAINTVIEW);

	pNewView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
	RecalcLayout();
	
}
Пример #4
0
CImconDoc * CImconApp::NewImage(HANDLE hDib)
{
  if (!hDib)
    return NULL;

  POSITION Position = GetFirstDocTemplatePosition();
  CImconDoc *pDoc = (CImconDoc *) GetNextDocTemplate(Position)->OpenDocumentFile(NULL);
  if (pDoc)
    {
     pDoc->m_Dib.SetHandle(hDib);
     pDoc->SetProperties();
     pDoc->m_strFormat = "Bitmap"; 
     ((CMainFrame *) AfxGetMainWnd())->SetImageSize(pDoc->m_uWidth,
                                                    pDoc->m_uHeight,
                                                    pDoc->m_uBPP);
     ((CMainFrame *) AfxGetMainWnd())->SetImageFormat((LPCSTR) pDoc->m_strFormat);

     POSITION pos = pDoc->GetFirstViewPosition();
     CView* pFirstView = pDoc->GetNextView(pos);
     pFirstView->OnInitialUpdate();
    }

  return pDoc;
}
Пример #5
0
BOOL CStaticDoc::ShowStaticView( CRuntimeClass * pViewClass, BOOL bMaximized )
{
	if( NULL == pViewClass )
		return FALSE;

	CChildFrame * pChildFrame = NULL;

	POSITION pos = GetFirstViewPosition( );
	CView * pView = NULL;
	while( pView = GetNextView(pos) )
	{
		if( pView->IsKindOf( pViewClass ) )
		{
			pChildFrame = DYNAMIC_DOWNCAST( CChildFrame, pView->GetParentFrame() );
			ASSERT( pChildFrame );
			if( pChildFrame )
				break;
		}
	}

	if( NULL == pChildFrame )
	{
		// create frame
		pChildFrame = CChildFrame::CreateNewFrame( this );
		ASSERT( pChildFrame );

		if( pChildFrame )
		{
			// create view
			CCreateContext context;
			context.m_pCurrentDoc = this;
			context.m_pCurrentFrame = pChildFrame;
			context.m_pLastView = NULL;
			context.m_pNewDocTemplate = NULL;
			context.m_pNewViewClass = pViewClass;

			CView * pNewView = DYNAMIC_DOWNCAST(CView,pChildFrame->CreateView( &context, AFX_IDW_PANE_FIRST));
			if( pNewView )
			{
				pChildFrame->SetActiveView( pNewView );
				pNewView->OnInitialUpdate( );
			}

			// if no active child frame, maximize this frame
			CMainFrame * pMainFrame = AfxGetMainFrame();
			if( pMainFrame )
			{
				CFrameWnd * pActiveFrame = AfxGetMainFrame()->GetActiveFrame();
				if( !pActiveFrame || !pActiveFrame->IsKindOf(RUNTIME_CLASS(CChildFrame)) )
					pChildFrame->MDIMaximize();
			}
		}
	}
	
	if( pChildFrame )
	{
		// activate it
		pChildFrame->MDIActivate();
		if( bMaximized )
			pChildFrame->MDIMaximize();
		else
			pChildFrame->ShowWindow( SW_SHOW );
	}

	return TRUE;
}
Пример #6
0
BOOL CProdbApp::InitInstance()
{
	AfxEnableControlContainer();

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

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

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

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

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

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

	POSITION pos= pDocTemplate->GetFirstDocPosition();
	CDocument * pDoc = pDocTemplate->GetNextDoc(pos);

	CView *pView;

	pView = (CView*)new CProdbView;
	pView->Create(NULL,NULL,0L,CRect(0,0,0,0),AfxGetMainWnd(),AFX_IDW_PANE_FIRST+1,NULL);
	pDoc->AddView(pView);
	pView->OnInitialUpdate();

	pView = (CView*) new CSellView;
	pView->Create(NULL,NULL,0L,CRect(0,0,0,0),AfxGetMainWnd(),AFX_IDW_PANE_FIRST+2,NULL);
	pDoc->AddView(pView);
	pView->OnInitialUpdate();

	pView = (CView*) new CWhView;
	pView->Create(NULL,NULL,0L,CRect(0,0,0,0),AfxGetMainWnd(),AFX_IDW_PANE_FIRST+3,NULL);
	pDoc->AddView(pView);
	pView->OnInitialUpdate();

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

	return TRUE;
}
Пример #7
0
/********************************************************************
* Funzione   : SwitchToForm
* Descrizione: Passa a visualizzare una diversa view nel pannello di destra
               della splitter window, e un nuovo menu e una nuova toolbar
							 nella frame window
* Parametri  : nForm = intero che e' l'ID (identificatore) della nuova vista
                       da visualizzare nel pannello di destra
* Ritorno    : 
* Note       : 
*********************************************************************/
void CMainFrame::SwitchToForm(int nForm)
{
	CMenu menu;
	//static bool bFirst = true;

	// ricava un puntatore alla vista (child window) attualmente presente nel pannello
	// di destra della splitter window
	CView* pOldActiveView = (CView*)m_wndSplitter.GetPane(0, 1);

  // ricava un puntatore alla child window avente identificatore nForm	
	CView* pNewActiveView = (CView*)GetDlgItem(nForm);

	// se non esite una child window con identificatore nForm (il puntatore e' nullo),
	// la crea
	if (pNewActiveView == NULL)     
	{                               
		CCreateContext context; 
		context.m_pCurrentDoc = pOldActiveView->GetDocument();
		// nascondo la view atualmente visualizzata e passa l'attivazione ad un altra
		pOldActiveView->ShowWindow(SW_HIDE);
		// disattivo l'autodistruzione del doc
		context.m_pCurrentDoc->m_bAutoDelete = FALSE;
		// cancello la vecchia view
    m_wndSplitter.DeleteView(0, 1);
		// riattivo l'autodistruzione del doc					  							  
		context.m_pCurrentDoc->m_bAutoDelete = TRUE;
		switch(m_iForm = nForm) 
		{
			case IDD_FORM_AZIENDE:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CAziendeView), CSize(0,0), &context); 
				menu.LoadMenu(IDR_MENU_AZIENDE);
				m_wndToolBar.LoadToolBar(IDR_TOOLBAR_AZIENDE);
		 		break;
			case IDD_FORM_VERBALI:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CVerbaliView), CSize(0,0), &context);
#ifdef WINSIGMA2
				menu.LoadMenu(IDR_MENU_VERBALI_WS2);
#else
				menu.LoadMenu(IDR_MENU_VERBALI);
#endif
				m_wndToolBar.LoadToolBar(IDR_TOOLBAR_VERBALI);
#ifdef WINSIGMA2
				m_wndToolBar.SetButtonInfo(0,ID_SEPARATOR,TBBS_SEPARATOR,0);
				m_wndToolBar.SetButtonInfo(2,ID_SEPARATOR,TBBS_SEPARATOR,0);
#endif
		 		break;
			case IDD_FORM_FATTURE:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CFattureView), CSize(0,0), &context);
				menu.LoadMenu(IDR_MENU_FATTURE);
				m_wndToolBar.LoadToolBar(IDR_TOOLBAR_FATTURE);
		 		break;				
			case IDD_FORM_LISTINI:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CListiniView), CSize(0,0), &context);
				menu.LoadMenu(IDR_MENU_LISTINI);
				m_wndToolBar.LoadToolBar(IDR_TOOLBAR_LISTINI);
		 		break;				
			case IDD_FORM_OPERATORI:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(COperatoriView), CSize(0,0), &context);
				menu.LoadMenu(IDR_MENU_OPERATORI);
				m_wndToolBar.LoadToolBar(IDR_TOOLBAR_OPERATORI);
		 		break;				
			case IDD_FORM_PAGAMENTI:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CTipiPagamentoView), CSize(0,0), &context);
				menu.LoadMenu(IDR_MENU_PAGAMENTI);
				m_wndToolBar.LoadToolBar(IDR_TOOLBAR_PAGAMENTI);
		 		break;				
			case IDD_FORM_MATERIALI:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CTipiMaterialeView), CSize(0,0), &context);
				menu.LoadMenu(IDR_MENU_MATERIALI);
				m_wndToolBar.LoadToolBar(IDR_TOOLBAR_MATERIALI);
		 		break;				
			case IDD_FORM_MARCHI:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CMarchiView), CSize(0,0), &context);
				menu.LoadMenu(IDR_MENU_MARCHI);
				m_wndToolBar.LoadToolBar(IDR_TOOLBAR_MARCHI);
		 		break;	
			case IDD_FORM_ARCHIVIO_VERBALI:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CArchivioVerbaliView), CSize(0,0), &context);
				menu.LoadMenu(IDR_MENU_ARCHIVIO_VERBALI);
				m_wndToolBar.LoadToolBar(IDR_TOOLBAR_ARCHIVIO_VERBALI);
		 		break;
			case IDD_FORM_ARCHIVIO_CERTIFICATI:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CArchivioCertificatiView), CSize(0,0), &context);
				menu.LoadMenu(IDR_MENU_ARCHIVIO_CERTIFICATI);
				m_wndToolBar.LoadToolBar(IDR_TOOLBAR_ARCHIVIO_CERTIFICATI);
		 		break;	
			case IDD_FORM_ARCHIVIO_FATTURE:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CArchivioFattureView), CSize(0,0), &context);
				menu.LoadMenu(IDR_MENU_ARCHIVIO_FATTURE);
				m_wndToolBar.LoadToolBar(IDR_TOOLBAR_ARCHIVIO_FATTURE);
		 		break;
			case IDD_FORM_STATISTICHE_PROVE:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CStatProveView), CSize(0,0), &context);
				menu.Detach();
		 		break;
			case IDD_FORM_STATISTICHE_FATTURATO:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CStatFatturatoView), CSize(0,0), &context);
				menu.Detach();
		 		break;
			case IDD_FORM_TOTALI_FATTURATO:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CTotFatturatoView), CSize(0,0), &context);
				menu.Detach();
		 		break;

			case IDD_FORM_ESPORTAZIONE_CSV:
				m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CEsportazioneCSVView), CSize(0,0), &context);
				menu.Detach();
		 		break;

		}
		// imposta il nuovo menu come menu corrente
		SetMenu(&menu);
		// discollega il windows menu handle dall'oggetto, cosicche' uscendo tra poco dalla
		/// funzione, il distruttore dell'oggetto CMenu non distruggera' il nuovo menu
		menu.Detach();

		CView* pView = (CView*)m_wndSplitter.GetPane(0, 1);
    if (pView)
		{
      SetActiveView(pView);

      if ( !bFirst)
		    pView->OnInitialUpdate();
			
			bFirst = false;
    }
	}

	// imposto la larghezza dei due pannelli in base alla vista selezionata
	CRect r;
	GetClientRect(&r);
	
	int w1 = (r.Width() * SPLIT_RATIO) / 100;
	int w2 = (r.Width() * (100 - SPLIT_RATIO)) / 100;
	
//	m_wndSplitter.SetColumnInfo( 0, w1, 0);
//	m_wndSplitter.SetColumnInfo( 1, w2, 0);


	// adatto il frame
	m_wndSplitter.RecalcLayout();
}