#include <simgear/structure/exception.hxx>
#include <vector>
+#include <algorithm>
#include <Cockpit/panel.hxx>
#include <Cockpit/panel_io.hxx>
m(1,i) *= 1.0/_ymax;
}
+ _lastViewport[0] = 0;
+ _lastViewport[1] = 0;
+ _lastViewport[2] = 0;
+ _lastViewport[3] = 0;
+
dirtyBound();
// All done. Add us to the list
FGPanelNode::~FGPanelNode()
{
+ vector<FGPanelNode*>::iterator i =
+ find(all_3d_panels.begin(), all_3d_panels.end(), this);
+ if (i != all_3d_panels.end()) {
+ all_3d_panels.erase(i);
+ }
delete _panel;
}
bool FGPanelNode::doMouseAction(int button, int updown, int x, int y)
{
+ if (_lastViewport[2] == 0 || _lastViewport[3] == 0) {
+ // we haven't been drawn yet, presumably
+ return false;
+ }
+
// Covert the screen coordinates to viewport coordinates in the
// range [0:1], then transform to OpenGL "post projection" coords
// in [-1:1]. Remember the difference in Y direction!