1
0
Fork 0

PUI Dialogs fixes

- fix double zoom on mouse wheel in map
- change getName() to return const char* to see if that fixes the crash in linux.
This commit is contained in:
Richard Harrison 2018-08-10 02:00:19 +02:00
parent c4e4f83030
commit 518fb79e01
4 changed files with 13 additions and 11 deletions

View file

@ -102,7 +102,7 @@ validate_format(const char *f)
class fgPopup : public puPopup {
public:
fgPopup(FGPUIDialog *parent_dialog, int x, int y, bool r = true, bool d = true) :
puPopup(x, y), _draggable(d), _resizable(r), _dragging(false), parentDialog(parent_dialog)
puPopup(x, y), _draggable(d), parentDialog(parent_dialog), _resizable(r), _dragging(false)
{}
int checkHit(int b, int up, int x, int y);
int checkKey(int key, int updown);
@ -719,9 +719,9 @@ FGPUIDialog::~FGPUIDialog ()
void FGPUIDialog::bringToFront() {
puMoveToLast(_object);
}
std::string FGPUIDialog::getName()
const char *FGPUIDialog::getName()
{
return _name;
return _name.c_str();
}
void

View file

@ -100,7 +100,7 @@ public:
void setNeedsLayout() {
_needsRelayout = true;
}
virtual std::string getName();
virtual const char * getName();
virtual void bringToFront();
class ActiveWidget

View file

@ -512,13 +512,15 @@ void MapWidget::doHit( int button, int updown, int x, int y )
handlePan(x, y);
return;
}
if (button == 3) { // mouse-wheel up
zoomIn();
} else if (button == 4) { // mouse-wheel down
zoomOut();
if (updown == PU_DOWN)
{
if (button == 3) { // mouse-wheel up
zoomIn();
}
else if (button == 4) { // mouse-wheel down
zoomOut();
}
}
_hitLocation = SGVec2d(x - abox.min[0], y - abox.min[1]);
if ((button == 2) && (updown == PU_DOWN)) {
_clickGeod = unproject(_hitLocation - SGVec2d(_width>>1, _height>>1));

View file

@ -59,7 +59,7 @@ public:
*/
virtual void update () = 0;
virtual std::string getName() { return std::string(); }
virtual const char *getName() { return ""; }
virtual void bringToFront() {}
protected:
/**