Skip to content

Commit

Permalink
Merge pull request #414 from highperformancecoder/bugfix-1675-remove-…
Browse files Browse the repository at this point in the history
…hide-variable

Bugfix 1675 remove hide variable
  • Loading branch information
highperformancecoder authored Jan 7, 2024
2 parents c2030a9 + 486440e commit 7b5b6bb
Show file tree
Hide file tree
Showing 23 changed files with 5 additions and 679 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ PREFIX=/usr/local
# custom one that picks up its scripts from a relative library
# directory
MODLINK=$(LIBMODS:%=$(ECOLAB_HOME)/lib/%)
MODEL_OBJS=autoLayout.o cairoItems.o canvas.o CSVDialog.o dataOp.o equationDisplay.o godleyIcon.o godleyTable.o godleyTableWindow.o grid.o group.o item.o itemTab.o intOp.o lasso.o lock.o minsky.o operation.o operationRS.o operationRS1.o operationRS2.o phillipsDiagram.o plotWidget.o port.o pubTab.o ravelWrap.o renderNativeWindow.o selection.o sheet.o SVGItem.o switchIcon.o userFunction.o userFunction_units.o variableInstanceList.o variable.o variablePane.o windowInformation.o wire.o
MODEL_OBJS=autoLayout.o cairoItems.o canvas.o CSVDialog.o dataOp.o equationDisplay.o godleyIcon.o godleyTable.o godleyTableWindow.o grid.o group.o item.o intOp.o lasso.o lock.o minsky.o operation.o operationRS.o operationRS1.o operationRS2.o phillipsDiagram.o plotWidget.o port.o pubTab.o ravelWrap.o renderNativeWindow.o selection.o sheet.o SVGItem.o switchIcon.o userFunction.o userFunction_units.o variableInstanceList.o variable.o variablePane.o windowInformation.o wire.o
ENGINE_OBJS=coverage.o clipboard.o derivative.o equationDisplayRender.o equations.o evalGodley.o evalOp.o flowCoef.o \
godleyExport.o latexMarkup.o valueId.o variableValue.o node_latex.o node_matlab.o CSVParser.o \
minskyTensorOps.o mdlReader.o saver.o rungeKutta.o
Expand Down
2 changes: 0 additions & 2 deletions RESTService/typescriptAPI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
#include "intOp.tcd"
#include "item.tcd"
#include "itemT.tcd"
#include "itemTab.h"
#include "itemTab.tcd"
#include "lasso.tcd"
#include "lock.tcd"
#include "noteBase.tcd"
Expand Down
35 changes: 0 additions & 35 deletions gui-js/apps/minsky-electron/src/app/managers/ContextMenuManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ export class ContextMenuManager {
case "html-godley":
this.initContextMenuForGodleyHTMLPopup(event, command,x,y);
break;
case "html-summary":
this.initContextMenuForSummaryTab(command);
break;
case "ravel":
this.initContextMenuForRavelPopup(command,x,y);
break;
Expand Down Expand Up @@ -284,19 +281,6 @@ export class ContextMenuManager {
CommandsManager.pasteAt(this.x, this.y);
},
}),
new MenuItem({
label: 'Hide defining groups of selected variables',
click: async () => {minsky.canvas.pushDefiningVarsToTab();
await CommandsManager.requestRedraw();
},
}),
new MenuItem({
label: 'Show all defining groups on canvas',
click: async () => {
minsky.canvas.showDefiningVarsOnCanvas();
await CommandsManager.requestRedraw();
},
}),

new MenuItem({
label: 'Bookmark here',
Expand Down Expand Up @@ -1040,15 +1024,6 @@ export class ContextMenuManager {
}),
];

if (await v.defined()) {
menuItems.push(
new MenuItem({
label: 'Hide variable definition',
click: () => {v.toggleVarTabDisplay();}
})
);
}

