1
0
Fork 0

- shift drag for global window dragging (like ctrl for global resizing)

- cleanup & some coding style unification
This commit is contained in:
mfranz 2009-01-12 17:30:58 +00:00 committed by Tim Moore
parent 8c1b1f50a5
commit e0463a51ae

View file

@ -208,9 +208,11 @@ int fgPopup::checkHit(int button, int updown, int x, int y)
if (updown == PU_DOWN && !_dragging) {
if (!result)
return 0;
int global_drag = fgGetKeyModifiers() & KEYMOD_SHIFT;
int global_resize = fgGetKeyModifiers() & KEYMOD_CTRL;
int hit = getHitObjects(this, x, y);
if (hit & (PUCLASS_BUTTON|PUCLASS_ONESHOT|PUCLASS_INPUT|PUCLASS_LARGEINPUT))
if (!global_resize && hit & (PUCLASS_BUTTON|PUCLASS_ONESHOT|PUCLASS_INPUT|PUCLASS_LARGEINPUT))
return result;
getPosition(&_dlgX, &_dlgY);
@ -228,7 +230,7 @@ int fgPopup::checkHit(int button, int updown, int x, int y)
};
_resizing = 0;
int global_resize = fgGetKeyModifiers() & KEYMOD_CTRL;
if (!global_drag) {
int hmargin = global_resize ? _dlgW / 3 : 10;
int vmargin = global_resize ? _dlgH / 3 : 10;
@ -248,20 +250,14 @@ int fgPopup::checkHit(int button, int updown, int x, int y)
_cursor = cursor[_resizing];
if (_resizing && _resizable)
fgSetMouseCursor(_cursor);
}
} else if (updown == PU_DRAG && _dragging) {
if (_resizing) {
if (!_resizable)
return result;
GUIInfo *info = (GUIInfo *)getUserData();
if (info && info->node) {
if (_resizable && info && info->node) {
int w = _dlgW;
int h = _dlgH;
int prefw, prefh;
LayoutWidget wid(info->node);
wid.calcPrefSize(&prefw, &prefh);
if (_resizing & LEFT)
w += _startX - x;
if (_resizing & RIGHT)
@ -271,6 +267,9 @@ int fgPopup::checkHit(int button, int updown, int x, int y)
if (_resizing & BOTTOM)
h += _startY - y;
int prefw, prefh;
LayoutWidget wid(info->node);
wid.calcPrefSize(&prefw, &prefh);
if (w < prefw)
w = prefw;
if (h < prefh)
@ -283,12 +282,11 @@ int fgPopup::checkHit(int button, int updown, int x, int y)
if (_resizing & BOTTOM)
y += _dlgH - h;
getFirstChild()->setSize(w, h); // dialog background puFrame
wid.layout(x, y, w, h);
setSize(w, h);
setPosition(x, y);
wid.layout(x, y, w, h);
applySize(static_cast<puObject *>(this));
getFirstChild()->setSize(w, h); // dialog background puFrame
}
} else {
setPosition(x + _dlgX - _startX, y + _dlgY - _startY);
@ -453,8 +451,8 @@ copy_from_pui (puObject * object, SGPropertyNode * node)
// Implementation of FGDialog.
////////////////////////////////////////////////////////////////////////
FGDialog::FGDialog (SGPropertyNode * props)
: _object(0),
FGDialog::FGDialog (SGPropertyNode *props) :
_object(0),
_gui((NewGUI *)globals->get_subsystem("gui")),
_props(props)
{
@ -1033,7 +1031,7 @@ FGDialog::getKeyCode(const char *str)
if (mod & SHIFT)
key = toupper(key);
if (mod & CTRL)
key = toupper(key) - 64;
key = toupper(key) - '@';
if (mod & ALT)
; // Alt not propagated to the gui
} else {
@ -1057,9 +1055,8 @@ FGDialog::getKeyCode(const char *str)
////////////////////////////////////////////////////////////////////////
FGDialog::PropertyObject::PropertyObject(const char *n,
puObject * o,
SGPropertyNode_ptr p)
: name(n),
puObject *o, SGPropertyNode_ptr p) :
name(n),
object(o),
node(p)
{