Esempio n. 1
0
	virtual void ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
		{
			CreateView();
			return;
		}
		break;
		case eFE_Activate:
		{
			if (IsPortActive(pActInfo, EIP_Enable))
			{
				if (m_pView == NULL)
					CreateView();

				if (m_pView == NULL)
					return;

				if (pActInfo->pEntity == NULL)
					return;

				SViewParams params;

				params.justActivated  = true;
				params.fov            = DEG2RAD(GetPortFloat(pActInfo, EIP_FOV));
				params.blend          = GetPortBool(pActInfo, EIP_Blend);
				params.blendFOVOffset = DEG2RAD(GetPortFloat(pActInfo, EIP_BlendFOVOffset));
				params.blendFOVSpeed  = GetPortFloat(pActInfo, EIP_BlendFOVSpeed);
				params.blendPosOffset = GetPortVec3(pActInfo, EIP_BlendPosOffset);
				params.blendPosSpeed  = GetPortFloat(pActInfo, EIP_BlendPosSpeed);
				params.blendRotSpeed  = GetPortFloat(pActInfo, EIP_BlendRotSpeed);
				params.blendRotOffset = Quat::CreateRotationXYZ(static_cast<Ang3>(GetPortVec3(pActInfo, EIP_BlendRotOffset)));

				m_pView->SetCurrentParams(params);
				m_pView->LinkTo(pActInfo->pEntity);

				m_pViewSystem->SetActiveView(m_pView);
			}
			else if (IsPortActive(pActInfo, EIP_Disable))
			{
				if (m_pLocalPlayerView)
					m_pViewSystem->SetActiveView(m_pLocalPlayerView);
			}
			else if (IsPortActive(pActInfo, EIP_FOV))
			{
				SViewParams params;
				params.fov = DEG2RAD(GetPortFloat(pActInfo, EIP_FOV));
				m_pView->SetCurrentParams(params);
			}
		}
		break;
		}
	}