menuItems.push(
new MenuItem({
label: 'Flip',
Expand Down Expand Up @@ -1100,16 +1075,6 @@ export class ContextMenuManager {
this.initContextMenuForGodley(godley, r, c, clickType, () => {});
}

private static async initContextMenuForSummaryTab(valueId: string)
{
var menu=new Menu();
menu.append(new MenuItem({
label: "Show variable on canvas",
click: async ()=> {await minsky.showVariableDefinitionOnCanvas(valueId);},
}));
menu.popup();
}

private static async initContextMenuForGodley(godley: GodleyIcon, r: number, c: number, clickType: string, refreshFunction: () => void)
{
var menu=new Menu();
Expand Down
21 changes: 0 additions & 21 deletions gui-js/libs/shared/src/lib/backend/minsky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export class Item extends CppClass {
async RESTProcess(a1: classdesc__RESTProcess_t,a2: string): Promise<void> {return this.$callMethod('RESTProcess',a1,a2);}
async TCL_obj(a1: classdesc__TCL_obj_t,a2: string): Promise<void> {return this.$callMethod('TCL_obj',a1,a2);}
async adjustBookmark(): Promise<void> {return this.$callMethod('adjustBookmark');}
async attachedToDefiningVar(...args: any[]): Promise<boolean> {return this.$callMethod('attachedToDefiningVar',...args);}
async bookmark(...args: boolean[]): Promise<boolean> {return this.$callMethod('bookmark',...args);}
async bookmarkId(): Promise<string> {return this.$callMethod('bookmarkId');}
async bottom(): Promise<number> {return this.$callMethod('bottom');}
Expand Down Expand Up @@ -119,7 +118,6 @@ export class Item extends CppClass {
async updateIcon(a1: number): Promise<void> {return this.$callMethod('updateIcon',a1);}
async value(): Promise<number> {return this.$callMethod('value');}
async visible(): Promise<boolean> {return this.$callMethod('visible');}
async visibleWithinGroup(): Promise<boolean> {return this.$callMethod('visibleWithinGroup');}
async width(): Promise<number> {return this.$callMethod('width');}
async x(): Promise<number> {return this.$callMethod('x');}
async y(): Promise<number> {return this.$callMethod('y');}
Expand Down Expand Up @@ -204,7 +202,6 @@ export class VariableBase extends Item {
async accessibleVars(): Promise<string[]> {return this.$callMethod('accessibleVars');}
async adjustBookmark(): Promise<void> {return this.$callMethod('adjustBookmark');}
async adjustSliderBounds(): Promise<void> {return this.$callMethod('adjustSliderBounds');}
async attachedToDefiningVar(...args: any[]): Promise<boolean> {return this.$callMethod('attachedToDefiningVar',...args);}
async bookmark(...args: boolean[]): Promise<boolean> {return this.$callMethod('bookmark',...args);}
async bookmarkId(): Promise<string> {return this.$callMethod('bookmarkId');}
async bottom(): Promise<number> {return this.$callMethod('bottom');}
Expand Down Expand Up @@ -308,7 +305,6 @@ export class VariableBase extends Item {
async temp(): Promise<boolean> {return this.$callMethod('temp');}
async throw_error(a1: string): Promise<void> {return this.$callMethod('throw_error',a1);}
async toggleLocal(): Promise<void> {return this.$callMethod('toggleLocal');}
async toggleVarTabDisplay(): Promise<void> {return this.$callMethod('toggleVarTabDisplay');}
async tooltip(...args: string[]): Promise<string> {return this.$callMethod('tooltip',...args);}
async top(): Promise<number> {return this.$callMethod('top');}
async type(): Promise<string> {return this.$callMethod('type');}
Expand All @@ -321,11 +317,9 @@ export class VariableBase extends Item {
async value(...args: any[]): Promise<number> {return this.$callMethod('value',...args);}
async valueId(): Promise<string> {return this.$callMethod('valueId');}
async valueIdInCurrentScope(a1: string): Promise<string> {return this.$callMethod('valueIdInCurrentScope',a1);}
async varTabDisplay(...args: boolean[]): Promise<boolean> {return this.$callMethod('varTabDisplay',...args);}
async variableCast(): Promise<VariableBase> {return this.$callMethod('variableCast');}
async varsPassed(...args: number[]): Promise<number> {return this.$callMethod('varsPassed',...args);}
async visible(): Promise<boolean> {return this.$callMethod('visible');}
async visibleWithinGroup(): Promise<boolean> {return this.$callMethod('visibleWithinGroup');}
async width(): Promise<number> {return this.$callMethod('width');}
async x(): Promise<number> {return this.$callMethod('x');}
async y(): Promise<number> {return this.$callMethod('y');}
Expand Down Expand Up @@ -423,7 +417,6 @@ export class Canvas extends RenderNativeWindow {
backgroundColour: ecolab__cairo__Colour;
item: Item;
itemFocus: Item;
itemVector: Sequence<Item>;
lasso: LassoBox;
model: Group;
selection: Selection;
Expand All @@ -438,7 +431,6 @@ export class Canvas extends RenderNativeWindow {
this.backgroundColour=new ecolab__cairo__Colour(this.$prefix()+'.backgroundColour');
this.item=new Item(this.$prefix()+'.item');
this.itemFocus=new Item(this.$prefix()+'.itemFocus');
this.itemVector=new Sequence<Item>(this.$prefix()+'.itemVector',Item);
this.lasso=new LassoBox(this.$prefix()+'.lasso');
this.model=new Group(this.$prefix()+'.model');
this.selection=new Selection(this.$prefix()+'.selection');
Expand Down Expand Up @@ -494,7 +486,6 @@ export class Canvas extends RenderNativeWindow {
async moveTo(a1: number,a2: number): Promise<void> {return this.$callMethod('moveTo',a1,a2);}
async openGroupInCanvas(a1: Item): Promise<void> {return this.$callMethod('openGroupInCanvas',a1);}
async position(): Promise<number[]> {return this.$callMethod('position');}
async pushDefiningVarsToTab(): Promise<void> {return this.$callMethod('pushDefiningVarsToTab');}
async ravelsSelected(): Promise<number> {return this.$callMethod('ravelsSelected');}
async recentre(): Promise<void> {return this.$callMethod('recentre');}
async redraw(): Promise<boolean> {return this.$callMethod('redraw');}
Expand Down Expand Up @@ -522,8 +513,6 @@ export class Canvas extends RenderNativeWindow {
async selectVar(a1: number,a2: number): Promise<boolean> {return this.$callMethod('selectVar',a1,a2);}
async setDefaultPlotOptions(): Promise<void> {return this.$callMethod('setDefaultPlotOptions');}
async setItemFocus(a1: Item): Promise<void> {return this.$callMethod('setItemFocus',a1);}
async showDefiningVarsOnCanvas(): Promise<void> {return this.$callMethod('showDefiningVarsOnCanvas');}
async showPlotsOnTab(): Promise<void> {return this.$callMethod('showPlotsOnTab');}
async surface(): Promise<ecolab__cairo__Surface> {return this.$callMethod('surface');}
async termX(...args: number[]): Promise<number> {return this.$callMethod('termX',...args);}
async termY(...args: number[]): Promise<number> {return this.$callMethod('termY',...args);}
Expand Down Expand Up @@ -1050,7 +1039,6 @@ export class Group extends Item {
async adjustBookmark(): Promise<void> {return this.$callMethod('adjustBookmark');}
async adjustWiresGroup(a1: Wire): Promise<void> {return this.$callMethod('adjustWiresGroup',a1);}
async arguments(): Promise<string> {return this.$callMethod('arguments');}
async attachedToDefiningVar(...args: any[]): Promise<boolean> {return this.$callMethod('attachedToDefiningVar',...args);}
async autoLayout(): Promise<void> {return this.$callMethod('autoLayout');}
async bookmark(...args: boolean[]): Promise<boolean> {return this.$callMethod('bookmark',...args);}
async bookmarkId(): Promise<string> {return this.$callMethod('bookmarkId');}
Expand Down Expand Up @@ -1182,7 +1170,6 @@ export class Group extends Item {
async updateTimestamp(): Promise<void> {return this.$callMethod('updateTimestamp');}
async value(): Promise<number> {return this.$callMethod('value');}
async visible(): Promise<boolean> {return this.$callMethod('visible');}
async visibleWithinGroup(): Promise<boolean> {return this.$callMethod('visibleWithinGroup');}
async width(): Promise<number> {return this.$callMethod('width');}
async x(): Promise<number> {return this.$callMethod('x');}
async y(): Promise<number> {return this.$callMethod('y');}
Expand Down Expand Up @@ -1248,7 +1235,6 @@ export class IntOp extends Item {
super(prefix.$prefix())
this.intVar=new VariableBase(this.$prefix()+'.intVar');
}
async attachedToDefiningVar(a1: Container<Item>): Promise<boolean> {return this.$callMethod('attachedToDefiningVar',a1);}
async coupled(): Promise<boolean> {return this.$callMethod('coupled');}
async description(...args: string[]): Promise<string> {return this.$callMethod('description',...args);}
async draw(a1: minsky__dummy): Promise<void> {return this.$callMethod('draw',a1);}
Expand Down Expand Up @@ -1459,7 +1445,6 @@ export class Minsky extends CppClass {
async setGroupIconResource(a1: string): Promise<void> {return this.$callMethod('setGroupIconResource',a1);}
async setLockIconResource(a1: string,a2: string): Promise<void> {return this.$callMethod('setLockIconResource',a1,a2);}
async setRavelIconResource(a1: string): Promise<void> {return this.$callMethod('setRavelIconResource',a1);}
async showVariableDefinitionOnCanvas(a1: string): Promise<void> {return this.$callMethod('showVariableDefinitionOnCanvas',a1);}
async simulationDelay(...args: number[]): Promise<number> {return this.$callMethod('simulationDelay',...args);}
async srand(a1: number): Promise<void> {return this.$callMethod('srand',a1);}
async step(): Promise<number[]> {return this.$callMethod('step');}
Expand Down Expand Up @@ -1537,7 +1522,6 @@ export class PhillipsFlow extends Item {
}
async addTerm(a1: number,a2: string): Promise<void> {return this.$callMethod('addTerm',a1,a2);}
async adjustBookmark(): Promise<void> {return this.$callMethod('adjustBookmark');}
async attachedToDefiningVar(...args: Container<Item>[]): Promise<boolean> {return this.$callMethod('attachedToDefiningVar',...args);}
async bookmark(...args: boolean[]): Promise<boolean> {return this.$callMethod('bookmark',...args);}
async coords(...args: any[]): Promise<number[]> {return this.$callMethod('coords',...args);}
async deleteHandle(a1: number,a2: number): Promise<void> {return this.$callMethod('deleteHandle',a1,a2);}
Expand Down Expand Up @@ -1678,7 +1662,6 @@ export class PlotWidget extends Item {
async pack(a1: classdesc__pack_t): Promise<void> {return this.$callMethod('pack',a1);}
async percent(...args: boolean[]): Promise<boolean> {return this.$callMethod('percent',...args);}
async plot(a1: object): Promise<void> {return this.$callMethod('plot',a1);}
async plotTabDisplay(...args: boolean[]): Promise<boolean> {return this.$callMethod('plotTabDisplay',...args);}
async plotType(...args: string[]): Promise<string> {return this.$callMethod('plotType',...args);}
async plotWidgetCast(): Promise<PlotWidget> {return this.$callMethod('plotWidgetCast');}
async position(): Promise<number[]> {return this.$callMethod('position');}
Expand All @@ -1700,7 +1683,6 @@ export class PlotWidget extends Item {
async setMinMax(): Promise<void> {return this.$callMethod('setMinMax');}
async subgrid(...args: boolean[]): Promise<boolean> {return this.$callMethod('subgrid',...args);}
async title(...args: string[]): Promise<string> {return this.$callMethod('title',...args);}
async togglePlotTabDisplay(): Promise<void> {return this.$callMethod('togglePlotTabDisplay');}
async unpack(a1: classdesc__pack_t): Promise<void> {return this.$callMethod('unpack',a1);}
async updateIcon(a1: number): Promise<void> {return this.$callMethod('updateIcon',a1);}
async vectorRender(a1: number,a2: minsky__dummy): Promise<object> {return this.$callMethod('vectorRender',a1,a2);}
Expand Down Expand Up @@ -1954,7 +1936,6 @@ export class Selection extends CppClass {
async adjustBookmark(): Promise<void> {return this.$callMethod('adjustBookmark');}
async adjustWiresGroup(a1: Wire): Promise<void> {return this.$callMethod('adjustWiresGroup',a1);}
async arguments(): Promise<string> {return this.$callMethod('arguments');}
async attachedToDefiningVar(...args: any[]): Promise<boolean> {return this.$callMethod('attachedToDefiningVar',...args);}
async autoLayout(): Promise<void> {return this.$callMethod('autoLayout');}
async bookmark(...args: boolean[]): Promise<boolean> {return this.$callMethod('bookmark',...args);}
async bookmarkId(): Promise<string> {return this.$callMethod('bookmarkId');}
Expand Down Expand Up @@ -2087,7 +2068,6 @@ export class Selection extends CppClass {
async updateIcon(a1: number): Promise<void> {return this.$callMethod('updateIcon',a1);}
async value(): Promise<number> {return this.$callMethod('value');}
async visible(): Promise<boolean> {return this.$callMethod('visible');}
async visibleWithinGroup(): Promise<boolean> {return this.$callMethod('visibleWithinGroup');}
async width(): Promise<number> {return this.$callMethod('width');}
async x(): Promise<number> {return this.$callMethod('x');}
async y(): Promise<number> {return this.$callMethod('y');}
Expand Down Expand Up @@ -2334,7 +2314,6 @@ export class Wire extends CppClass {
super(prefix);
}
async adjustBookmark(): Promise<void> {return this.$callMethod('adjustBookmark');}
async attachedToDefiningVar(...args: any[]): Promise<boolean> {return this.$callMethod('attachedToDefiningVar',...args);}
async bookmark(...args: boolean[]): Promise<boolean> {return this.$callMethod('bookmark',...args);}
async coords(...args: any[]): Promise<number[]> {return this.$callMethod('coords',...args);}
async deleteHandle(a1: number,a2: number): Promise<void> {return this.$callMethod('deleteHandle',a1,a2);}
Expand Down
3 changes: 0 additions & 3 deletions gui-tk/wiring.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -804,9 +804,6 @@ proc contextMenu {x y X Y} {
.wiring.context add command -label "Make Group Plot" -command "$item.makeDisplayPlot"
.wiring.context add command -label "Options" -command "doPlotOptions $item"
.wiring.context add command -label "Pen Styles" -command "penStyles $item"
global plotTabDisplay
set plotTabDisplay [$item.plotTabDisplay]
.wiring.context add checkbutton -label "Display plot on tab" -command "$item.togglePlotTabDisplay" -variable plotTabDisplay
.wiring.context add command -label "Export as CSV" -command exportItemAsCSV
.wiring.context add command -label "Export resolution factor: [$item.resolutionScaleFactor]" -command "setExportResolutionFactor $item"

Expand Down
48 changes: 0 additions & 48 deletions model/canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -511,54 +511,6 @@ namespace minsky
r->leaveLockGroup();
}

void Canvas::pushDefiningVarsToTab()
{
for (auto& i: selection.items)
{
auto v=i->variableCast();
if (v && v->defined() && !v->varTabDisplay) {
itemVector.push_back(i);
v->toggleVarTabDisplay();
}
}
requestRedraw();
}

void Canvas::showDefiningVarsOnCanvas()
{
for (auto& i: itemVector)
{
auto v=(*i).variableCast();
if (v && v->defined() && v->varTabDisplay)
v->toggleVarTabDisplay();
}
// ensure individual hidden defining vars can be made visible once more. for ticket 145.
if (itemVector.empty())
{
model->recursiveDo
(&GroupItems::items, [&](const Items&,Items::const_iterator i)
{
if (auto v=(*i)->variableCast())
if (v->defined() && v->varTabDisplay)
v->toggleVarTabDisplay();
return false;
});
}
itemVector.clear();
requestRedraw();
}

void Canvas::showPlotsOnTab()
{
model->recursiveDo
(&GroupItems::items, [&](const Items&,Items::const_iterator i)
{
if (auto p=(*i)->plotWidgetCast())
if (!p->plotTabDisplay) p->togglePlotTabDisplay();
return false;
});
}

void Canvas::deleteItem()
{
if (item)
Expand Down
8 changes: 0 additions & 8 deletions model/canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,6 @@ namespace minsky
void lockRavelsInSelection();
void unlockRavelsInSelection();

/// hide or reveal the defining variables and attached items within a selection on the canvas
Items itemVector;
void pushDefiningVarsToTab();
void showDefiningVarsOnCanvas();

/// push all plots on the canvas to the plot tab
void showPlotsOnTab();

/// delete item referenced by item
void deleteItem();
/// delete wire referenced by wire
Expand Down
2 changes: 1 addition & 1 deletion model/group.cc
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ namespace minsky
y1=-numeric_limits<float>::max();

for (auto& i: items)
if (!i->ioVar() && i->visibleWithinGroup())
if (!i->ioVar())
{
if (i->left()<x0) x0=i->left();
if (i->right()>x1) x1=i->right();
Expand Down
7 changes: 0 additions & 7 deletions model/intOp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ namespace minsky
return r;
}

bool IntOp::attachedToDefiningVar(std::set<const minsky::Item*>& visited) const
{
visited.insert(this);
if (coupled()) return intVar->attachedToDefiningVar(visited);
return Item::attachedToDefiningVar(visited);
}

void IntOp::draw(cairo_t* cairo) const
{
// if rotation is in 1st or 3rd quadrant, rotate as
Expand Down
2 changes: 0 additions & 2 deletions model/intOp.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ namespace minsky
std::string valueId() const
{return intVar->valueId();}

bool attachedToDefiningVar(std::set<const Item*>&) const override;
using Item::attachedToDefiningVar;
void draw(cairo_t*) const override;
void resize(const LassoBox& b) override;

Expand Down
Loading

0 comments on commit 7b5b6bb

Please sign in to comment.