1
0
Fork 0

20000905 changes from David Megginson to impliment a data file configurable

instrument panel.
This commit is contained in:
curt 2000-09-06 00:07:48 +00:00
parent ed9fcb74b7
commit e891f2ff05
5 changed files with 281 additions and 262 deletions

View file

@ -8,6 +8,7 @@ libCockpit_a_SOURCES = \
hud_lat.cxx hud_lon.cxx \
hud_scal.cxx hud_tbi.cxx \
panel.cxx panel.hxx \
panel_io.cxx panel_io.hxx \
radiostack.cxx radiostack.hxx \
sp_panel.cxx sp_panel.hxx \
steam.cxx steam.hxx

View file

@ -46,19 +46,20 @@
// Implementation of FGTextureManager.
////////////////////////////////////////////////////////////////////////
map<const char *,ssgTexture *> FGTextureManager::_textureMap;
map<string,ssgTexture *> FGTextureManager::_textureMap;
ssgTexture *
FGTextureManager::createTexture (const char * relativePath)
FGTextureManager::createTexture (const string &relativePath)
{
ssgTexture *texture;
texture = _textureMap[relativePath];
ssgTexture * texture = _textureMap[relativePath];
if (texture == 0) {
cerr << "Texture " << relativePath << " does not yet exist" << endl;
FGPath tpath(current_options.get_fg_root());
tpath.append(relativePath);
texture = new ssgTexture((char *)tpath.c_str(), false, false);
_textureMap[relativePath] = texture;
if (_textureMap[relativePath] == 0)
cerr << "Texture *still* doesn't exist" << endl;
cerr << "Created texture " << relativePath
<< " handle=" << texture->getHandle() << endl;
}
@ -229,11 +230,9 @@ FGPanel::doMouseAction (int button, int updown, int x, int y)
// Implementation of FGAdjustAction.
////////////////////////////////////////////////////////////////////////
FGAdjustAction::FGAdjustAction (getter_type getter, setter_type setter,
float increment, float min, float max,
bool wrap=false)
: _getter(getter), _setter(setter), _increment(increment),
_min(min), _max(max), _wrap(wrap)
FGAdjustAction::FGAdjustAction (SGValue * value, float increment,
float min, float max, bool wrap=false)
: _value(value), _increment(increment), _min(min), _max(max), _wrap(wrap)
{
}
@ -244,16 +243,16 @@ FGAdjustAction::~FGAdjustAction ()
void
FGAdjustAction::doAction ()
{
float value = (*_getter)();
float val = _value->getFloatValue();
// cout << "Do action; value=" << value << '\n';
value += _increment;
if (value < _min) {
value = (_wrap ? _max : _min);
} else if (value > _max) {
value = (_wrap ? _min : _max);
val += _increment;
if (val < _min) {
val = (_wrap ? _max : _min);
} else if (val > _max) {
val = (_wrap ? _min : _max);
}
// cout << "New value is " << value << '\n';
(*_setter)(value);
_value->setDoubleValue(val);
}
@ -262,10 +261,8 @@ FGAdjustAction::doAction ()
// Implementation of FGSwapAction.
////////////////////////////////////////////////////////////////////////
FGSwapAction::FGSwapAction (getter_type getter1, setter_type setter1,
getter_type getter2, setter_type setter2)
: _getter1(getter1), _setter1(setter1),
_getter2(getter2), _setter2(setter2)
FGSwapAction::FGSwapAction (SGValue * value1, SGValue * value2)
: _value1(value1), _value2(value2)
{
}
@ -276,9 +273,9 @@ FGSwapAction::~FGSwapAction ()
void
FGSwapAction::doAction ()
{
float value = (*_getter1)();
(*_setter1)((*_getter2)());
(*_setter2)(value);
float val = _value1->getFloatValue();
_value1->setDoubleValue(_value2->getFloatValue());
_value2->setDoubleValue(val);
}
@ -287,8 +284,8 @@ FGSwapAction::doAction ()
// Implementation of FGToggleAction.
////////////////////////////////////////////////////////////////////////
FGToggleAction::FGToggleAction (getter_type getter, setter_type setter)
: _getter(getter), _setter(setter)
FGToggleAction::FGToggleAction (SGValue * value)
: _value(value)
{
}
@ -299,7 +296,7 @@ FGToggleAction::~FGToggleAction ()
void
FGToggleAction::doAction ()
{
(*_setter)(!((*_getter)()));
_value->setBoolValue(!(_value->getBoolValue()));
}
@ -418,7 +415,7 @@ FGLayeredInstrument::~FGLayeredInstrument ()
}
void
FGLayeredInstrument::draw () const
FGLayeredInstrument::draw ()
{
for (int i = 0; i < _layers.size(); i++) {
glPushMatrix();
@ -451,12 +448,12 @@ FGLayeredInstrument::addLayer (CroppedTexture &texture,
void
FGLayeredInstrument::addTransformation (FGInstrumentLayer::transform_type type,
FGInstrumentLayer::transform_func func,
const SGValue * value,
float min, float max,
float factor, float offset)
{
int layer = _layers.size() - 1;
_layers[layer]->addTransformation(type, func, min, max, factor, offset);
_layers[layer]->addTransformation(type, value, min, max, factor, offset);
}
void
@ -495,23 +492,23 @@ FGInstrumentLayer::transform () const
transformation_list::const_iterator last = _transformations.end();
while (it != last) {
transformation *t = *it;
float value = (t->func == 0 ? 0.0 : (*(t->func))());
if (value < t->min) {
value = t->min;
} else if (value > t->max) {
value = t->max;
float val = (t->value == 0 ? 0.0 : t->value->getFloatValue());
if (val < t->min) {
val = t->min;
} else if (val > t->max) {
val = t->max;
}
value = value * t->factor + t->offset;
val = val * t->factor + t->offset;
switch (t->type) {
case XSHIFT:
glTranslatef(value, 0.0, 0.0);
glTranslatef(val, 0.0, 0.0);
break;
case YSHIFT:
glTranslatef(0.0, value, 0.0);
glTranslatef(0.0, val, 0.0);
break;
case ROTATION:
glRotatef(-value, 0.0, 0.0, 1.0);
glRotatef(-val, 0.0, 0.0, 1.0);
break;
}
it++;
@ -520,13 +517,13 @@ FGInstrumentLayer::transform () const
void
FGInstrumentLayer::addTransformation (transform_type type,
transform_func func,
const SGValue * value,
float min, float max,
float factor, float offset)
{
transformation *t = new transformation;
t->type = type;
t->func = func;
t->value = value;
t->min = min;
t->max = max;
t->factor = factor;
@ -540,45 +537,37 @@ FGInstrumentLayer::addTransformation (transform_type type,
// Implementation of FGTexturedLayer.
////////////////////////////////////////////////////////////////////////
// FGTexturedLayer::FGTexturedLayer (ssgTexture * texture, int w, int h,
// float texX1 = 0.0, float texY1 = 0.0,
// float texX2 = 1.0, float texY2 = 1.0)
// : FGInstrumentLayer(w, h),
// _texX1(texX1), _texY1(texY1), _texX2(texX2), _texY2(texY2)
// {
// setTexture(texture);
// }
FGTexturedLayer::FGTexturedLayer (CroppedTexture &texture, int w, int h)
: FGInstrumentLayer(w, h),
_texX1(texture.minX), _texY1(texture.minY),
_texX2(texture.maxX), _texY2(texture.maxY)
: FGInstrumentLayer(w, h)
{
setTexture(texture.texture);
setTexture(texture);
}
FGTexturedLayer::~FGTexturedLayer ()
{
}
void
FGTexturedLayer::draw () const
FGTexturedLayer::draw ()
{
int w2 = _w / 2;
int h2 = _h / 2;
transform();
glBindTexture(GL_TEXTURE_2D, _texture->getHandle());
glBindTexture(GL_TEXTURE_2D, _texture->texture->getHandle());
glBegin(GL_POLYGON);
if ( cur_light_params.sun_angle * RAD_TO_DEG < 95.0 ) {
glColor4fv( cur_light_params.scene_diffuse );
} else {
glColor4f(0.7, 0.2, 0.2, 1.0);
}
glTexCoord2f(_texX1, _texY1); glVertex2f(-w2, -h2);
glTexCoord2f(_texX2, _texY1); glVertex2f(w2, -h2);
glTexCoord2f(_texX2, _texY2); glVertex2f(w2, h2);
glTexCoord2f(_texX1, _texY2); glVertex2f(-w2, h2);
glTexCoord2f(_texture->minX, _texture->minY); glVertex2f(-w2, -h2);
glTexCoord2f(_texture->maxX, _texture->minY); glVertex2f(w2, -h2);
glTexCoord2f(_texture->maxX, _texture->maxY); glVertex2f(w2, h2);
glTexCoord2f(_texture->minX, _texture->maxY); glVertex2f(-w2, h2);
glEnd();
}
@ -612,7 +601,7 @@ FGTextLayer::~FGTextLayer ()
}
void
FGTextLayer::draw () const
FGTextLayer::draw ()
{
glPushMatrix();
glColor4fv(_color);
@ -673,17 +662,17 @@ FGTextLayer::Chunk::Chunk (char * text, char * fmt = "%s")
_value._text = text;
}
FGTextLayer::Chunk::Chunk (text_func func, char * fmt = "%s")
: _type(FGTextLayer::TEXT_FUNC), _fmt(fmt)
FGTextLayer::Chunk::Chunk (ChunkType type, const SGValue * value,
char * fmt = 0, float mult = 1.0)
: _type(type), _fmt(fmt), _mult(mult)
{
_value._tfunc = func;
}
FGTextLayer::Chunk::Chunk (double_func func, char * fmt = "%.2f",
float mult = 1.0)
: _type(FGTextLayer::DOUBLE_FUNC), _fmt(fmt), _mult(mult)
{
_value._dfunc = func;
if (_fmt == 0) {
if (type == TEXT_VALUE)
_fmt = "%s";
else
_fmt = "%.2f";
}
_value._value = value;
}
char *
@ -693,11 +682,11 @@ FGTextLayer::Chunk::getValue () const
case TEXT:
sprintf(_buf, _fmt, _value._text);
return _buf;
case TEXT_FUNC:
sprintf(_buf, _fmt, (*(_value._tfunc))());
case TEXT_VALUE:
sprintf(_buf, _fmt, _value._value->getStringValue().c_str());
break;
case DOUBLE_FUNC:
sprintf(_buf, _fmt, (*(_value._dfunc))() * _mult);
case DOUBLE_VALUE:
sprintf(_buf, _fmt, _value._value->getFloatValue() * _mult);
break;
}
return _buf;
@ -709,10 +698,10 @@ FGTextLayer::Chunk::getValue () const
// Implementation of FGSwitchLayer.
////////////////////////////////////////////////////////////////////////
FGSwitchLayer::FGSwitchLayer (int w, int h, switch_func func,
FGSwitchLayer::FGSwitchLayer (int w, int h, const SGValue * value,
FGInstrumentLayer * layer1,
FGInstrumentLayer * layer2)
: FGInstrumentLayer(w, h), _func(func), _layer1(layer1), _layer2(layer2)
: FGInstrumentLayer(w, h), _value(value), _layer1(layer1), _layer2(layer2)
{
}
@ -723,10 +712,10 @@ FGSwitchLayer::~FGSwitchLayer ()
}
void
FGSwitchLayer::draw () const
FGSwitchLayer::draw ()
{
transform();
if ((*_func)()) {
if (_value->getBoolValue()) {
_layer1->draw();
} else {
_layer2->draw();

View file

@ -37,6 +37,8 @@
#include <GL/glut.h>
#include <plib/ssg.h>
#include <simgear/misc/props.hxx>
#include <vector>
#include <map>
#include <plib/fnt.h>
@ -57,9 +59,9 @@ class FGPanelInstrument;
class FGTextureManager
{
public:
static ssgTexture * createTexture(const char * relativePath);
static ssgTexture * createTexture(const string &relativePath);
private:
static map<const char *,ssgTexture *>_textureMap;
static map<string,ssgTexture *>_textureMap;
};
@ -73,7 +75,7 @@ private:
struct CroppedTexture
{
CroppedTexture () {}
CroppedTexture (const char * path,
CroppedTexture (const string &path,
float _minX = 0.0, float _minY = 0.0,
float _maxX = 1.0, float _maxY = 1.0)
: texture(FGTextureManager::createTexture(path)),
@ -161,17 +163,13 @@ public:
class FGAdjustAction : public FGPanelAction
{
public:
typedef double (*getter_type)();
typedef void (*setter_type)(double);
FGAdjustAction (getter_type getter, setter_type setter, float increment,
FGAdjustAction (SGValue * value, float increment,
float min, float max, bool wrap=false);
virtual ~FGAdjustAction ();
virtual void doAction ();
private:
getter_type _getter;
setter_type _setter;
SGValue * _value;
float _increment;
float _min;
float _max;
@ -190,17 +188,13 @@ private:
class FGSwapAction : public FGPanelAction
{
public:
typedef double (*getter_type)();
typedef void (*setter_type)(double);
FGSwapAction (getter_type getter1, setter_type setter1,
getter_type getter2, setter_type setter2);
FGSwapAction (SGValue * value1, SGValue * value2);
virtual ~FGSwapAction ();
virtual void doAction ();
private:
getter_type _getter1, _getter2;
setter_type _setter1, _setter2;
SGValue * _value1;
SGValue * _value2;
};
@ -214,16 +208,12 @@ private:
class FGToggleAction : public FGPanelAction
{
public:
typedef bool (*getter_type)();
typedef void (*setter_type)(bool);
FGToggleAction (getter_type getter, setter_type setter);
FGToggleAction (SGValue * value);
virtual ~FGToggleAction ();
virtual void doAction ();
private:
getter_type _getter;
setter_type _setter;
SGValue * _value;
};
@ -245,7 +235,7 @@ public:
FGPanelInstrument (int x, int y, int w, int h);
virtual ~FGPanelInstrument ();
virtual void draw () const = 0;
virtual void draw () = 0;
virtual void setPosition(int x, int y);
virtual void setSize(int w, int h);
@ -304,12 +294,10 @@ public:
ROTATION
} transform_type;
typedef double (*transform_func)();
FGInstrumentLayer (int w = -1, int h = -1);
virtual ~FGInstrumentLayer ();
virtual void draw () const = 0;
virtual void draw () = 0;
virtual void transform () const;
virtual int getWidth () const { return _w; }
@ -317,7 +305,7 @@ public:
virtual void setWidth (int w) { _w = w; }
virtual void setHeight (int h) { _h = h; }
virtual void addTransformation (transform_type type, transform_func func,
virtual void addTransformation (transform_type type, const SGValue * value,
float min, float max,
float factor = 1.0, float offset = 0.0);
@ -326,7 +314,7 @@ protected:
typedef struct {
transform_type type;
transform_func func;
const SGValue * value;
float min;
float max;
float factor;
@ -362,14 +350,14 @@ public:
FGLayeredInstrument (int x, int y, int w, int h);
virtual ~FGLayeredInstrument ();
virtual void draw () const;
virtual void draw ();
// Transfer pointer ownership!!
virtual int addLayer (FGInstrumentLayer *layer);
virtual int addLayer (CroppedTexture &texture,
int w = -1, int h = -1);
virtual void addTransformation (FGInstrumentLayer::transform_type type,
FGInstrumentLayer::transform_func func,
const SGValue * value,
float min, float max,
float factor = 1.0, float offset = 0.0);
virtual void addTransformation (FGInstrumentLayer::transform_type type,
@ -392,32 +380,17 @@ protected:
class FGTexturedLayer : public FGInstrumentLayer
{
public:
// FGTexturedLayer (ssgTexture * texture, int w, int h,
// float texX1 = 0.0, float texY1 = 0.0,
// float texX2 = 1.0, float texY2 = 1.0);
FGTexturedLayer (int w = -1, int h = -1) : FGInstrumentLayer(w, h) {}
FGTexturedLayer (CroppedTexture &texture, int w = -1, int h = -1);
virtual ~FGTexturedLayer ();
virtual void draw () const;
virtual void setTexture (ssgTexture * texture) { _texture = texture; }
virtual ssgTexture * getTexture () { return _texture; }
virtual void setTextureCoords (float x1, float y1, float x2, float y2) {
_texX1 = x1; _texY1 = y1; _texX2 = x2; _texY2 = y2;
}
protected:
virtual void setTextureCoords (float x1, float y1,
float x2, float y2) const {
_texX1 = x1; _texY1 = y1; _texX2 = x2; _texY2 = y2;
}
virtual void draw ();
virtual void setTexture (CroppedTexture &texture) { _texture = &texture; }
virtual CroppedTexture &getTexture () { return *_texture; }
private:
ssgTexture * _texture;
mutable float _texX1, _texY1, _texX2, _texY2;
mutable CroppedTexture * _texture;
};
@ -433,27 +406,24 @@ private:
class FGTextLayer : public FGInstrumentLayer
{
public:
typedef char * (*text_func)();
typedef double (*double_func)();
typedef enum ChunkType {
TEXT,
TEXT_FUNC,
DOUBLE_FUNC
TEXT_VALUE,
DOUBLE_VALUE
};
class Chunk {
public:
Chunk (char * text, char * fmt = "%s");
Chunk (text_func func, char * fmt = "%s");
Chunk (double_func func, char * fmt = "%.2f", float mult = 1.0);
Chunk (ChunkType type, const SGValue * value,
char * fmt = 0, float mult = 1.0);
char * getValue () const;
private:
ChunkType _type;
union {
char * _text;
text_func _tfunc;
double_func _dfunc;
const SGValue * _value;
} _value;
char * _fmt;
float _mult;
@ -464,7 +434,7 @@ public:
Chunk * chunk3 = 0);
virtual ~FGTextLayer ();
virtual void draw () const;
virtual void draw ();
// Transfer pointer!!
virtual void addChunk (Chunk * chunk);
@ -489,18 +459,16 @@ private:
class FGSwitchLayer : public FGInstrumentLayer
{
public:
typedef bool (*switch_func)();
// Transfer pointers!!
FGSwitchLayer (int w, int h, switch_func func,
FGSwitchLayer (int w, int h, const SGValue * value,
FGInstrumentLayer * layer1,
FGInstrumentLayer * layer2);
virtual ~FGSwitchLayer ();
virtual void draw () const;
virtual void draw ();
private:
switch_func _func;
const SGValue * _value;
FGInstrumentLayer * _layer1, * _layer2;
};

View file

@ -50,6 +50,7 @@ FG_USING_STD(map);
#define SMALL_W 112
#define createTexture(a) FGTextureManager::createTexture(a)
#define V(n) (current_properties.getValue(n, true))
@ -60,13 +61,15 @@ FG_USING_STD(map);
// as soon as convenient.
////////////////////////////////////////////////////////////////////////
static char * panelGetTime ()
static const string &panelGetTime ()
{
static char buf[1024]; // FIXME: not thread-safe
static string out; // FIXME: not thread-safe
char buf[16];
struct tm * t = globals->get_time_params()->getGmt();
sprintf(buf, " %.2d:%.2d:%.2d",
t->tm_hour, t->tm_min, t->tm_sec);
return buf;
out = buf;
return out;
}
static bool panelGetNAV1TO ()
@ -269,22 +272,31 @@ class MyTexturedLayer : public FGTexturedLayer
{
public:
MyTexturedLayer (const char * name, int w = -1, int h = -1)
: FGTexturedLayer(w, h), _name(name) {}
: FGTexturedLayer(w, h), _name(name), _textureLoaded(false) {}
virtual void draw () const;
virtual void draw ();
virtual CroppedTexture &getTexture ();
private:
const char * _name;
mutable bool _textureLoaded;
};
void
MyTexturedLayer::draw () const {
CroppedTexture &
MyTexturedLayer::getTexture ()
{
MyTexturedLayer * me = (MyTexturedLayer *)this;
if (me->getTexture() == 0) {
CroppedTexture &t = tex[_name];
me->setTexture(t.texture);
me->setTextureCoords(t.minX, t.minY, t.maxX, t.maxY);
if (!_textureLoaded) {
_textureLoaded = true;
me->setTexture(tex[_name]);
}
return FGTexturedLayer::getTexture();
}
void
MyTexturedLayer::draw ()
{
getTexture();
FGTexturedLayer::draw();
}
@ -316,7 +328,7 @@ public:
MagRibbon (int w, int h);
virtual ~MagRibbon () {}
virtual void draw () const;
virtual void draw ();
};
MagRibbon::MagRibbon (int w, int h)
@ -325,7 +337,7 @@ MagRibbon::MagRibbon (int w, int h)
}
void
MagRibbon::draw () const
MagRibbon::draw ()
{
double heading = FGSteam::get_MH_deg();
double xoffset, yoffset;
@ -357,7 +369,12 @@ MagRibbon::draw () const
// Adjust to put the number in the centre
xoffset -= 0.25;
setTextureCoords(xoffset, yoffset, xoffset + 0.5, yoffset + 0.25);
CroppedTexture &t = getTexture();
t.minX = xoffset;
t.minY = yoffset;
t.maxX = xoffset + 0.5;
t.maxY = yoffset + 0.5;
// setTextureCoords(xoffset, yoffset, xoffset + 0.5, yoffset + 0.25);
MyTexturedLayer::draw();
}
@ -382,7 +399,7 @@ struct TransData
YShift
};
Type type;
FGInstrumentLayer::transform_func func;
const char * propName;
float min, max, factor, offset;
};
@ -412,7 +429,7 @@ InstrumentData instruments[] =
{new MyTexturedLayer("airspeedBG", -1, -1)},
{new MyTexturedLayer("longNeedle", int(SIX_W*(5.0/64.0)),
int(SIX_W*(7.0/16.0))), {
{TransData::Rotation, FGSteam::get_ASI_kias,
{TransData::Rotation, "/steam/airspeed",
30.0, 220.0, 36.0/20.0, -54.0},
{TransData::YShift, 0,
0.0, 0.0, 0.0, SIX_W*(12.0/64.0)}
@ -421,16 +438,16 @@ InstrumentData instruments[] =
{"horizon", SIX_X + SIX_SPACING, SIX_Y, SIX_W, SIX_W, {}, {
{new MyTexturedLayer("horizonBG", -1, -1), {
{TransData::Rotation, FGBFI::getRoll, -360.0, 360.0, -1.0, 0.0}
{TransData::Rotation, "/orientation/roll", -360.0, 360.0, -1.0, 0.0}
}},
{new MyTexturedLayer("horizonFloat",
int(SIX_W * (13.0/16.0)), int(SIX_W * (33.0/64.0))), {
{TransData::Rotation, FGBFI::getRoll, -360.0, 360.0, -1.0, 0.0},
{TransData::YShift, FGBFI::getPitch,
{TransData::Rotation, "/orientation/roll", -360.0, 360.0, -1.0, 0.0},
{TransData::YShift, "/orientation/pitch",
-20.0, 20.0, -(1.5/160.0)*SIX_W, 0.0}
}},
{new MyTexturedLayer("horizonRim", -1, -1), {
{TransData::Rotation, FGBFI::getRoll, -360.0, 360.0, -1.0, 0.0}
{TransData::Rotation, "/orientation/roll", -360.0, 360.0, -1.0, 0.0}
}},
{new MyTexturedLayer("horizonFront", -1, -1)}
}},
@ -439,18 +456,18 @@ InstrumentData instruments[] =
{new MyTexturedLayer("altimeterBG", -1, -1)},
{new MyTexturedLayer("longNeedle",
int(SIX_W*(5.0/64.0)), int(SIX_W*(7.0/16.0))), {
{TransData::Rotation, FGSteam::get_ALT_ft,
{TransData::Rotation, "/steam/altitude",
0.0, 100000.0, 360.0/1000.0, 0.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, SIX_W*(12.0/64.0)}
}},
{new MyTexturedLayer("shortNeedle",
int(SIX_W*(6.0/64.0)), int(SIX_W*(18.0/64.0))), {
{TransData::Rotation, FGSteam::get_ALT_ft,
{TransData::Rotation, "/steam/altitude",
0.0, 100000.0, 360.0/10000.0, 0.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, SIX_W/8.0}
}},
{new MyTexturedLayer("bug", int(SIX_W*(4.0/64.0)), int(SIX_W*(4.0/64.0))), {
{TransData::Rotation, FGSteam::get_ALT_ft,
{TransData::Rotation, "/steam/altitude",
0.0, 100000.0, 360.0/100000.0, 0.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, SIX_W/2.0-4}
}},
@ -459,12 +476,12 @@ InstrumentData instruments[] =
{"turn", SIX_X, SIX_Y-SIX_SPACING, SIX_W, SIX_W, {}, {
{new MyTexturedLayer("turnBG", -1, -1)},
{new MyTexturedLayer("turnPlane", int(SIX_W * 0.75), int(SIX_W * 0.25)), {
{TransData::Rotation, FGSteam::get_TC_std, -2.5, 2.5, 20.0, 0.0},
{TransData::Rotation, "/steam/turn-rate", -2.5, 2.5, 20.0, 0.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, int(SIX_W * 0.0625)}
}},
{new MyTexturedLayer("turnBall",
int(SIX_W * (4.0/64.0)), int(SIX_W * (4.0/64.0))), {
{TransData::Rotation, FGSteam::get_TC_rad,
{TransData::Rotation, "/steam/slip-skid",
-0.1, 0.1, 400.0, 0.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, -(SIX_W/4)+4}
}}
@ -475,7 +492,7 @@ InstrumentData instruments[] =
{new MyTexturedLayer("verticalBG", -1, -1)},
{new MyTexturedLayer("longNeedle",
int(SIX_W*(5.0/64.0)), int(SIX_W*(7.0/16.0))), {
{TransData::Rotation, FGSteam::get_VSI_fps,
{TransData::Rotation, "/steam/vertical-speed",
-2000.0, 2000.0, 42.0/500.0, 270.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, SIX_W*12.0/64.0}
}}
@ -484,25 +501,27 @@ InstrumentData instruments[] =
{"controls", SIX_X, SIX_Y-(SIX_SPACING*2), SMALL_W, SMALL_W, {}, {
{new MyTexturedLayer("controlsBG", -1, -1)},
{new MyTexturedLayer("bug", int(SIX_W*4.0/64.0), int(SIX_W*4.0/64.0)), {
{TransData::XShift, FGBFI::getAileron, -1.0, 1.0, SMALL_W*0.75/2.0, 0.0},
{TransData::XShift, "/controls/aileron",
-1.0, 1.0, SMALL_W*0.75/2.0, 0.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, (SIX_W/2.0)-12.0}
}},
{new MyTexturedLayer("bug", int(SIX_W*4.0/64.0), int(SIX_W*4.0/64.0)), {
{TransData::Rotation, 0, 0.0, 0.0, 0.0, 180.0},
{TransData::XShift, FGBFI::getRudder, -1.0, 1.0, -SMALL_W*0.75/2.0, 0.0},
{TransData::XShift, "/controls/rudder",
-1.0, 1.0, -SMALL_W*0.75/2.0, 0.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, SIX_W/2.0-12.0}
}},
{new MyTexturedLayer("bug", int(SIX_W*4.0/64.0), int(SIX_W*4.0/64.0)), {
{TransData::Rotation, 0, 0.0, 0.0, 0.0, 270.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, -SMALL_W*3.0/8.0},
{TransData::XShift, FGBFI::getElevatorTrim,
{TransData::XShift, "/controls/elevator-trim",
-1.0, 1.0, SMALL_W*0.75/2.0, 0.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, (SIX_W/2.0)-12.0}
}},
{new MyTexturedLayer("bug", int(SIX_W*4.0/64.0), int(SIX_W*4.0/64.0)), {
{TransData::Rotation, 0, 0.0, 0.0, 0.0, 90.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, -SMALL_W*(3.0/8.0)},
{TransData::XShift, FGBFI::getElevator,
{TransData::XShift, "/controls/elevator",
-1.0, 1.0, -SMALL_W*0.75/2.0, 0.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, (SIX_W/2.0)-12.0}
}}
@ -513,7 +532,7 @@ InstrumentData instruments[] =
{new MyTexturedLayer("longNeedle",
int(SIX_W*(5.0/64.0)), int(SIX_W*(7.0/16.0))), {
{TransData::XShift, 0, 0.0, 0.0, 0.0, -(SMALL_W/4) + (SMALL_W/16)},
{TransData::Rotation, FGBFI::getFlaps, 0.0, 1.0, 120.0, 30.0},
{TransData::Rotation, "/controls/flaps", 0.0, 1.0, 120.0, 30.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, SIX_W*12.0/64.0}
}}
}},
@ -522,44 +541,45 @@ InstrumentData instruments[] =
{new MyTexturedLayer("rpmBG", -1, -1)},
{new MyTexturedLayer("longNeedle",
int(SIX_W*(5.0/64.0)), int(SIX_W*(7.0/16.0))), {
{TransData::Rotation, FGBFI::getThrottle, 0.0, 100.0, 300.0, -150.0},
{TransData::Rotation, "/controls/throttle", 0.0, 100.0, 300.0, -150.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, SIX_W*12.0/64.0}
}}
}},
{"gyro", SIX_X+SIX_SPACING, SIX_Y-SIX_SPACING, SIX_W, SIX_W, {
{new FGAdjustAction(FGBFI::getAPHeadingMag, FGBFI::setAPHeadingMag,
{new FGAdjustAction(V("/autopilot/settings/heading-magnetic"),
-1.0, -360.0, 360.0, true),
0, SIX_W/2-SIX_W/5, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGBFI::getAPHeadingMag, FGBFI::setAPHeadingMag,
{new FGAdjustAction(V("/autopilot/settings/heading-magnetic"),
1.0, -360.0, 360.0, true),
0, SIX_W/2 - SIX_W/10, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGBFI::getAPHeadingMag, FGBFI::setAPHeadingMag,
{new FGAdjustAction(V("/autopilot/settings/heading-magnetic"),
-5.0, -360.0, 360.0, true),
1, SIX_W/2 - SIX_W/5, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGBFI::getAPHeadingMag, FGBFI::setAPHeadingMag,
{new FGAdjustAction(V("/autopilot/settings/heading-magnetic"),
5.0, -360.0, 360.0, true),
1, SIX_W/2 - SIX_W/10, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGSteam::get_DG_err, FGSteam::set_DG_err,
{new FGAdjustAction(V("/steam/gyro-compass-error"),
-1.0, -360.0, 360.0, true),
0, -SIX_W/2, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGSteam::get_DG_err, FGSteam::set_DG_err,
{new FGAdjustAction(V("/steam/gyro-compass-error"),
1.0, -360.0, 360.0, true),
0, -SIX_W/2+SIX_W/10, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGSteam::get_DG_err, FGSteam::set_DG_err,
{new FGAdjustAction(V("/steam/gyro-compass-error"),
-5.0, -360.0, 360.0, true),
1, -SIX_W/2, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGSteam::get_DG_err, FGSteam::set_DG_err,
{new FGAdjustAction(V("/steam/gyro-compass-error"),
5.0, -360.0, 360.0, true),
1, -SIX_W/2+SIX_W/10, -SIX_W/2, SIX_W/10, SIX_W/5}
}, {
{new MyTexturedLayer("compassBG", -1, -1), {
{TransData::Rotation, FGSteam::get_DG_deg, -720.0, 720.0, -1.0, 0.0}
{TransData::Rotation, "/steam/gyro-compass", -720.0, 720.0, -1.0, 0.0}
}},
{new MyTexturedLayer("bug",
int(SIX_W*(4.0/64.0)), int(SIX_W*(4.0/64.0))), {
{TransData::Rotation, FGBFI::getAPHeading, -720.0, 720.0, 1.0, 180.0},
{TransData::Rotation, FGSteam::get_DG_deg, -720.0, 720.0, -1.0, 0.0},
{TransData::Rotation, "/autopilot/settings/heading",
-720.0, 720.0, 1.0, 180.0},
{TransData::Rotation, "/steam/gyro-compass", -720.0, 720.0, -1.0, 0.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, -(SIX_W/2.0)+4}
}},
{new MyTexturedLayer("compassCenter", int(SIX_W*0.625), int(SIX_W*0.625))},
@ -567,7 +587,8 @@ InstrumentData instruments[] =
int(SIX_W*(21.0/112.0)), int(SIX_W*(21.0/112.0))), {
{TransData::XShift, 0, 0.0, 0.0, 0.0, SIX_W/2-10},
{TransData::YShift, 0, 0.0, 0.0, 0.0, -SIX_W/2+10},
{TransData::Rotation, FGBFI::getAPHeading, -360.0, 360.0, 1.0, 0.0}
{TransData::Rotation, "/autopilot/settings/heading",
-360.0, 360.0, 1.0, 0.0}
}},
{new MyTexturedLayer("knob",
int(SIX_W*(22.0/112.0)), int(SIX_W*(22.0/112.0))), {
@ -580,28 +601,29 @@ InstrumentData instruments[] =
{"chronometer", SIX_X-SIX_SPACING-8, SIX_Y, SMALL_W, SMALL_W, {}, {
{new MyTexturedLayer("clockBG")},
{new FGTextLayer(SMALL_W, SMALL_W,
new FGTextLayer::Chunk(panelGetTime)), {
new FGTextLayer::Chunk(FGTextLayer::TEXT_VALUE,
V("/panel/time"))), {
{TransData::XShift, 0, 0.0, 0.0, 0.0, SMALL_W*-0.38},
{TransData::YShift, 0, 0.0, 0.0, 0.0, SMALL_W*-0.06}
}}
}},
{"nav1", SIX_X+(SIX_SPACING*3)+20, SIX_Y, SIX_W, SIX_W, {
{new FGAdjustAction(FGBFI::getNAV1SelRadial, FGBFI::setNAV1SelRadial,
{new FGAdjustAction(V("/radios/nav1/radials/selected"),
1.0, 0.0, 360.0, true),
0, -SIX_W/2, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGBFI::getNAV1SelRadial, FGBFI::setNAV1SelRadial,
{new FGAdjustAction(V("/radios/nav1/radials/selected"),
-1.0, 0.0, 360.0, true),
0, -SIX_W/2 + SIX_W/10, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGBFI::getNAV1SelRadial, FGBFI::setNAV1SelRadial,
{new FGAdjustAction(V("/radios/nav1/radials/selected"),
5.0, 0.0, 360.0, true),
1, -SIX_W/2, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGBFI::getNAV1SelRadial, FGBFI::setNAV1SelRadial,
{new FGAdjustAction(V("/radios/nav1/radials/selected"),
-5.0, 0.0, 360.0, true),
1, -SIX_W/2 + SIX_W/10, -SIX_W/2, SIX_W/10, SIX_W/5}
}, {
{new MyTexturedLayer("compassBG"), {
{TransData::Rotation, FGBFI::getNAV1SelRadial,
{TransData::Rotation, "/radios/nav1/radials/selected",
-360.0, 360.0, -1.0, 0.0}
}},
{new MyTexturedLayer("navFG", SIX_W/2, int(SIX_W*(5.0/8.0)))},
@ -609,11 +631,13 @@ InstrumentData instruments[] =
int(SIX_W*(21.0/112.0))), {
{TransData::XShift, 0, 0.0, 0.0, 0.0, -SIX_W/2+10},
{TransData::YShift, 0, 0.0, 0.0, 0.0, -SIX_W/2+10},
{TransData::Rotation, FGBFI::getNAV1SelRadial, -360.0, 360.0, 1.0, 0.0}
{TransData::Rotation, "/radios/nav1/radials/selected",
-360.0, 360.0, 1.0, 0.0}
}},
{new FGSwitchLayer(SIX_W/8, SIX_W/8, panelGetNAV1TO,
{new FGSwitchLayer(SIX_W/8, SIX_W/8, V("/panel/vor1/to-flag"),
new MyTexturedLayer("toFlag", SIX_W/8, SIX_W/8),
new FGSwitchLayer(SIX_W/8, SIX_W/8, panelGetNAV1FROM,
new FGSwitchLayer(SIX_W/8, SIX_W/8,
V("/panel/vor1/from-flag"),
new MyTexturedLayer("fromFlag",
SIX_W/8,
SIX_W/8),
@ -623,31 +647,31 @@ InstrumentData instruments[] =
{TransData::YShift, 0, 0.0, 0.0, 0.0, -int(SIX_W*0.1875)}
}},
{new MyTexturedLayer("navNeedle", SIX_W/32, SIX_W/2), {
{TransData::XShift, FGSteam::get_HackVOR1_deg,
{TransData::XShift, "/steam/vor1",
-10.0, 10.0, SIX_W/40.0, 0.0}
}},
{new MyTexturedLayer("navNeedle", SIX_W/32, SIX_W/2), {
{TransData::YShift, FGSteam::get_HackGS_deg, -1.0, 1.0, SIX_W/5.0, 0.0},
{TransData::YShift, "/steam/glidescope1", -1.0, 1.0, SIX_W/5.0, 0.0},
{TransData::Rotation, 0, 0.0, 0.0, 0.0, 90}
}}
}},
{"nav2", SIX_X+(SIX_SPACING*3)+20, SIX_Y-SIX_SPACING, SIX_W, SIX_W, {
{new FGAdjustAction(FGBFI::getNAV2SelRadial, FGBFI::setNAV2SelRadial,
{new FGAdjustAction(V("/radios/nav2/radials/selected"),
1.0, 0.0, 360.0, true),
0, -SIX_W/2, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGBFI::getNAV2SelRadial, FGBFI::setNAV2SelRadial,
{new FGAdjustAction(V("/radios/nav2/radials/selected"),
-1.0, 0.0, 360.0, true),
0, -SIX_W/2 + SIX_W/10, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGBFI::getNAV2SelRadial, FGBFI::setNAV2SelRadial,
{new FGAdjustAction(V("/radios/nav2/radials/selected"),
5.0, 0.0, 360.0, true),
1, -SIX_W/2, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGBFI::getNAV2SelRadial, FGBFI::setNAV2SelRadial,
{new FGAdjustAction(V("/radios/nav2/radials/selected"),
-5.0, 0.0, 360.0, true),
1, -SIX_W/2 + SIX_W/10, -SIX_W/2, SIX_W/10, SIX_W/5}
}, {
{new MyTexturedLayer("compassBG"), {
{TransData::Rotation, FGBFI::getNAV2SelRadial,
{TransData::Rotation, "/radios/nav2/radials/selected",
-360.0, 360.0, -1.0, 0.0}
}},
{new MyTexturedLayer("navFG", SIX_W/2, int(SIX_W*(5.0/8.0)))},
@ -655,11 +679,13 @@ InstrumentData instruments[] =
int(SIX_W*(21.0/112.0))), {
{TransData::XShift, 0, 0.0, 0.0, 0.0, -SIX_W/2+10},
{TransData::YShift, 0, 0.0, 0.0, 0.0, -SIX_W/2+10},
{TransData::Rotation, FGBFI::getNAV2SelRadial, -360.0, 360.0, 1.0, 0.0}
{TransData::Rotation, "/radios/nav2/radials/selected",
-360.0, 360.0, 1.0, 0.0}
}},
{new FGSwitchLayer(SIX_W/8, SIX_W/8, panelGetNAV2TO,
{new FGSwitchLayer(SIX_W/8, SIX_W/8, V("/panel/vor2/to-flag"),
new MyTexturedLayer("toFlag", SIX_W/8, SIX_W/8),
new FGSwitchLayer(SIX_W/8, SIX_W/8, panelGetNAV2FROM,
new FGSwitchLayer(SIX_W/8, SIX_W/8,
V("/panel/vor2/from-flag"),
new MyTexturedLayer("fromFlag",
SIX_W/8,
SIX_W/8),
@ -669,37 +695,37 @@ InstrumentData instruments[] =
{TransData::YShift, 0, 0.0, 0.0, 0.0, -int(SIX_W*0.1875)}
}},
{new MyTexturedLayer("navNeedle", SIX_W/32, SIX_W/2), {
{TransData::XShift, FGSteam::get_HackVOR2_deg,
{TransData::XShift, "/steam/vor2",
-10.0, 10.0, SIX_W/40.0, 0.0}
}}
}},
{"adf", SIX_X+(SIX_SPACING*3)+20, SIX_Y-(SIX_SPACING*2), SIX_W, SIX_W, {
{new FGAdjustAction(FGBFI::getADFRotation, FGBFI::setADFRotation,
{new FGAdjustAction(V("/radios/adf/rotation"),
-1.0, 0.0, 360.0, true),
0, -SIX_W/2, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGBFI::getADFRotation, FGBFI::setADFRotation,
{new FGAdjustAction(V("/radios/adf/rotation"),
1.0, 0.0, 360.0, true),
0, -SIX_W/2 + SIX_W/10, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGBFI::getADFRotation, FGBFI::setADFRotation,
{new FGAdjustAction(V("/radios/adf/rotation"),
-5.0, 0.0, 360.0, true),
1, -SIX_W/2, -SIX_W/2, SIX_W/10, SIX_W/5},
{new FGAdjustAction(FGBFI::getADFRotation, FGBFI::setADFRotation,
{new FGAdjustAction(V("/radios/adf/rotation"),
5.0, 0.0, 360.0, true),
1, -SIX_W/2 + SIX_W/10, -SIX_W/2, SIX_W/10, SIX_W/5}
},{
{new MyTexturedLayer("compassBG"), {
{TransData::Rotation, FGBFI::getADFRotation, 0.0, 360.0, 1.0, 0.0}
{TransData::Rotation, "/radios/adf/rotation", 0.0, 360.0, 1.0, 0.0}
}},
{new MyTexturedLayer("adfFace", -1, -1), {}},
{new MyTexturedLayer("adfNeedle", SIX_W/8, int(SIX_W*0.625)), {
{TransData::Rotation, FGSteam::get_HackADF_deg, -720.0, 720.0, 1.0, 0.0}
{TransData::Rotation, "/steam/adf", -720.0, 720.0, 1.0, 0.0}
}},
{new MyTexturedLayer("adfKnob", int(SIX_W*(21.0/112.0)),
int(SIX_W*(21.0/112.0))), {
{TransData::XShift, 0, 0.0, 0.0, 0.0, -SIX_W/2+10},
{TransData::YShift, 0, 0.0, 0.0, 0.0, -SIX_W/2+10},
{TransData::Rotation, FGBFI::getADFRotation, 0.0, 360.0, 1.0, 0.0}
{TransData::Rotation, "/radios/adf/rotation", 0.0, 360.0, 1.0, 0.0}
}}
}},
@ -729,27 +755,21 @@ createNavCom1 (int x, int y)
// Use the button to swap standby and active
// NAV frequencies
inst->addAction(0, int(SIX_W * .375), -SIX_W/4, SIX_W/4, SIX_W/4,
new FGSwapAction(FGBFI::getNAV1Freq,
FGBFI::setNAV1Freq,
FGBFI::getNAV1AltFreq,
FGBFI::setNAV1AltFreq));
new FGSwapAction(V("/radios/nav1/frequencies/selected"),
V("/radios/nav1/frequencies/standby")));
// Use the knob to tune the standby NAV
inst->addAction(0, SIX_W-SIX_W/4, -SIX_W/4, SIX_W/8, SIX_W/4,
new FGAdjustAction(FGBFI::getNAV1AltFreq,
FGBFI::setNAV1AltFreq,
new FGAdjustAction(V("/radios/nav1/frequencies/standby"),
-0.05, 108.0, 117.95, true));
inst->addAction(0, SIX_W-SIX_W/8, -SIX_W/4, SIX_W/8, SIX_W/4,
new FGAdjustAction(FGBFI::getNAV1AltFreq,
FGBFI::setNAV1AltFreq,
new FGAdjustAction(V("/radios/nav1/frequencies/standby"),
0.05, 108.0, 117.95, true));
inst->addAction(1, SIX_W-SIX_W/4, -SIX_W/4, SIX_W/8, SIX_W/4,
new FGAdjustAction(FGBFI::getNAV1AltFreq,
FGBFI::setNAV1AltFreq,
new FGAdjustAction(V("/radios/nav1/frequencies/standby"),
-0.5, 108.0, 117.95, true));
inst->addAction(1, SIX_W-SIX_W/8, -SIX_W/4, SIX_W/8, SIX_W/4,
new FGAdjustAction(FGBFI::getNAV1AltFreq,
FGBFI::setNAV1AltFreq,
new FGAdjustAction(V("/radios/nav1/frequencies/standby"),
0.5, 108.0, 117.95, true));
// Layer 0: background
@ -757,8 +777,14 @@ createNavCom1 (int x, int y)
// Layer 1: NAV frequencies
FGTextLayer * text = new FGTextLayer(SIX_W*2, SMALL_W/2);
text->addChunk(new FGTextLayer::Chunk(FGBFI::getNAV1Freq, "%.2f"));
text->addChunk(new FGTextLayer::Chunk(FGBFI::getNAV1AltFreq, "%7.2f"));
text->addChunk(new
FGTextLayer::Chunk(FGTextLayer::DOUBLE_VALUE,
V("/radios/nav1/frequencies/selected"),
"%.2f"));
text->addChunk(new
FGTextLayer::Chunk(FGTextLayer::DOUBLE_VALUE,
V("/radios/nav1/frequencies/standby"),
"%7.2f"));
text->setPointSize(14);
text->setColor(1.0, 0.5, 0.0);
inst->addLayer(text);
@ -780,27 +806,21 @@ createNavCom2 (int x, int y)
// Use the button to swap standby and active
// NAV frequencies
inst->addAction(0, int(SIX_W * .375), -SIX_W/4, SIX_W/4, SIX_W/4,
new FGSwapAction(FGBFI::getNAV2Freq,
FGBFI::setNAV2Freq,
FGBFI::getNAV2AltFreq,
FGBFI::setNAV2AltFreq));
new FGSwapAction(V("/radios/nav2/frequencies/selected"),
V("/radios/nav2/frequencies/standby")));
// Use the knob to tune the standby NAV
inst->addAction(0, SIX_W-SIX_W/4, -SIX_W/4, SIX_W/8, SIX_W/4,
new FGAdjustAction(FGBFI::getNAV2AltFreq,
FGBFI::setNAV2AltFreq,
new FGAdjustAction(V("/radios/nav2/frequencies/standby"),
-0.05, 108.0, 117.95, true));
inst->addAction(0, SIX_W-SIX_W/8, -SIX_W/4, SIX_W/8, SIX_W/4,
new FGAdjustAction(FGBFI::getNAV2AltFreq,
FGBFI::setNAV2AltFreq,
new FGAdjustAction(V("/radios/nav2/frequencies/standby"),
0.05, 108.0, 117.95, true));
inst->addAction(1, SIX_W-SIX_W/4, -SIX_W/4, SIX_W/8, SIX_W/4,
new FGAdjustAction(FGBFI::getNAV2AltFreq,
FGBFI::setNAV2AltFreq,
new FGAdjustAction(V("/radios/nav2/frequencies/standby"),
-0.5, 108.0, 117.95, true));
inst->addAction(1, SIX_W-SIX_W/8, -SIX_W/4, SIX_W/8, SIX_W/4,
new FGAdjustAction(FGBFI::getNAV2AltFreq,
FGBFI::setNAV2AltFreq,
new FGAdjustAction(V("/radios/nav2/frequencies/standby"),
0.5, 108.0, 117.95, true));
// Layer 0: background
@ -808,8 +828,14 @@ createNavCom2 (int x, int y)
// Layer 1: NAV frequencies
FGTextLayer * text = new FGTextLayer(SIX_W*2, SIX_W/2);
text->addChunk(new FGTextLayer::Chunk(FGBFI::getNAV2Freq, "%.2f"));
text->addChunk(new FGTextLayer::Chunk(FGBFI::getNAV2AltFreq, "%7.2f"));
text->addChunk(new
FGTextLayer::Chunk(FGTextLayer::DOUBLE_VALUE,
V("/radios/nav2/frequencies/selected"),
"%.2f"));
text->addChunk(new
FGTextLayer::Chunk(FGTextLayer::DOUBLE_VALUE,
V("/radios/nav2/frequencies/standby"),
"%7.2f"));
text->setPointSize(14);
text->setColor(1.0, 0.5, 0.0);
inst->addLayer(text);
@ -831,23 +857,19 @@ createADFRadio (int x, int y)
// Use the knob to tune the standby NAV
inst->addAction(0, int(SIX_W * 0.7), int(-SIX_W * 0.07),
int(SIX_W * 0.09), int(SIX_W * 0.14),
new FGAdjustAction(FGBFI::getADFFreq,
FGBFI::setADFFreq,
new FGAdjustAction(V("/radios/adf/frequencies/selected"),
-1.0, 100.0, 1299, true));
inst->addAction(0, int(SIX_W * 0.79), int(-SIX_W * 0.07),
int(SIX_W * 0.09), int(SIX_W * 0.14),
new FGAdjustAction(FGBFI::getADFFreq,
FGBFI::setADFFreq,
new FGAdjustAction(V("/radios/adf/frequencies/selected"),
1.0, 100.0, 1299, true));
inst->addAction(1, int(SIX_W * 0.7), int(-SIX_W * 0.07),
int(SIX_W * 0.09), int(SIX_W * 0.14),
new FGAdjustAction(FGBFI::getADFFreq,
FGBFI::setADFFreq,
new FGAdjustAction(V("/radios/adf/frequencies/selected"),
-25.0, 100.0, 1299, true));
inst->addAction(1, int(SIX_W * 0.79), int(-SIX_W * 0.07),
int(SIX_W * 0.09), int(SIX_W * 0.14),
new FGAdjustAction(FGBFI::getADFFreq,
FGBFI::setADFFreq,
new FGAdjustAction(V("/radios/adf/frequencies/selected"),
25.0, 100.0, 1299, true));
// Layer 0: background
@ -855,7 +877,10 @@ createADFRadio (int x, int y)
// Layer: ADF frequency
FGTextLayer * text = new FGTextLayer(SIX_W*2, SIX_W/2);
text->addChunk(new FGTextLayer::Chunk(FGBFI::getADFFreq, "%4.0f"));
text->addChunk(new
FGTextLayer::Chunk(FGTextLayer::DOUBLE_VALUE,
V("/radios/adf/frequencies/selected"),
"%4.0f"));
text->setPointSize(14);
text->setColor(1.0, 0.5, 0.0);
inst->addLayer(text);
@ -876,39 +901,36 @@ createAP (int x, int y)
// Action: select HDG button
inst->addAction(0, int(-SIX_W*0.6125), -SIX_W/16, SIX_W/4, SIX_W/8,
new FGToggleAction(FGBFI::getAPHeadingLock,
FGBFI::setAPHeadingLock));
new FGToggleAction(V("/autopilot/locks/heading")));
// Action: select NAV button
inst->addAction(0, int(-SIX_W*0.3625), -SIX_W/16, SIX_W/4, SIX_W/8,
new FGToggleAction(FGBFI::getAPNAV1Lock,
FGBFI::setAPNAV1Lock));
new FGToggleAction(V("/autopilot/locks/nav1")));
// Action: select ALT button
inst->addAction(0, int(-SIX_W*0.1125), -SIX_W/16, SIX_W/4, SIX_W/8,
new FGToggleAction(FGBFI::getAPAltitudeLock,
FGBFI::setAPAltitudeLock));
new FGToggleAction(V("/autopilot/locks/altitude")));
// Layer: AP background
inst->addLayer(tex["autopilotBG"], SIX_W*2, SIX_W/4);
// Display HDG button
FGSwitchLayer * sw =
new FGSwitchLayer(SIX_W/4, SIX_W/8, FGBFI::getAPHeadingLock,
new FGSwitchLayer(SIX_W/4, SIX_W/8, V("/autopilot/locks/heading"),
new FGTexturedLayer(tex["hdgButtonOn"], SIX_W/4, SIX_W/8),
new FGTexturedLayer(tex["hdgButtonOff"], SIX_W/4, SIX_W/8));
inst->addLayer(sw);
inst->addTransformation(FGInstrumentLayer::XSHIFT, -SIX_W * 0.5);
// Display NAV button
sw = new FGSwitchLayer(SIX_W/4, SIX_W/8, FGBFI::getAPNAV1Lock,
sw = new FGSwitchLayer(SIX_W/4, SIX_W/8, V("/autopilot/locks/nav1"),
new FGTexturedLayer(tex["navButtonOn"], SIX_W/4, SIX_W/8),
new FGTexturedLayer(tex["navButtonOff"], SIX_W/4, SIX_W/8));
inst->addLayer(sw);
inst->addTransformation(FGInstrumentLayer::XSHIFT, -SIX_W * 0.25);
// Display ALT button
sw = new FGSwitchLayer(SIX_W/4, SIX_W/8, FGBFI::getAPAltitudeLock,
sw = new FGSwitchLayer(SIX_W/4, SIX_W/8, V("/autopilot/locks/altitude"),
new FGTexturedLayer(tex["altButtonOn"], SIX_W/4, SIX_W/8),
new FGTexturedLayer(tex["altButtonOff"], SIX_W/4, SIX_W/8));
inst->addLayer(sw);
@ -928,7 +950,9 @@ createDME (int x, int y)
// Layer: current distance
FGTextLayer * text1 = new FGTextLayer(SIX_W/2, SIX_W/4);
text1->addChunk(new FGTextLayer::Chunk(FGBFI::getNAV1DistDME, "%05.1f",
text1->addChunk(new FGTextLayer::Chunk(FGTextLayer::DOUBLE_VALUE,
V("/radios/nav1/dme/distance"),
"%05.1f",
METER_TO_NM));
text1->setPointSize(12);
text1->setColor(1.0, 0.5, 0.0);
@ -939,7 +963,7 @@ createDME (int x, int y)
text2->setColor(1.0, 0.5, 0.0);
FGSwitchLayer * sw =
new FGSwitchLayer(SIX_W/2, SIX_W/4, FGBFI::getNAV1DMEInRange,
new FGSwitchLayer(SIX_W/2, SIX_W/4, V("/radios/nav1/dme/in-range"),
text1, text2);
inst->addLayer(sw);
@ -963,6 +987,14 @@ fgCreateSmallSinglePropPanel (int xpos, int ypos, int finx, int finy)
FGPanel * panel = new FGPanel(xpos, ypos, w, h);
int x, y;
// Tie local functions
// FIXME: define these elsewhere...
current_properties.tieString("/panel/time", panelGetTime);
current_properties.tieBool("/panel/vor1/to-flag", panelGetNAV1TO);
current_properties.tieBool("/panel/vor1/from-flag", panelGetNAV1FROM);
current_properties.tieBool("/panel/vor2/to-flag", panelGetNAV2TO);
current_properties.tieBool("/panel/vor2/from-flag", panelGetNAV2FROM);
setupTextures();
// Read gauges from data table.
@ -998,8 +1030,8 @@ fgCreateSmallSinglePropPanel (int xpos, int ypos, int finx, int finy)
default:
break;
}
if (trans.func) {
inst->addTransformation(type, trans.func,
if (trans.propName != 0) {
inst->addTransformation(type, V(trans.propName),
trans.min, trans.max,
trans.factor, trans.offset);
} else {

View file

@ -30,6 +30,7 @@
#endif
#include <simgear/constants.h>
#include <simgear/misc/props.hxx>
#include <simgear/math/fg_types.hxx>
#include <Aircraft/aircraft.hxx>
#include <Main/options.hxx>
@ -41,6 +42,8 @@ FG_USING_NAMESPACE(std);
#include "radiostack.hxx"
#include "steam.hxx"
static bool isTied = false;
////////////////////////////////////////////////////////////////////////
@ -95,6 +98,32 @@ int FGSteam::_UpdatesPending = 1000000; /* Forces filter to reset */
void FGSteam::update ( int timesteps )
{
if (!isTied) {
isTied = true;
current_properties.tieDouble("/steam/airspeed",
FGSteam::get_ASI_kias);
current_properties.tieDouble("/steam/altitude",
FGSteam::get_ALT_ft);
current_properties.tieDouble("/steam/turn-rate",
FGSteam::get_TC_std);
current_properties.tieDouble("/steam/slip-skid",
FGSteam::get_TC_rad);
current_properties.tieDouble("/steam/vertical-speed",
FGSteam::get_VSI_fps);
current_properties.tieDouble("/steam/gyro-compass",
FGSteam::get_DG_deg);
current_properties.tieDouble("/steam/vor1",
FGSteam::get_HackVOR1_deg);
current_properties.tieDouble("/steam/vor2",
FGSteam::get_HackVOR2_deg);
current_properties.tieDouble("/steam/glidescope1",
FGSteam::get_HackGS_deg);
current_properties.tieDouble("/steam/adf",
FGSteam::get_HackADF_deg);
current_properties.tieDouble("/steam/gyro-compass-error",
FGSteam::get_DG_err,
FGSteam::set_DG_err);
}
_UpdatesPending += timesteps;
}