int CSecondarySplitter::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CSplitterWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
   CSize size(100,100);
	
	//CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
   if(CreateView(0,0,RUNTIME_CLASS(CSubmissionProperties),size,pContext)==FALSE) return 0;
   if(CreateView(1,0,RUNTIME_CLASS(CSubmitInfo),size, pContext)==FALSE)          return 0;

	return 0;
}
/// <summary>
/// Creates the main window and begins processing
/// </summary>
int CMainWindow::Run()
{
    // Create main application window
    CreateView();

    // Show the main window
    ShowView();

    // Show the kinect windows
    ShowAllKinectWindows();

    // Main message loop
    MSG msg = {0};

    while (WM_QUIT != msg.message)
    {
        if (GetMessageW(&msg, nullptr, 0, 0))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    return static_cast<int>(msg.wParam);
}
Esempio n. 4
0
AP_MSG_HANDLER_METHOD(WebViewModule, WebView_Create)
{
  if (views_.Find(pMsg->hView) != 0) { throw ApException(LOG_CONTEXT, "view=" ApHandleFormat " already exists", ApHandlePrintf(pMsg->hView)); }
  View* pView = CreateView(pMsg->hView, pMsg->nLeft, pMsg->nTop, pMsg->nWidth, pMsg->nHeight);
  bWebKitUsed_ = 1;
  pMsg->apStatus = ApMessage::Ok;
}
int CTransferDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	CCreateContext context;
	context.m_pCurrentFrame = this;
	context.m_pCurrentDoc = NULL;
	context.m_pNewViewClass = RUNTIME_CLASS(CTransferWnd);
	context.m_pNewDocTemplate = NULL;
	m_pwndTransfer = (CTransferWnd*)CreateView(&context);
	m_pwndTransfer->ModifyStyle(WS_BORDER, 0);
	m_pwndTransfer->ModifyStyleEx(WS_EX_CLIENTEDGE, WS_EX_STATICEDGE);

	m_pwndToolbar->Create(this, IDD_DOWNLOAD_TOOLBARS, 
						 WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_SIZE_FIXED | CBRS_SIZE_DYNAMIC | CBRS_GRIPPER, 
						 IDBAR_DOWNLOAD_TOOLBAR);
	ASSERT( m_pwndToolbar->GetStyle() & WS_CLIPSIBLINGS );
	ASSERT( m_pwndToolbar->GetStyle() & WS_CLIPCHILDREN );
	m_pwndToolbar->SetWindowText(GetResString(IDS_DOWNLOADCOMMANDS));
	m_pwndToolbar->EnableDocking(CBRS_ALIGN_ANY);

	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(m_pwndToolbar, AFX_IDW_DOCKBAR_LEFT, (LPRECT)NULL);

	m_pwndTransfer->SendMessage(WM_INITIALUPDATE);

	LoadBarState(DOWNLOAD_TOOLBAR_PROFILE);
	DockToolbarWnd(); // Too much bug reports about vanished search parameters window. Force to dock.
	ShowToolbar(thePrefs.IsDownloadToolbarEnabled());
	m_pwndToolbar->SetCommandTargetWnd(GetDownloadList());
	Localize();

	return 0;
}
Esempio n. 6
0
int CPrintFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
	{
        return -1;
	}

    CCreateContext context;
    context.m_pNewViewClass = RUNTIME_CLASS(CPrintView);
    context.m_pCurrentFrame = this;
    context.m_pCurrentDoc = NULL;
    context.m_pLastView = NULL;
    m_pView = STATIC_DOWNCAST(CPrintView, CreateView(&context)); 
    if(m_pView != NULL)
    {
        m_pView->ShowWindow(SW_SHOW);
        SetActiveView(m_pView);
    }
    SetIcon(m_pOldWnd->GetIcon(FALSE),FALSE);
	SetIcon(m_pOldWnd->GetIcon(TRUE),TRUE);
	ShowWindow(SW_MAXIMIZE);
	CWinApp* pApp=AfxGetApp();
	m_pOldFram = pApp->m_pMainWnd;
	pApp->m_pMainWnd=this;
	m_pView->OnFilePrintPreview();
    //m_pView->SendMessage(WM_COMMAND, ID_FILE_PRINT);//直接打印
    m_pOldWnd->ShowWindow(SW_HIDE);
    return 0;
}
int AW_CMultiViewSplitter::AddView(int nRow, int nCol, CRuntimeClass * pViewClass, 
								   CCreateContext* pContext)
{
	// hide the current view of the pane
	int PreviousID = HideCurrentView(nRow, nCol);

	// create the new view, if fail, set the previous view current 
	if (CreateView(nRow, nCol, pViewClass, CSize(10,10), pContext) == 0)
	{
		if (PreviousID != -1)
			SetCurrentView(nRow, nCol, PreviousID);
		return -1;
	}

	// get and store the new view
	int NewViewID = m_nIDCounter;
	CWnd* pNewWnd = GetPane(nRow, nCol);
	CPoint pane(nRow, nCol);
	long paneID = MAKELONG(pane.x,pane.y);
	m_mapViewPane.insert(map<int, long>::value_type(NewViewID,paneID));
	m_mapIDViews.insert(map<int, CWnd*>::value_type(NewViewID, pNewWnd));

	// set the new view current
	SetCurrentView(nRow, nCol, NewViewID);

	RedrawWindow();
	m_nIDCounter ++;
	return NewViewID;
}
Esempio n. 8
0
void LayoutConfigure( Layout layout, int rows, int columns ) {

  int i;
	
  layout->rows = rows;
  layout->columns = columns;

  if ( rows * columns > layout->n_views ) {

    layout->views = (View *) realloc( layout->views, rows * columns * sizeof(View));

    if ( !layout->views ) {
      fprintf(stderr, "LayoutCreate - malloc error for View array.\n" );
      exit( -1 );
    }

    for ( i = layout->n_views; i < rows * columns; i++ ) {
      layout->views[ i ] = CreateView( layout->display );
    }
    layout->n_views = rows * columns;

  }
    
  LayoutSetDisplayEdgesRelative( layout, layout->left, layout->bottom, 
				 layout->right, layout->top );

}
BOOL CFlowChartViewChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)  {
    static CCreateContext newContext;
    newContext.m_pNewViewClass=RUNTIME_CLASS(CGraphView);
    CGraphView* proc = (CGraphView *)CreateView(&newContext);
    m_ClientWnd=proc;
    proc->OnInitialUpdate();
    return TRUE;
}
Esempio n. 10
0
SampleView::SampleView(void *data, bool createDefaultRenderer) :
		mGLView(nullptr),
		mViewRenderer(nullptr) {
	mGLView = CreateView(data);
	if (createDefaultRenderer) {
		mViewRenderer = new BasicRenderer();
	}
}
BOOL CDormantChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)  {
    static CCreateContext newContext;
    newContext.m_pNewViewClass=RUNTIME_CLASS(CDormantProcessor);
    CDormantProcessor* proc = (CDormantProcessor *)CreateView(&newContext);
    m_DormantProcessor=proc;
    proc->OnInitialUpdate();
    return TRUE;
}
INT_PTR MessageProc(int message_type, INT_PTR param1, INT_PTR param2, INT_PTR param3)
{
	switch (message_type)
	{
	case ML_MSG_TREE_ONCREATEVIEW:     // param1 = param of tree item, param2 is HWND of parent. return HWND if it is us
		return CreateView(param1, (HWND)param2);
	}
	return 0;
}
		//--------------------------------------------------------
		/// Create View
		///
		/// Recursive function used to create subviews
		///
		/// @param View XML element
		/// @return Created view
		//--------------------------------------------------------
		GUIViewUPtr GUIViewFactory::CreateView(Core::XML::Node* inpViewElement)
		{
			//Get the view type
			//Get the param dictionary config values
			GUIViewUPtr pView;
            std::string strType;
            std::string strSource;
            bool bExtern = false;
            Core::StorageLocation eStorageLoc = Core::StorageLocation::k_none;
            
            for(Core::XML::Attribute* pAttr = Core::XMLUtils::GetFirstAttribute(inpViewElement); pAttr != nullptr; pAttr = Core::XMLUtils::GetNextAttribute(pAttr))
            {
                
                if(Core::XMLUtils::GetName(pAttr) == "Type")
                {
                    strType = Core::XMLUtils::GetValue(pAttr);
                }
                else if(Core::XMLUtils::GetName(pAttr) == "Source")
                {
                    bExtern = true;
                    strSource = Core::XMLUtils::GetValue(pAttr);
                }
                else if(Core::XMLUtils::GetName(pAttr) == "StorageLocation")
                {
                    bExtern = true;
                    eStorageLoc = Core::ParseStorageLocation(Core::XMLUtils::GetValue(pAttr));
                }
            }
            
			//Create the UI of the given type
			MapDelegateToString::iterator it = mmapDelegateToType.find(strType);
			if(it != mmapDelegateToType.end())
			{
				Core::ParamDictionary sParams = Core::ParamDictionarySerialiser::FromString(inpViewElement->value());
	
				//Lets load the given type!
				pView = (it->second)(sParams);
                
                if(bExtern)
                {
                    pView->AddSubview(CreateGUIViewFromScript(eStorageLoc, strSource));
                }
                
				//Now we need to do some recursion and load any subviews
                for(Core::XML::Node* pNode = Core::XMLUtils::GetFirstChildElement(inpViewElement); pNode != nullptr; pNode = Core::XMLUtils::GetNextSiblingElement(pNode))
				{
                    pView->AddSubview(CreateView(pNode));
				}

				return pView;
			}
			else
			{
				CS_LOG_ERROR("Cannot create GUI view of type: " + strType);
				return pView;
			}
		}
int CBlogPostFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CLollyFrame::OnCreate(lpCreateStruct) == -1)
		return -1;

	CreateView(RUNTIME_CLASS(CBlogPostView));
	m_pView = DYNAMIC_DOWNCAST(CBlogPostView, GetDlgItem(AFX_IDW_PANE_FIRST));
	return 0;
}
Esempio n. 15
0
PPPoEAddon::PPPoEAddon(BMessage *addons)
	: DialUpAddon(addons),
	fSettings(NULL),
	fPPPoEView(NULL)
{
	fHeight = 20 // interface name control
		+ 20 // service control
		+ 5 + 2; // space between controls and bottom
	CreateView(BPoint(0,0));
}
Esempio n. 16
0
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
	if (pContext != NULL && pContext->m_pNewViewClass != NULL)
	{
		if ( ( m_worldView = CreateView(pContext, AFX_IDW_PANE_FIRST) ) == NULL)
			return FALSE;
	}
	return TRUE;

}
Esempio n. 17
0
/*******************************************************************************
  Function Name  : OnCreateClient
  Input(s)       : lpcs - Create Parameters
                   pContext - Pointer to Create Context
  Output         : BOOL - Create Result
  Functionality  : This function will be called to create window. This function
                   will create splitter window and views.
  Member of      : CTxMsgChildFrame
  Author(s)      : Raja N
  Date Created   : 15/04/2005
  Modifications  :
*******************************************************************************/
BOOL CTxMsgChildFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{
    BOOL bReturn = TRUE;
    // Create Parent Splitter
    bReturn = m_omRootSplitter.CreateStatic( this,1,1/*,WS_VISIBLE | WS_BORDER*/);

    //if successful
    if( bReturn == TRUE )
    {
        CSize omSize(0,0);

		if(m_eBUS == ETHERNET)
        {
            // Create Message blocks view splitter
            bReturn =
                m_omRootSplitter.CreateView( 0,
                                             0,
                                             RUNTIME_CLASS( CTransmitMsgEthernet),
                                             CSize(600,600),pContext );
        }
        //else if(m_eBUS == LIN)
        //{
        //    // Create Message blocks view splitter
        //    bReturn =
        //        m_omRootSplitter.CreateView( 0,
        //                                     0,
        //                                     RUNTIME_CLASS( CTransmitMsgLIN),
        //                                     CSize(400,400),pContext );
        //}
    }

    CWnd * pWnd = CreateView(pContext);
    if(pWnd != NULL)
    {
        pWnd->SetActiveWindow();
        pWnd->ShowWindow(SW_SHOW);
    }
    /* Try to load resource DLL for icons*/
    HMODULE hModAdvancedUILib = ::LoadLibrary("AdvancedUIPlugIn.dll");

    if ( hModAdvancedUILib )
    {
        SetIcon( ::LoadIcon(hModAdvancedUILib, MAKEINTRESOURCE( IDI_ICO_TX_WINDOW )), TRUE);
        ::FreeLibrary(hModAdvancedUILib);
        hModAdvancedUILib = NULL;
    }
    else
    {
        HICON hIco = AfxGetApp()->LoadIcon(IDI_ICO_TX_WINDOW);
        SetIcon(hIco, TRUE);
    }
    return TRUE;

}
Esempio n. 18
0
G_MODULE_EXPORT
void on_btn_DeviceListRefresh_clicked(GtkWidget *widget, GtkWidget* container)
{
	
	g_print("you have pressed refresh button\n");
	GtkWidget * view = CreateView();
	gtk_widget_show(view);
	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (container), view);
	g_print("\n i am executed");

}
Esempio n. 19
0
BOOL CFrameWnd::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext *pContext )
/*****************************************************************************/
{
    UNUSED_ALWAYS( lpcs );
    
    if( pContext != NULL && pContext->m_pNewViewClass != NULL &&
        CreateView( pContext ) == NULL ) {
        return( FALSE );
    }
    return( TRUE );
}
Esempio n. 20
0
//-----  OnSizeParent()  ------------------------------------------------------
int BCTabBarCtrl::InsertView(CRuntimeClass *pViewClass, int iItem, TCITEM* pTabCtrlItem, CCreateContext* pContext /*= NULL*/)
{
	ASSERT(::IsWindow(m_hWnd));
	BARTCITEM item(*pTabCtrlItem);

	if(!CreateView(pViewClass, (TCITEMHEADER*)&item, pContext))
	{
		return FALSE;
	}
	
	return ::SendMessage(m_hWnd, TCM_INSERTITEM, iItem, (LPARAM)&item);
}
Esempio n. 21
0
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
	CCreateContext pCreateContext; 
	pCreateContext.m_pCurrentFrame = this;
	pCreateContext.m_pCurrentDoc = NULL;
	
	//进程列表视
	pCreateContext.m_pNewViewClass = RUNTIME_CLASS(CMyProcessListView);
	pProcessListView = (CMyProcessListView *) CreateView(&pCreateContext,AFX_IDW_PANE_FIRST);
	ASSERT(pProcessListView);
	return TRUE;
}
Esempio n. 22
0
int main (int argc, char *argv[])
{
	HDEVICE device;
	HVIEW view;

	if (!(device = OpenDevice(NULL)))
	{
		printf("OpenDevice failed!\n");
	}

	if (!(view = CreateView(NULL, 0, 1000, 800))) {
	
		printf("CreateView failed!\n");
	}

	MoveView(view, 200, 200);

	RECT bounds;
	GetViewBounds(view, &bounds);
	printf("x: %d\n", bounds.x);
	printf("y: %d\n", bounds.y);
	printf("w: %d\n", bounds.width);
	printf("h: %d\n", bounds.height);

//	if (!(device = GetDeviceFromView(view))) {
//		printf("GetDeviceFromView failed!\n");
//	}

	GetViewSurface(device, view);

	printf("getmessage\n");

//	ReleaseDevice(device);

	TASKMSG msg;
	memset(&msg, 0, sizeof(msg));
	while ((msg.type != TASKMSG_EXIT))
	{
		if (TaskWaitMessage(&msg, -1)) {
			continue;
		}

		printf("msg: %d\n", msg.type);
		continue;
	}

	printf("OK\n");

	return 0;
}
Esempio n. 23
0
BOOL CPluginParamDlg::OnInitDialog() 
{
	CPersistDlg::OnInitDialog();
	// save initial size
	CRect	rc;
	GetWindowRect(rc);
	m_InitSize = rc.Size();
	SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), 0);	// set app icon
	m_Resize.AddControlList(this, m_CtrlList);	// add controls to resizer
	if (!CreateView())	// create parameters view
		EndDialog(IDABORT);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 24
