コード例 #1
0
/* Reads parameters required for action to execute */
bool AddConnection::ReadActionParameters() {
	Input* pIn = mAppManager->GetInput();
	Output* pOut = mAppManager->GetOutput();
	
	if (!mIsLoaded) {
		mAppManager->SetSelectionOfComponents(false);
		mAppManager->UpdateInterface();

		pOut->PrintMsg("Connection: select the source pin");
		pIn->WaitMouseClick(mGfxInfo.x1, mGfxInfo.y1);
		pOut->ClearStatusBar();
	}

	if (!DetectSourceComponent()) {
		if (!mIsLoaded) pOut->PrintMsg("Invalid source pin. Operation was cancelled");
		return false;
	}
	
	if (!mIsLoaded) {
		pOut->PrintMsg("Connection: select the destination pin");
		pIn->WaitMouseClick(mGfxInfo.x2, mGfxInfo.y2);
		pOut->ClearStatusBar();
	}

	if (!DetectDestinationComponent()) {
		if (!mIsLoaded) pOut->PrintMsg("Invalid destination pin. Operation was cancelled");
		return false;
	}
	
	mPath = pOut->GetConnectionPath(mGfxInfo);

	if (mPath == NULL) {
		if (!mIsLoaded) pOut->PrintMsg("There is no available path. Operation was cancelled");
		return false;
	}

	return true;
}