本文整理汇总了C++中Input::GetPointClicked方法的典型用法代码示例。如果您正苦于以下问题:C++ Input::GetPointClicked方法的具体用法?C++ Input::GetPointClicked怎么用?C++ Input::GetPointClicked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::GetPointClicked方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadActionParameters
void AddRead::ReadActionParameters()
{
Input *pIn = pManager->GetInput();
Output *pOut = pManager->GetOutput();
pOut->PrintMessage("Read Statement: Click to add the statement");
while (1)
{
pIn->GetPointClicked(Position);
if (Position.y > UI.TlBrWdth && Position.y < UI.height - UI.StBrWdth)
{
//Calculating each corner of the statement block then check if it's inside another statement
Point C1(Position.x - UI.READ_WDTH / 2, Position.y);
Point C2(Position.x + UI.READ_WDTH / 2, Position.y);
Point C3(Position.x - UI.READ_WDTH / 2, Position.y + UI.READ_HI);
Point C4(Position.x + UI.READ_WDTH / 2, Position.y + UI.READ_HI);
if (pManager->GetStatement(C1) == NULL && pManager->GetStatement(C2) == NULL && pManager->GetStatement(C3) == NULL && pManager->GetStatement(C4) == NULL)
{
pOut->ClearStatusBar();
break;
}
else
pOut->PrintMessage("Can't add statement near another one !! Click in another valid position");
}
else
pOut->PrintMessage("Invalid area !! Click in another valid position");
}
}
示例2: ReadActionParameters
void AddSOAssign::ReadActionParameters()
{
Input *pIn = pManager->GetInput();
Output *pOut = pManager->GetOutput();
pManager->UnSelect();
while(1)
{pOut->PrintMessage("Single Operator Assignment Statement: Click to add the statement");
pIn->GetPointClicked(Position);
Point P[4];
P[0].x=Position.x-UI.ASSGN_WDTH/2; P[1].x=Position.x-UI.ASSGN_WDTH/2; P[2].x=Position.x+UI.ASSGN_WDTH/2; P[3].x=Position.x+UI.ASSGN_WDTH/2;
P[0].y=Position.y; P[1].y=Position.y+UI.ASSGN_HI; P[2].y=P[1].y; P[3].y=P[0].y;
if(P[0].x>UI.MnItWdth&&P[0].y>UI.TlBrWdth&&P[1].y<UI.height-UI.StBrWdth)
if(!pManager->onObject(P[0])&&!pManager->onObject(P[1])&&!pManager->onObject(P[2])&&!pManager->onObject(P[3]))
break;
if(pManager->onBars(Position)||pManager->onObject(Position))
{pOut->ClearStatusBar(); return;}
}
pOut->ClearStatusBar();
}
示例3: ReadActionParameters
void Edit_label::ReadActionParameters() {
//Get a Pointer to the Input / Output Interfaces
Output* pOut = pManager->GetOutput();
Input* pIn = pManager->GetInput();
//Print Action Message
pOut->PrintMsg("Click on gate or connection you want to edit its label ");
//Wait for User Input
pIn->GetPointClicked(Cx, Cy);
//component_id=pManager->e7sas(Cx, Cy);
if (Cx % 15 != 0)
Cx = Cx / 15;
if (Cy % 15 != 0)
Cy = Cy / 15;
pOut->PrintMsg("Write the label");
label = pIn->GetSrting(pOut);
if (label.length() > 5)
label = label.substr(0, 5);
pManager->Actual_A.push(this);
while (!pManager->REDO_A.empty())
{
pManager->REDO_A.pop();
}
//Clear Status Bar
pOut->ClearStatusBar();
}
示例4: ReadActionParameters
void AddSmplAssign::ReadActionParameters()
{
Input *pIn = pManager->GetInput();
Output *pOut = pManager->GetOutput();
pOut->PrintMessage("Simple Value Assignment Statement: Click to add the statement");
pIn->GetPointClicked(Position);
pOut->ClearStatusBar();
}
示例5: MoveDest
bool Select::MoveDest(Connection * Comp)
{
//Get a Pointer to the Input / Output Interfaces
Output* pOut = pManager->GetOutput();
Input* pIn = pManager->GetInput();
pOut->FlushKeyQueue();
pOut->ClearStatusBar();
//Print Action Message
pOut->PrintMsg("Changing the Destination Pin press Escape to cansel");
pOut->UpdateBuffer();
int Cx = 0, Cy = 0;
GraphicsInfo GInfo;
GInfo.x1 = Comp->get_GraphicInfo().x1;
GInfo.y1 = Comp->get_GraphicInfo().y1;
GInfo.x2 = Comp->get_GraphicInfo().x2;
GInfo.y2 = Comp->get_GraphicInfo().y2;
bool check = false;
do {
if (pIn->GetKeyPressed() == ESCAPE)
return false;
if (pIn->GetPointClicked(Cx, Cy) == LEFT_CLICK && (pManager->GetArr()[Cy][Cx]) != NULL)
{
if (pManager->GetArr()[Cy][Cx]->GetInputPinCoordinates(make_pair(Cx, Cy)) != NULL) {
GInfo.x2 = (pManager->GetArr()[Cy][Cx])->GetInputPinCoordinates(make_pair(Cx, Cy))->first;
GInfo.y2 = (pManager->GetArr()[Cy][Cx])->GetInputPinCoordinates(make_pair(Cx, Cy))->second;
break;
}
else
{
pOut->ClearStatusBar();
pOut->PrintMsg("You choosed an invalid Component, please choose a Gate or Led ");
pOut->UpdateBuffer();
}
}
} while (true);
if (check) {
Comp->EraseConnections(pManager);
pManager->GetArr()[GInfo.y1][GInfo.x1 - 15]->GetOutputPin()->ConnectTo(Comp);
pManager->GetArr()[GInfo.y2][GInfo.x2]->GetInputPin(make_pair(GInfo.x2, GInfo.y2))->set_connection(Comp);
if (bfs(GInfo.x1, GInfo.y1, GInfo.x2, GInfo.y2, pManager->GetArr(), Comp->get_path()))
Comp->set_GraphicInfo(GInfo);
GInfo.x1 = Comp->get_GraphicInfo().x1;
GInfo.y1 = Comp->get_GraphicInfo().y1;
GInfo.x2 = Comp->get_GraphicInfo().x2;
GInfo.y2 = Comp->get_GraphicInfo().y2;
pManager->GetArr()[GInfo.y1][GInfo.x1 - 15]->GetOutputPin()->ConnectTo(Comp);
pManager->GetArr()[GInfo.y2][GInfo.x2]->GetInputPin(make_pair(GInfo.x2, GInfo.y2))->set_connection(Comp);
return true;
}
return false;
}
示例6: ReadActionParameters
void AddBuffer::ReadActionParameters()
{
//Get a Pointer to the Input / Output Interfaces
Output* pOut = pManager->GetOutput();
Input* pIn = pManager->GetInput();
//Print Action Message
pOut->PrintMsg("Buffer Gate: Click to add the gate");
//Wait for User Input
pIn->GetPointClicked(Cx, Cy);
// calculate the new coordinates "magnet"
if (Cx % 15 > 7) Cx = Cx / 15 + 1;
else Cx = Cx / 15;
//(Cx % 15<= 7)Cx = Cx / 15 - 1;
if (Cy % 15 > 7) Cy = Cy / 15 + 1;
else Cy = Cy / 15;
//if(Cy % 15<= 7)Cy = Cy / 15 - 1;
Cx *= 15; Cy *= 15;
while (!pManager->check_matrix(Cx, Cy))
{
pOut->PrintMsg("This area is not empty choose another place"); ////hebaaaaa wrbna ystorrrr
pIn->GetPointClicked(Cx, Cy);
if (Cx % 15 > 7) Cx = Cx / 15 + 1;
else Cx = Cx / 15;
if (Cy % 15 > 7) Cy = Cy / 15 + 1;
else Cy = Cy / 15;
Cx *= 15; Cy *= 15;
}//call fn elahsas
//Clear Status Bar
pOut->ClearStatusBar();
}
示例7: ReadActionParameters
void Paste::ReadActionParameters()
{
Input *pIn = pManager->GetInput();
Output *pOut = pManager->GetOutput();
list<Statement*> CopiedOrCutStatements = pManager->GetCopiedOrCutStatements();
if (CopiedOrCutStatements.size() == 0)
{
pOut->PrintMessage("Please, Select statement(s) then Copy before Pasting!");
}
else
{
pOut->PrintMessage("Please Click where you want to paste your statements!");
pIn->GetPointClicked(P);
FlagToPaste = true;
}
}
示例8: Execute
void Delete::Execute()
{
Input *pIn = pManager->GetInput();
Output *pOut = pManager->GetOutput();
//Get List of selected statements
list<Statement*> SelectedStatements = pManager->GetSelectedStatements();
list<Connector*> SelectedConnectors = pManager->GetSelectedConnectors();
Point TempP;
//list<Connector*>ConnList = pManager->GetConnList();
//Print Message and Wait for any click
pOut->PrintMessage("Delete: Deleting Selected Statements if any, press any key to continue");
pIn->GetPointClicked(TempP);
for (list<Connector*>::iterator it = SelectedConnectors.begin(); it != SelectedConnectors.end(); it++)
{
pManager->DeleteConnector((*it));
}
list<Connector*>ConnList = pManager->GetConnList();
for (list<Statement*>::iterator it = SelectedStatements.begin(); it != SelectedStatements.end(); it++)
{
//Delete Input Connectors
if ((*it)->GetStatementType() != 0 || ((*it)->GetStatementType() == 0 && ((StartEnd*)(*it))->GetMode() == true))
{
list<Connector*> InputConnectors;
for (list<Connector*>::iterator itConn = ConnList.begin(); itConn != ConnList.end(); itConn++)
{
if ((*itConn)->getDstStat() == (*it))
InputConnectors.push_back((*itConn));
}
for (list<Connector*>::iterator itConn = InputConnectors.begin(); itConn != InputConnectors.end(); itConn++)
{
/*
if ((*itConn)->getSrcStat()->GetpConn == (*itConn))
(*itConn)->getSrcStat()->SetpConn(NULL);
else if (((Conditional*)(*itConn)->getSrcStat())->GetpConnL() == (*itConn))
((Conditional*)(*itConn)->getSrcStat())->SetpConnL(NULL);
*/
if ((*itConn)->GetBranchType() == 2)
((Conditional*)(*itConn)->getSrcStat())->SetpConnL(NULL);
else
(*itConn)->getSrcStat()->SetpConn(NULL);
pManager->DeleteConnector((*itConn));
}
}
//Conditional
if ((*it)->GetStatementType() == 3)
{
//Yes
if (((Conditional*)(*it))->GetpConn() != NULL)
pManager->DeleteConnector(((Conditional*)(*it))->GetpConn());
//No
if (((Conditional*)(*it))->GetpConnL() != NULL)
pManager->DeleteConnector(((Conditional*)(*it))->GetpConnL());
}
else //Not Conditional
{
if ((*it)->GetpConn() != NULL)
pManager->DeleteConnector((*it)->GetpConn());
}
pManager->DeleteStatement((*it));
}
pOut->PrintMessage("");
pOut->ClearDrawArea();
pManager->UpdateInterface();
}
示例9: Execute
void Paste::Execute()
{
Input *pIn = pManager->GetInput();
Output *pOut = pManager->GetOutput();
ReadActionParameters();
if (FlagToPaste == true) //Check that the user had already chosen Copy Or Cut to execute Paste action
{
//Get the List of Copied or Cut Statements
list<Statement*> CopiedOrCutStatements = pManager->GetCopiedOrCutStatements();
//If they are Copied
if (CopiedOrCutStatements.front()->GetCopiedOrCut() == 1) //Copy Action
{
Point LeftCornerUp, LeftCornerDown, RightCornerUp, RightCornerDown;
//Get First Copied statement type to help in calculating dx & dy
int Type = CopiedOrCutStatements.front()->GetStatementType();
//Get 4 corners of the point based on its type;
pManager->GetCorners(P, Type, LeftCornerUp, LeftCornerDown, RightCornerUp, RightCornerDown);
int dx, dy;
//Calculate dx and dy due to the first selectes statement
dx = LeftCornerUp.x - CopiedOrCutStatements.front()->GetLeftCorner().x;
dy = LeftCornerUp.y - CopiedOrCutStatements.front()->GetLeftCorner().y;
//Add New Statements to this list
list<Statement*> NewStatements;
for (list<Statement*>::iterator it = CopiedOrCutStatements.begin(); it != CopiedOrCutStatements.end(); it++)
{
Statement* NewStatement;
//Get Type of each statement
Type = (*it)->GetStatementType();
Point NewStatementPoint = (*it)->GetLeftCorner();
//This should be the new point for the current statement after copying
NewStatementPoint.x += dx;
NewStatementPoint.y += dy;
//Create New statement of the same type
//Types:
// 0 StartEnd
// 1 SMPLAssignment
// 2 VARAssignment
// 3 Conditional
// 4 Read Write
switch (Type)
{
//No case 0 because we will never have 0 type statements (Start End)
//"Start and End" are not copied
case 1:
NewStatement = new SmplAssign(*((SmplAssign*)(*it)));
break;
case 2:
NewStatement = new VariableAssign(*((VariableAssign*)(*it)));
break;
case 3:
NewStatement = new Conditional(*((Conditional*)(*it)));
((Conditional*)(NewStatement))->SetpConnL(NULL);
break;
case 4:
NewStatement = new ReadWrite(*((ReadWrite*)(*it)));
break;
}
Statement::IncrementIDCounter();
NewStatement->SetID(Statement::GetIDCounter());
NewStatement->SetLeftCorner(NewStatementPoint);
NewStatement->SetSelected(false);
NewStatement->SetCopiedOrCut(0);
NewStatement->UpdatePoints();
NewStatement->SetpConn(NULL);
//Dummy variable
bool tt;
//Check validity of point
if (pManager->IsOutOfBounds(NewStatement, tt, tt, tt, tt) || pManager->IsOverlapping(NewStatement))
{
//Print Error Message
pOut->PrintMessage("Unsuitable point for copying. Action terminated! Press any key to continue");
//Remove all new statements
for (list<Statement*>::iterator it2 = NewStatements.begin(); it2 != NewStatements.end(); it2++)
{
delete (*it2);
}
NewStatements.clear();
//Wait for key press
pIn->GetPointClicked(P);
pOut->PrintMessage("");
return;
}
//Statement position is okay, add it
NewStatements.push_back(NewStatement);
}
//All statements don't overlap, add them to Statements list
//.........这里部分代码省略.........
示例10: ReadActionParameters
void AddCONNECTION::ReadActionParameters()
{
//Get a Pointer to the Input / Output Interfaces
Output* pOut = pManager->GetOutput();
Input* pIn = pManager->GetInput();
GridItem* x, *y;
pOut->PrintMsg("Connection building : Click on a Gate/Pin to Connect(1)");
//Print Action Message
if (pManager->getCompNo() < 2)
{
pOut->PrintMsg("No Gates to Connect....Please Add Gate");
check=true;
return;
}
else check = false;
bool success = SrcPin && DstPin;
bool q=true, w=true;
while (!success)
{
q = true, w = true;
while (q)
{
x = pIn->GetPointClicked(x1, y1);
SrcPin = dynamic_cast<OutputPin*>(x);
SrcGate = dynamic_cast<Gate*>(x);
if (!x)
{
pOut->PrintMsg("Cannot Connect to Empty Space... Please Try Again");
continue;
}
if (x1 == -1 || y1 == -1)
{
pOut->PrintMsg("Cannot Connect Out... Please Try Again");
return;
}
if (dynamic_cast<Button*> (x))
{
pOut->PrintMsg("Cannot Connect on a ToolBar Button");
continue;
}
q = false;
}
pOut->PrintMsg("Connection building : Click on a Gate/Pin to Connect(2)");
while (w)
{
y = pIn->GetPointClicked(x2, y2);
DstPin = dynamic_cast<InputPin*>(y);
DstGate = dynamic_cast<Gate*>(y);
if (!x)
{
pOut->PrintMsg("Cannot Connect to Empty Space... Please Try Again");
continue;
}
if (x2 == -1 || y2 == -1)
{
pOut->PrintMsg("Cannot Connect to Empty Space... Please Try Again");
return;
}
if (dynamic_cast<Button*> (x))
{
pOut->PrintMsg("Cannot Connect on a ToolBar Button");
continue;
}
w = false;
}
if (!(SrcPin || SrcPin || DstPin || DstGate))
{
SrcPin = dynamic_cast<OutputPin*>(y);
DstPin = dynamic_cast<InputPin*>(x);
}
if (SrcGate)
{
SrcPin = &(SrcGate->GetOutputPin());
}
if (DstGate)
{
DstPin = DstGate->GetFreeInputPins();
if (!DstPin)
{
pOut->PrintMsg("Connection Error... No Free Input Pins");
continue;
}
}
if (dynamic_cast<OutputPin*>(SrcPin)->getComponent() == dynamic_cast<InputPin*>(DstPin)->getComponent())
{
pOut->PrintMsg("Connection Error : Can't Connect gate to itelf....Go to MultiSim :D :D");
continue;
//.........这里部分代码省略.........
示例11: ReadActionParameters
bool AddConnection::ReadActionParameters()
{
//Get a Pointer to the Input / Output Interfaces
Output* pOut = pManager->GetOutput();
Input* pIn = pManager->GetInput();
pOut->FlushKeyQueue();
pOut->ClearStatusBar();
//Print Action Message
pOut->PrintMsg("Adding Connection : Click to add the first edge ");
pOut->UpdateBuffer();
if ( pManager->GetComponent( UI.u_GfxInfo.x1 , UI.u_GfxInfo.y1 )==NULL)
do {
if (pIn->GetKeyPressed() == ESCAPE)
return false;
if (pIn->GetPointClicked(Cx, Cy) == LEFT_CLICK&& (pManager->GetArr()[Cy][Cx])!=NULL) {
if (((pManager->GetArr()[Cy][Cx])->GetOutputPinCoordinates().first != 0
&& (pManager->GetArr()[Cy][Cx])->GetOutputPinCoordinates().second != 0)) {
GInfo.x1 = (pManager->GetArr()[Cy][Cx])->GetOutputPinCoordinates().first;
GInfo.y1 = (pManager->GetArr()[Cy][Cx])->GetOutputPinCoordinates().second;
break;
}
else {
pOut->ClearStatusBar();
pOut->PrintMsg("Please choose a vaild Gate or Switch ");
pOut->UpdateBuffer();
}
}
} while (true);
else
{
GInfo.x1 = (pManager->GetComponent( UI.u_GfxInfo.x1,UI.u_GfxInfo.y1))->GetOutputPinCoordinates( ).first;
GInfo.y1 = (pManager->GetComponent(UI.u_GfxInfo.x1,UI.u_GfxInfo.y1))->GetOutputPinCoordinates( ).second;
}
pOut->ClearStatusBar();
pOut->PrintMsg("Adding Connection : Click to add the second edge ");
pOut->UpdateBuffer();
do {
if (pIn->GetKeyPressed() == ESCAPE)
return false;
if (pIn->GetPointClicked(Cx, Cy) == LEFT_CLICK && (pManager->GetArr()[Cy][Cx]) != NULL)
{
pOut->Magnetize(Cx, Cy);
if (pManager->GetArr()[Cy][Cx]->GetInputPinCoordinates(make_pair(Cx, Cy)) != NULL) {
GInfo.x2 = (pManager->GetComponent( Cx , Cy ))->GetInputPinCoordinates( make_pair( Cx , Cy ) )->first;
GInfo.y2 = (pManager->GetComponent( Cx , Cy ))->GetInputPinCoordinates( make_pair( Cx , Cy ) )->second;
break;
}
else
{
pOut->ClearStatusBar();
pOut->PrintMsg("You choosed an invalid Component, please choose a Gate or Led !!");
pOut->UpdateBuffer();
}
}
} while (true);
bfs(GInfo.x1, GInfo.y1, GInfo.x2, GInfo.y2, pManager->GetArr(), outx);
if (outx.check)
return true;
else {
pManager->GetOutput()->ClearStatusBar();
pManager->GetOutput()->PrintMsg("There is no valid path");
pManager->GetOutput()->UpdateBuffer();
return false;
}
}