0
/*!***********************************************************************
 @Function		ShowView
 @Access		public 
 @Param			const char * c_pszViewName
 @Returns		void
 @Description	
*************************************************************************/
void ViewManager::ShowView(const char* c_pszViewName, void* pData)
	{
	View* pNewView = NULL;
		
	ASSERT(pNewView == NULL);
	pNewView = CreateView(c_pszViewName[0] == 0 ? NULL : c_pszViewName, pData);
	pNewView->OnForeground();

	// Delete old view
	if(m_pActiveView)
		delete m_pActiveView;
	m_pActiveView = NULL;
	
	// Set new view
	m_pActiveView = pNewView;	
	}
Esempio n. 25
0
void CHelloCommand::Execute( CCgiContext& ctx )
{
    const CNcbiRegistry& reg = ctx.GetConfig();
    
    // load in the html template file
    string baseFile = reg.Get( "filesystem", "HtmlBaseFile" );
	auto_ptr<CHTMLPage> page( new CHTMLPage( NcbiEmptyString, baseFile ) );
    
    // set up to replace <@VIEW@> in template file with html returned
    // from CreateView
	page->AddTagMap( "VIEW", CreateView( ctx ) );

	// actual page output
    ctx.GetResponse().WriteHeader();
    page->Print(ctx.GetResponse().out(), CNCBINode::eHTML );
}
Esempio n. 26
0
BOOL CPGPFoneFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
	//Set up the status bar:
	mStatusBar.Create(this);
	mStatusBar.setPhoneIconID(0);
	mStatusBar.setSecureIconID(0);

	CCreateContext cc;
	
	cc.m_pNewViewClass = RUNTIME_CLASS(CPFWindow);

	mCallView = (CPFWindow *)CreateView(&cc);
	
	SetActiveView((CView*)mCallView);
	
	return CFrameWnd::OnCreateClient(lpcs, pContext);
}
Esempio n. 27
0
BOOL CuQueryMainSplitterWnd::ReplaceView(int row, int col, CRuntimeClass* pViewClass, SIZE size)
{
	CCreateContext context;
	BOOL bSetActive;

	if ((GetPane(row,col)->IsKindOf(pViewClass))==TRUE)
		return FALSE;
	
	// Get pointer to CDocument object so that it can be used in the creation 
	// process of the new view
	CDocument * pDoc= ((CView *)GetPane(row,col))->GetDocument();
	CView * pActiveView=GetParentFrame()->GetActiveView();
	if (pActiveView == NULL || pActiveView == GetPane(row, col))
		bSetActive = TRUE;
	else
		bSetActive = FALSE;
	
	//
	// set flag so that document will not be deleted when view is destroyed
	pDoc->m_bAutoDelete = FALSE;
	//
	// Delete existing view 
	((CView *) GetPane(row,col))->DestroyWindow();
	//
	// set flag back to default 
	pDoc->m_bAutoDelete = TRUE;
	
	//
	// Create new view
	context.m_pNewViewClass   = pViewClass;
	context.m_pCurrentDoc     = pDoc;
	context.m_pNewDocTemplate = NULL;
	context.m_pLastView       = NULL;
	context.m_pCurrentFrame   = NULL;
	CreateView (row, col, pViewClass, size, &context);

	CView* pNewView = (CView *)GetPane(row, col);
	
	if (bSetActive == TRUE)
		GetParentFrame()->SetActiveView (pNewView);
	
	RecalcLayout(); 
	GetPane(row, col)->SendMessage(WM_PAINT);
	return TRUE;
}
Esempio n. 28
0
void ModelViewerModule::Init(const rArrayString& args) {
	auto createControllerFunc = [&](const rString& name, rEngine* engine, ruiDocument* document) {
		return new ModelViewerController(_skeletonGeometry.get(), name, engine, document);
	};

	auto deleteControllerFunc = [](ruiController* controller) {
		delete controller;
	};

	_engine->ui->RegisterControllerClass("ModelViewerController", createControllerFunc, deleteControllerFunc);
	Model* model = nullptr;

	rString file, archive;
	ParseArgs(args, file, archive);

	if (!archive.empty()) {
		_engine->resources->OpenArchive(archive);
		model = _engine->content->Models()->LoadFromResource(file, "model");
	}
	else {
		auto fileSystemRef = _engine->filesystem->OpenReadFileRef(file);
		ModelData modelData;
		modelData.Read(*fileSystemRef);

		_engine->filesystem->CloseReadFileRef(fileSystemRef);

		model = _engine->content->Models()->LoadFromData(modelData, "model");
	}

	if (model->GetSkeleton()) {
		rPawn* pawn = new rPawn(model, "model", _engine);
		_skeletonGeometry.reset(new SkeletonGeometry(_engine, pawn));
		_engine->scene->AddActor(pawn);
	}
	else {
		rProp* prop = new rProp(model, "model", _engine);
		_engine->scene->AddActor(prop);
	}
	
	rViewport* mainViewport = CreateView(model, _engine);

	_engine->ui->LoadUiDocument("C:/development/recondite/samples/modelviewer/modelviewer/modelviewer.xml", mainViewport);

}
		//--------------------------------------------------------
		/// Create GUI View From Script
		///
		/// Creates a widget view from the given script file
		///
        /// @param The storage location to load from
        /// @param the file path
		/// @param Optional dynamic array to which views will be pushed
		/// @return GUI View
		//--------------------------------------------------------
		GUIViewUPtr GUIViewFactory::CreateGUIViewFromScript(Core::StorageLocation ineStorageLocation, const std::string& instrScriptFile)
		{
			GUIViewUPtr pRootView;

            Core::XMLUPtr xml = Core::XMLUtils::ReadDocument(ineStorageLocation, instrScriptFile);
             CS_ASSERT(xml != nullptr, "Cannot open GUI file: " + instrScriptFile);
            
            Core::XML::Node* pDocRoot = Core::XMLUtils::GetFirstChildElement(xml->GetDocument());
			if(pDocRoot && Core::XMLUtils::GetName(pDocRoot) == "Layout")
			{
				Core::XML::Node* pViewElement = Core::XMLUtils::GetFirstChildElement(pDocRoot);
				if(pViewElement)
				{
					pRootView = CreateView(pViewElement);
				}
			}

			return pRootView;
		}
