Ejemplo n.º 1
0
void CCMSDCommandCellView::InitBasicList()
{
	LOGFONT logFont = { 0 };
	logFont.lfCharSet = DEFAULT_CHARSET;
	logFont.lfHeight = 90;
	lstrcpy( logFont.lfFaceName, _T( "New Times Roman" ) );
	logFont.lfWeight = FW_BOLD;
	logFont.lfItalic = (BYTE)TRUE;

	m_fntCustomFont1.CreatePointFontIndirect( &logFont );

	logFont.lfHeight = 100;
	lstrcpy( logFont.lfFaceName, _T( "Arial" ) );
	logFont.lfUnderline = (BYTE)TRUE;
	m_fntCustomFont2.CreatePointFontIndirect( &logFont );

	m_wndListCtrl.SetImageList( m_ilItemImages );
	m_wndListCtrl.SetFocusSubItem( TRUE );

	//m_wndListCtrl.AddColumn( _T( "" ), 0, ITEM_IMAGE_CHECKBOX, TRUE, ITEM_FORMAT_CHECKBOX );
	m_wndListCtrl.AddColumn( _T( "" ), 0, ITEM_IMAGE_ADDBOX /*ITEM_IMAGE_CHECKBOX*/, TRUE, ITEM_FORMAT_CHECKBOX );

	m_wndListCtrl.AddColumn( _T( "Tag" ), 100,ITEM_IMAGE_NONE,FALSE,ITEM_FORMAT_EDIT| LVCF_WIDTH,ITEM_FLAGS_LEFT );
	m_wndListCtrl.AddColumn( _T( "Value" ), 100,ITEM_IMAGE_NONE,FALSE,ITEM_FORMAT_EDIT| LVCF_WIDTH,ITEM_FLAGS_CENTRE );

	//m_wndListCtrl.AddColumn( _T( "Progress" ), 170, ITEM_IMAGE_ATTACHMENT, FALSE, ITEM_FORMAT_PROGRESS );
	m_wndListCtrl.ShowHeaderSort( FALSE );
	//for(DataDictionary::iterator it  = Dict().begin(); it!= Dict().end(); it++)
	for(MTConnectDataModel::iterator it  = DataModel().begin(); it!= DataModel().end(); it++)
	{
		int nNewItem = m_wndListCtrl.AddItem("");
		FillRow( nNewItem,it);
	}
	AddLastRow();
#if 0
	for(int i=0; i<  Tablesize(); i++)
	{
		int nNewItem = m_wndListCtrl.AddItem("");
		FillRow( nNewItem);
	}
	AddLastRow();
#endif
}
Ejemplo n.º 2
0
void MainWindow::CreateEmpty(void)
{
    //Populate databases with sample objects
    WorldDatabase* world = dynamic_cast<WorldDatabase*>(DataModel("World"));
    ComponentModel* components = dynamic_cast<ComponentModel*>(DataModel("Components"));
    if(world != NULL && components != NULL)
    {           
        world->NewComposite();
        Composite* newObj = world->GetLastCreated();
        //Create component. If engine component, the engine component will also be
        //created. Also, all attributes are set to a generic default value at this point.
        Component* newComponent = components->CreateComponent("Transform");
        world->AddComponentTo(newComponent,newObj);

        newComponent = components->CreateComponent("Model");
        world->AddComponentTo(newComponent,newObj);

        //Initialize will set the component's model equal to the component values
        newObj->Initialize();

        m_HandleSys.HandleNew( newObj );
        m_Ui->ObjInspector->ReceiveNew(m_HandleSys.GetHandle());
    }
}
Ejemplo n.º 3
0
void MainWindow::NewComponent()
{
    ComponentModel* components = dynamic_cast<ComponentModel*>(DataModel("Components"));
    if(components)
    {
        //Prop user if text box pop-up
        QString componentName = QInputDialog::getText(this,tr("New Component"),
                                                      tr("Name: "),QLineEdit::Normal);

        if(componentName.isEmpty())
            return;

        //Use field in text box pop-up to create the new components name
        if(components->NewComponent(componentName))
        {
            //Add the name to the GUI
            m_CompSelectDialog.GetList().addItem(componentName);
        }
    }
}
Ejemplo n.º 4
0
// a macrostep
InterpreterState InterpreterDraft6::step(bool blocking) {
	try {

		monIter_t monIter;
		NodeSet<std::string> enabledTransitions;
		
		// setup document and interpreter
		if (!_isInitialized)
			init();
		
		// if we failed return false
		if (!_isInitialized)
			return INIT_FAILED;
		
		// run initial transitions
		if (!_stable) {
			stabilize();
			// we might only need a single step
			if (!_running)
				goto EXIT_INTERPRETER;
			return INITIALIZED;
		}
		
		if (!_running)
			return FINISHED;
		
		// read an external event and react
		if (blocking) {
			// wait until an event becomes available
			while(_externalQueue.isEmpty()) {
				_condVar.wait(_mutex);
			}
		} else {
			// return immediately if external queue is empty
			if (_externalQueue.isEmpty())
				return NOTHING_TODO;
		}
		_currEvent = _externalQueue.pop();

	#if VERBOSE
		std::cout << "Received externalEvent event " << _currEvent.name << std::endl;
		if (_running && _currEvent.name == "unblock.and.die") {
			std::cout << "Still running " << this << std::endl;
		} else {
			std::cout << "Aborting " << this << std::endl;
		}
	#endif
		_currEvent.eventType = Event::EXTERNAL; // make sure it is set to external

		// when we were blocking on destructor invocation
		if (!_running) {
			goto EXIT_INTERPRETER;
			return INTERRUPTED;
		}
		// --- MONITOR: beforeProcessingEvent ------------------------------
		for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) {
			try {
				(*monIter)->beforeProcessingEvent(shared_from_this(), _currEvent);
			}
			USCXML_MONITOR_CATCH_BLOCK(beforeProcessingEvent)
		}
		
		if (iequals(_currEvent.name, "cancel.invoke." + _sessionId))
			return INTERRUPTED;
		
		try {
			_dataModel.setEvent(_currEvent);
		} catch (Event e) {
			LOG(ERROR) << "Syntax error while setting external event:" << std::endl << e << std::endl << _currEvent;
		}

		for (std::map<std::string, Invoker>::iterator invokeIter = _invokers.begin();
				 invokeIter != _invokers.end();
				 invokeIter++) {
			if (iequals(invokeIter->first, _currEvent.invokeid)) {
				Arabica::XPath::NodeSet<std::string> finalizes = filterChildElements(_nsInfo.xmlNSPrefix + "finalize", invokeIter->second.getElement());
				for (int k = 0; k < finalizes.size(); k++) {
					Element<std::string> finalizeElem = Element<std::string>(finalizes[k]);
					executeContent(finalizeElem);
				}
			}
			if (HAS_ATTR(invokeIter->second.getElement(), "autoforward") && DOMUtils::attributeIsTrue(ATTR(invokeIter->second.getElement(), "autoforward"))) {
				try {
					// do not autoforward to invokers that send to #_parent from the SCXML IO Processor!
					// Yes do so, see test229!
					// if (!boost::equals(_currEvent.getOriginType(), "http://www.w3.org/TR/scxml/#SCXMLEventProcessor"))
					invokeIter->second.send(_currEvent);
				} catch(...) {
					LOG(ERROR) << "Exception caught while sending event to invoker " << invokeIter->first;
				}
			}
		}

		
		// run internal processing until we reach a stable configuration again
		enabledTransitions = selectTransitions(_currEvent.name);
		if (!enabledTransitions.empty()) {
			// test 403b
			enabledTransitions.to_document_order();
			microstep(enabledTransitions);
		}

		stabilize();
		return PROCESSED;
		
	EXIT_INTERPRETER:
		if (!_running) {
			// --- MONITOR: beforeCompletion ------------------------------
			for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) {
				try {
					(*monIter)->beforeCompletion(shared_from_this());
				}
				USCXML_MONITOR_CATCH_BLOCK(beforeCompletion)
			}
			
			exitInterpreter();
			if (_sendQueue) {
				std::map<std::string, std::pair<InterpreterImpl*, SendRequest> >::iterator sendIter = _sendIds.begin();
				while(sendIter != _sendIds.end()) {
					_sendQueue->cancelEvent(sendIter->first);
					sendIter++;
				}
			}
			
			// --- MONITOR: afterCompletion ------------------------------
			for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) {
				try {
					(*monIter)->afterCompletion(shared_from_this());
				}
				USCXML_MONITOR_CATCH_BLOCK(afterCompletion)
			}
			return FINISHED;
		}
		
		assert(hasLegalConfiguration());
		_mutex.unlock();

		// remove datamodel
		if(_dataModel)
			_dataModel = DataModel();

		return PROCESSED;
		
	} catch (boost::bad_weak_ptr e) {
		LOG(ERROR) << "Unclean shutdown " << std::endl << std::endl;
		return INTERRUPTED;
	}
	
	// set datamodel to null from this thread
	if(_dataModel)
		_dataModel = DataModel();

}