Beispiel #1
0
void CMemoryCardView::SetSelection(unsigned int nSelection)
{
	m_viewState.m_nSelection = nSelection;

	if((m_viewState.m_nSelection < m_itemCount) && (m_memoryCard != NULL))
	{
		OnSelectionChange(m_memoryCard->GetSaveByIndex(m_viewState.m_nSelection));
	}
	else
	{
		OnSelectionChange(NULL);
	}
}
Beispiel #2
0
Void GUIListModel::UnselectAll()
{
    // Unselect all
    for( UInt i = 0; i < m_arrNodes.Count(); ++i )
		m_arrNodes[i].m_bSelected = false;
    m_iLastSelected = INVALID_OFFSET;

    // Raise callback
    OnSelectionChange();
}
Beispiel #3
0
Void GUIListModel::SelectAll()
{
    // Select all
    for( UInt i = 0; i < m_arrNodes.Count(); ++i )
		m_arrNodes[i].m_bSelected = true;
    m_iLastSelected = m_arrNodes.Count() - 1;

    // Raise callback
    OnSelectionChange();
}
Beispiel #4
0
Void GUIListModel::ToggleSelect( UInt iItem )
{
    Assert( iItem < m_arrNodes.Count() );

    // Toggle selection
	m_arrNodes[iItem].m_bSelected = !( m_arrNodes[iItem].m_bSelected );
    if ( m_arrNodes[iItem].m_bSelected )
        m_iLastSelected = iItem;
    else
        m_iLastSelected = INVALID_OFFSET;

    // Raise callback
    OnSelectionChange();
}
Beispiel #5
0
Void GUIListModel::Select( UInt iItem, Bool bSelect )
{
    Assert( iItem < m_arrNodes.Count() );
    if ( m_arrNodes[iItem].m_bSelected == bSelect )
        return;

    // Select
	m_arrNodes[iItem].m_bSelected = bSelect;
    if ( m_arrNodes[iItem].m_bSelected )
        m_iLastSelected = iItem;
    else
        m_iLastSelected = INVALID_OFFSET;

    // Raise callback
    OnSelectionChange();
}
void MinecraftVersionDialog::Refilter()
{
	visibleIndexes.clear();
	MCVersionList & verList = MCVersionList::Instance();
	for(unsigned i = 0; i < verList.size(); i++ )
	{
		const MCVersion & ver = verList[i];
		VersionType type = ver.GetVersionType();
		if(type == OldSnapshot && showOldSnapshots
			|| type == MCRewind && showMCRewind
			|| type != OldSnapshot && type != MCRewind)
			visibleIndexes.push_back(i);
	}
	
	listCtrl->SetItemCount(visibleIndexes.size());
	// we can use that value because the indexes do correspond up to the current stable version
	listCtrl->SetItemState(verList.GetStableVersionIndex(),wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
	listCtrl->SetColumnWidth(1,typeColumnWidth);
	SetupColumnSizes();
	listCtrl->Refresh();
	listCtrl->Update();
	OnSelectionChange();
}
// Called when the user clicks on the pane to actually place a component on the drawing
void CFlownetController::InsertSymbol(UINT nFlags, CPoint ptDev)
{
	CODSymbolComponent* pComp = (CODSymbolComponent*)m_pInsert;
	BOOL bNodeElementNodeCreation = m_pMainFrm->GetGUIPreferences().m_bNodeElementNodeCreation;
	// This method may create additional components, so the original resource id of the element 
	// chosen by the user may be lost
	DWORD l_dwResID = m_dwResID;  

	// insert the element
	if ( !CFlownetController::m_bImporting )
		GetFlownetModel()->AddElementData(pComp);
	CODController::InsertSymbol(nFlags, ptDev); 
	// get the active controller set name
	CString sElemType = pComp->GetType();
	if (sElemType == _T("SpecialPIDController") )
	{
		CProjectTreeCtrl* pTreeCtrl = m_pMainFrm->GetProjectTree();
		CString sControlSetName = pTreeCtrl->GetActiveControlSetName();
		// store the controller set name in the element
		CElementData* pElemData = (CElementData*)pComp->GetUserData();
		pElemData->SetSetName(sControlSetName);
	}

	// get a hold of the element's center port
	CODPortComponent* pElemPort = pComp->GetCenterPort();
	CPoint ptElemPortLog = pElemPort->GetLocation();		// these points are actually still in logical units
	CPoint ptElemPortDev = ptElemPortLog;
	VpLPtoDP(&ptElemPortDev);										// convert now to device units

	//--- for heat exchangers ----
	CString strType = pComp->GetType();
	int l_idrType = 0;
	int l_idrSecType = 0;

	if (strType == _T("HeatExchanger") || 
		strType == _T("HeatExchangerGasLiquid") ||
		 strType == _T("HeatExchangerRecuperator") ||
		 strType == _T("HeatExchangerShellAndTube") )
		l_idrSecType = IDR_HEATEXCHANGER_SECONDARY;

	// if it is a heat exchanger to be inserted, also insert and connect its secondary element
	if (l_idrSecType != 0 && !CFlownetController::m_bImporting )
	{
		// create and insert secondary element
		InsertElementComponent(l_idrSecType);
		CElementComponent* pSecElem = (CElementComponent*) m_pInsert;
		GetFlownetModel()->AddElementData(pSecElem);
		CODPortComponent* pSecElemPort = pSecElem->GetCenterPort();
		CSize cSize = m_pViewport->GetMinGridPelSpacing(); 
		CPoint ptInsert(ptDev.x , ptDev.y + cSize.cy*20);
		CODController::InsertSymbol(0,ptInsert);
		CPoint ptSecElemPortLog = pSecElemPort->GetLocation();	// these points are actually still in logical units
		CPoint ptSecElemPortDev = ptSecElemPortLog;
		VpLPtoDP(&ptSecElemPortDev);									// convert now to device units
		// create link and connect between primary and secondary elements
		OnCreateNormalLink();
		SetPropertiesCHTLink((CODLinkComponent*)m_pInsert);
		CODController::LinkReady(0, ptElemPortDev);
		m_arPointsLog.Add(ptSecElemPortLog);
		m_pTargetPort = pSecElemPort;
		CODController::EndLink(0, ptSecElemPortDev);

		if (bNodeElementNodeCreation)
		{
			// create the upstream node for secondary element
			InsertNodeComponent(IDR_NODE);
			CNodeComponent* pNode1 = (CNodeComponent*) m_pInsert;
			GetFlownetModel()->AddElementData(pNode1);
			CODPortComponent* pNode1Port = pNode1->GetCenterPort();
			CSize cSize = m_pViewport->GetMinGridPelSpacing(); 
			CPoint ptInsert1(ptSecElemPortDev.x - cSize.cx*20, ptSecElemPortDev.y);
			CODController::InsertSymbol(0,ptInsert1);
			CPoint ptNode1PortLog = pNode1Port->GetLocation();	// these points are actually still in logical units
			CPoint ptNode1PortDev = ptNode1PortLog;
			VpLPtoDP(&ptNode1PortDev);									// convert now to device units
			// create the downstream node
			InsertNodeComponent(IDR_NODE);
			CNodeComponent* pNode2 = (CNodeComponent*) m_pInsert;
			GetFlownetModel()->AddElementData(pNode2);
			CODPortComponent* pNode2Port = pNode2->GetCenterPort();
			CPoint ptInsert2(ptSecElemPortDev.x + cSize.cx*20, ptSecElemPortDev.y);
			CODController::InsertSymbol(0,ptInsert2);
			CPoint ptNode2PortLog = pNode1Port->GetLocation();	// these points are actually still in logical units
			CPoint ptNode2PortDev = ptNode2PortLog;
			VpLPtoDP(&ptNode2PortDev);									// convert now to device units
			// create upstream link and connect to upstream node and element
			OnCreateNormalLink();
			SetPropertiesNormalLink((CODLinkComponent*)m_pInsert);
			CODController::LinkReady(0, ptNode1PortDev);
			m_arPointsLog.Add(ptSecElemPortLog);
			m_pTargetPort = pSecElemPort;
			CODController::EndLink(0, ptSecElemPortDev);
			// create downstream link and connect to element and downstream node  
			OnCreateNormalLink();
			SetPropertiesNormalLink((CODLinkComponent*)m_pInsert);
			CODController::LinkReady(0, ptSecElemPortDev);
			m_arPointsLog.Add(ptNode2PortLog);
			m_pTargetPort = pNode2Port;
			CODController::EndLink(0, ptNode2PortDev);
		}
	}
	

	// for elements with auto node-element-node creation option TRUE
	if ( pComp->GetType() != _T("Node")  && bNodeElementNodeCreation) 
	{
		if ( !CFlownetController::m_bImporting )
		{
			// create the upstream node
			InsertNodeComponent(IDR_NODE);
			CNodeComponent* pNode1 = (CNodeComponent*) m_pInsert;
			GetFlownetModel()->AddElementData(pNode1);
			CODPortComponent* pNode1Port = pNode1->GetCenterPort();
			CSize cSize = m_pViewport->GetMinGridPelSpacing(); 
			CPoint ptInsert1(ptDev.x - cSize.cx*20, ptDev.y);
			CODController::InsertSymbol(0,ptInsert1);
			CPoint ptNode1PortLog = pNode1Port->GetLocation();	// these points are actually still in logical units
			CPoint ptNode1PortDev = ptNode1PortLog;
			VpLPtoDP(&ptNode1PortDev);									// convert now to device units
			// create the downstream node
			InsertNodeComponent(IDR_NODE);
			CNodeComponent* pNode2 = (CNodeComponent*) m_pInsert;
			GetFlownetModel()->AddElementData(pNode2);
			CODPortComponent* pNode2Port = pNode2->GetCenterPort();
			CPoint ptInsert2(ptDev.x + cSize.cx*20, ptDev.y);
			CODController::InsertSymbol(0,ptInsert2);
			CPoint ptNode2PortLog = pNode1Port->GetLocation();	// these points are actually still in logical units
			CPoint ptNode2PortDev = ptNode2PortLog;
			VpLPtoDP(&ptNode2PortDev);									// convert now to device units
			// create upstream link and connect to upstream node and element
			OnCreateNormalLink();
			if (pComp->GetType() == _T("SpecialConductiveHeatTransfer"))
				SetPropertiesCHTLink((CODLinkComponent*)m_pInsert);
			else if (pComp->GetType() == _T("SpecialPIDController"))
				SetPropertiesCNTLink((CODLinkComponent*)m_pInsert);
			else
				SetPropertiesNormalLink((CODLinkComponent*)m_pInsert);
			CODController::LinkReady(0, ptNode1PortDev);
			m_arPointsLog.Add(ptElemPortLog);
			m_pTargetPort = pElemPort;
			CODController::EndLink(0, ptElemPortDev);
			// create downstream link and connect to element and downstream node  
			OnCreateNormalLink();
			if (pComp->GetType() == _T("SpecialConductiveHeatTransfer"))
				SetPropertiesCHTLink((CODLinkComponent*)m_pInsert);
			else if (pComp->GetType() == _T("SpecialPIDController"))
				SetPropertiesCNTLink((CODLinkComponent*)m_pInsert);
			else
				SetPropertiesNormalLink((CODLinkComponent*)m_pInsert);
			CODController::LinkReady(0, ptElemPortDev);
			m_arPointsLog.Add(ptNode2PortLog);
			m_pTargetPort = pNode2Port;
			CODController::EndLink(0, ptNode2PortDev);
			// connect the nodes to the element
			CNode* pCNode1 = pNode1->GetNode();
			CNode* pCNode2 = pNode2->GetNode();
			((CElementComponent*)pComp)->SetNode(pCNode1, nnNode1);
			((CElementComponent*)pComp)->SetNode(pCNode2, nnNode2);
			// set the element as the selected component
			ClearSelection();
			CODComponentSet setUpdate;
			setUpdate.Add(pComp);
			m_setSelection.Add(pComp);
			OnSelectionChange(&setUpdate);
			m_wndWorkspace.ReloadPropSheetsData(this, NULL);
			m_wndWorkspace.ReloadPropSheetsData(this, pComp);
			m_state = OD_SELECT_READY;
		}
	}

	if ( !CFlownetController::m_bImporting )
	{
		m_wndWorkspace.ReloadPropSheetsData(this, pComp);

		// Restore the resource id that may have been changed by programmatically creating components.
		// See the top of this method.
		m_dwResID = l_dwResID;
		// We are going to operate in repeat mode by default so we must create a 
		// new item to be put down immediately
		if (m_dwResID==IDR_NODE)
		{
			InsertNodeComponent(m_dwResID);
		}
		else
		{
			InsertElementComponent(m_dwResID);
		}
	}
}
Beispiel #8
0
MsgResult WebAddressDlg::Message( Msg* Message)
{
	BOOL fEndDialog=FALSE;

	//If the message is a dialog message
	if (IS_OUR_DIALOG_MSG(Message))
	{
		//Then work out what it says
		DialogMsg* pDialogMsg = ((DialogMsg*) Message); 
	
		switch (pDialogMsg->DlgMsg)
		{
			case DIM_CREATE:
				OnCreate();
				break;

			case DIM_COMMIT:
				OnAddButtonClicked();					
				break;
			
			case DIM_CANCEL:	
				fEndDialog = TRUE;
				break;

			case DIM_TEXT_CHANGED:
				//This ensures that, when this code changes some text
				//in an edit field, we don't handle the "text changed" message
				if (WebAddressDlg::DontHandleNextTextMessage)
				{
					WebAddressDlg::DontHandleNextTextMessage=FALSE;
				}
				else
					OnDialogChange();

				break;
				
			case DIM_LFT_BN_CLICKED:
				switch(pDialogMsg->GadgetID)
				{
				case _R(IDC_WEBADDRESS_REMOVE):
					OnRemoveButtonClicked();
					break;

				case _R(IDC_WEBADDRESS_OBJECTSHAPE):
				case _R(IDC_WEBADDRESS_RECTANGLE):
					OnDialogChange();
					break;

				case _R(IDC_WEBADDRESS_CORRECT):
					OnAutoCorrectClicked();
					break;
				}
				break;

			
				//NB: This means someone has altered the combo box. It doesn't mean
				//the selection has changed!
			case DIM_SELECTION_CHANGED: 
				OnDialogChange();
				break;
		}
	}
	else if (MESSAGE_IS_A(Message, SelChangingMsg))
	{
		if ( ((SelChangingMsg*)Message)->State == SelChangingMsg::SELECTIONCHANGED )
			OnSelectionChange();
	}
		
	if (fEndDialog) 
	{	
		Close(); 		   
		End();
	}


	return DialogOp::Message(Message);
}