Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion model/godleyTab.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace minsky
class GodleyTab: public ItemTab
{
public:
bool itemSelector(ItemPtr i) override {if (auto g=dynamic_cast<GodleyIcon*>(i.get())) {return g->editorMode();}; return false;}
bool itemSelector(ItemPtr i) override {if (dynamic_cast<GodleyIcon*>(i.get())) return true; return false;}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or even simpler: "return i;"

};

}
Expand Down
15 changes: 9 additions & 6 deletions model/itemTab.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
along with Minsky. If not, see <http://www.gnu.org/licenses/>.
*/
#include "itemTab.h"
#include "godleyTableWindow.h"
#include "latexMarkup.h"
#include "group.h"
#include <pango.h>
Expand All @@ -41,7 +42,7 @@ namespace minsky
{
itemVector.emplace_back(*i);
if (auto p=(*i)->plotWidgetCast()) itemCoords.emplace(make_pair(*i,make_pair(p->x(),p->y())));
if (auto g=dynamic_cast<GodleyIcon*>(i->get())) itemCoords.emplace(make_pair(*i,make_pair(g->x(),g->y())));
if (auto g=dynamic_cast<GodleyIcon*>(i->get())) itemCoords.emplace(make_pair(*i,make_pair(g->x(),g->y())));
}
return false;
});
Expand Down Expand Up @@ -149,7 +150,7 @@ namespace minsky
{
float d=sqr((i.second).first+offsx-x)+sqr((i.second).second+offsy-y);
float z=i.first->zoomFactor();
float w=0.5*i.first->iWidth()*z,h=0.5*i.first->iHeight()*z;
float w=0.5*i.first->iWidth()*z,h=0.5*i.first->iHeight()*z;
if (d<minD && fabs((i.second).first+offsx-x)<w && fabs((i.second).second+offsy-y)<h)
{
minD=d;
Expand Down Expand Up @@ -458,19 +459,21 @@ namespace minsky
if (it==itemFocus) {
cairo_translate(cairo,xItem,yItem);
itemCoords.erase(itemFocus);
itemCoords.emplace(make_pair(itemFocus,make_pair(xItem,yItem)));
itemCoords.emplace(make_pair(itemFocus,make_pair(xItem,yItem)));
} else cairo_translate(cairo,itemCoords[it].first,itemCoords[it].second);
p->draw(cairo);
}
else if (auto g=dynamic_cast<GodleyIcon*>(it.get()))
else if (auto g=dynamic_pointer_cast<GodleyIcon>(it))
{
cairo::CairoSave cs(cairo);
if (it==itemFocus) {
cairo_translate(cairo,xItem,yItem);
itemCoords.erase(itemFocus);
itemCoords.emplace(make_pair(itemFocus,make_pair(xItem,yItem)));
} else cairo_translate(cairo,itemCoords[it].first,itemCoords[it].second);
g->draw(cairo);
} else cairo_translate(cairo,itemCoords[it].first,itemCoords[it].second);
auto godley=GodleyTableWindow(g);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaner would be GodleyTableWindow godley(g); The above may invoke an unnecessary copy constructor.

godley.disableButtons();
godley.draw(cairo);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion model/itemTab.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace minsky
void togglePlotDisplay() const;
void displayDelayedTooltip(float x, float y);

~ItemTab() {}
virtual ~ItemTab() {}
};

}
Expand Down