Esempio n. 30
0
    // JG TODO: why this is a member function??
    void CreateView(const viewLabel_t viewLabel, const RCP<const Matrix>& A, bool transposeA = false, const RCP<const Matrix>& B = Teuchos::null, bool transposeB = false) {
      RCP<const Map> domainMap = Teuchos::null;
      RCP<const Map> rangeMap  = Teuchos::null;

      const size_t        blkSize = 1;
      std::vector<size_t> stridingInfo(1, blkSize);
      LocalOrdinal        stridedBlockId = -1;


      if (A->IsView(viewLabel)) {
        rangeMap  = transposeA ? A->getColMap(viewLabel) : A->getRowMap(viewLabel);
        domainMap = transposeA ? A->getRowMap(viewLabel) : A->getColMap(viewLabel); // will be overwritten if B != Teuchos::null

      } else {
        rangeMap  = transposeA ? A->getDomainMap()       : A->getRangeMap();
        domainMap = transposeA ? A->getRangeMap()        : A->getDomainMap();

        if (viewLabel == "stridedMaps") {
          rangeMap  = Xpetra::StridedMapFactory<LocalOrdinal, GlobalOrdinal, Node>::Build(rangeMap,  stridingInfo, stridedBlockId);
          domainMap = Xpetra::StridedMapFactory<LocalOrdinal, GlobalOrdinal, Node>::Build(domainMap, stridingInfo, stridedBlockId);
        }
      }

      if (B != Teuchos::null ) {
        // B has strided Maps

        if (B->IsView(viewLabel)) {
          domainMap = transposeB ? B->getRowMap(viewLabel) : B->getColMap(viewLabel);

        } else {
          domainMap = transposeB ? B->getRangeMap()        : B->getDomainMap();

          if (viewLabel == "stridedMaps")
            domainMap = Xpetra::StridedMapFactory<LocalOrdinal, GlobalOrdinal, Node>::Build(domainMap, stridingInfo, stridedBlockId);
        }
      }


      if (IsView(viewLabel))
        RemoveView(viewLabel);

      CreateView(viewLabel, rangeMap, domainMap);
    }