Skip to content

Commit

Permalink
Merge pull request #418 from highperformancecoder/bugfix-1683-easier-…
Browse files Browse the repository at this point in the history
…io-variables

Default I/O variables are now input* and output*. Double clicking on …
  • Loading branch information
highperformancecoder authored Jan 12, 2024
2 parents 5e6a85b + 7712d0c commit 6cfde30
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -716,9 +716,12 @@ export class CommandsManager {

break;

case ClassType.Group:
case ClassType.Group:
if (await CommandsManager.selectVar(mouseX,mouseY))
await CommandsManager.editVar();
else
await CommandsManager.editItem(ClassType.Group);
break;
break;

case ClassType.Item:
await CommandsManager.postNote('item');
Expand Down
4 changes: 2 additions & 2 deletions model/group.cc
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,10 @@ namespace minsky
}
}

VariablePtr Group::addIOVar()
VariablePtr Group::addIOVar(const char* prefix)
{
VariablePtr v(VariableType::flow,
uqName(cminsky().variableValues.newName(to_string(size_t(this))+":")));
uqName(cminsky().variableValues.newName(to_string(size_t(this))+":"+prefix)));
addItem(v,true);
createdIOvariables.push_back(v);
v->rotation(rotation());
Expand Down
6 changes: 3 additions & 3 deletions model/group.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ namespace minsky
class Group: public ItemT<Group>, public GroupItems, public CallableFunction
{
bool m_displayContentsChanged=true;
VariablePtr addIOVar();
VariablePtr addIOVar(const char*);
protected:
/// returns the smallest group whose icon completely encloses the
/// rectangle given by the argument. If no candidate group found,
Expand Down Expand Up @@ -290,8 +290,8 @@ namespace minsky
/// check if item is a variable and located in an I/O region, and add it if it is
void checkAddIORegion(const ItemPtr& x);

void addInputVar() {inVariables.push_back(addIOVar());}
void addOutputVar() {outVariables.push_back(addIOVar());}
void addInputVar() {inVariables.push_back(addIOVar("input"));}
void addOutputVar() {outVariables.push_back(addIOVar("output"));}

/// remove item from group, and also all attached wires.
void deleteItem(const Item&);
Expand Down
2 changes: 1 addition & 1 deletion test/testModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ SUITE(Group)
TEST_FIXTURE(TestFixture, accessibleVars)
{
vector<string> globalAccessibleVars{"c"};
vector<string> group0AccessibleVars{"1",":c","a","b"};
vector<string> group0AccessibleVars{":c","a","b","output1"};
group0->makeSubroutine();
CHECK_EQUAL(globalAccessibleVars.size(), model->accessibleVars().size());
CHECK_ARRAY_EQUAL(globalAccessibleVars, model->accessibleVars(), globalAccessibleVars.size());
Expand Down

0 comments on commit 6cfde30

Please sign in to comment.