1
0
Fork 0

Sep. 18, 2000 updates from David Megginson. New panel configs are now

expected to be found in $fgroot.
This commit is contained in:
curt 2000-09-21 20:08:16 +00:00
parent 5d63ed2d0f
commit 830b17c6ef
3 changed files with 80 additions and 49 deletions

View file

@ -27,17 +27,22 @@
#endif
#include <simgear/compiler.h>
#include <simgear/misc/fgpath.hxx>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/props.hxx>
#include <iostream>
#include <fstream>
#include <string>
#include <Main/options.hxx>
#include "panel.hxx"
#include "steam.hxx"
#include "panel_io.hxx"
using std::istream;
using std::ifstream;
using std::string;
@ -622,7 +627,7 @@ readInstrument (SGPropertyNode node, int x, int y, int real_w, int real_h)
/**
pp * Read a panel from a property list.
* Read a panel from a property list.
*
* Each panel instrument will appear in its own, separate
* property list. The top level simply names the panel and
@ -672,12 +677,13 @@ fgReadPanel (istream &input)
SGPropertyList props2;
SGPropertyNode node = instrument_group.getChild(i);
string path = node.getStringValue("path");
FGPath path(current_options.get_fg_root());
path.append(node.getStringValue("path"));
FG_LOG(FG_INPUT, FG_INFO, "Reading instrument "
<< node.getName()
<< " from "
<< path);
<< path.str());
int x = node.getIntValue("x", -1);
int y = node.getIntValue("y", -1);
@ -690,7 +696,7 @@ fgReadPanel (istream &input)
return 0;
}
if (!readPropertyList(path, &props2)) {
if (!readPropertyList(path.str(), &props2)) {
delete panel;
return 0;
}
@ -714,4 +720,28 @@ fgReadPanel (istream &input)
}
/**
* Read a panel from a property list.
*
* This function opens a stream to a file, then invokes the
* main fgReadPanel() function.
*/
FGPanel *
fgReadPanel (const string &relative_path)
{
FGPath path(current_options.get_fg_root());
path.append(relative_path);
ifstream input(path.c_str());
if (!input.good()) {
FG_LOG(FG_INPUT, FG_ALERT,
"Cannot read panel configuration from " << path.str());
return 0;
}
FGPanel * panel = fgReadPanel(input);
input.close();
return panel;
}
// end of panel_io.cxx

View file

@ -36,5 +36,6 @@
using std::istream;
extern FGPanel * fgReadPanel (istream &input);
extern FGPanel * fgReadPanel (const string &relative_path);
#endif // __PANEL_IO_HXX

View file

@ -170,91 +170,91 @@ struct TextureData
// but soon it will be initialized from
// an XML file at runtime.
TextureData textureData[] = {
{"compassFront", "Textures/Panel/misc-1.rgb",
{"compassFront", "Textures/Panel.old/misc-1.rgb",
48.0/128.0, 0.0, 1.0, 24.0/128.0},
{"airspeedBG", "Textures/Panel/faces-2.rgb",
{"airspeedBG", "Textures/Panel.old/faces-2.rgb",
0, 0.5, 0.5, 1.0},
{"longNeedle", "Textures/Panel/misc-1.rgb",
{"longNeedle", "Textures/Panel.old/misc-1.rgb",
102.0/128.0, 100.0/128.0, 107.0/128.0, 1.0},
{"horizonBG", "Textures/Panel/faces-2.rgb",
{"horizonBG", "Textures/Panel.old/faces-2.rgb",
0.5, 0.5, 1.0, 1.0},
{"horizonFloat", "Textures/Panel/misc-1.rgb",
{"horizonFloat", "Textures/Panel.old/misc-1.rgb",
15.0/32.0, 54.0/128.0, 28.0/32.0, 87.0/128.0},
{"horizonRim", "Textures/Panel/faces-2.rgb",
{"horizonRim", "Textures/Panel.old/faces-2.rgb",
0, 0, 0.5, 0.5},
{"horizonFront", "Textures/Panel/faces-2.rgb",
{"horizonFront", "Textures/Panel.old/faces-2.rgb",
0.5, 0.0, 1.0, 0.5},
{"altimeterBG", "Textures/Panel/faces-1.rgb",
{"altimeterBG", "Textures/Panel.old/faces-1.rgb",
0.5, 0.5, 1.0, 1.0},
{"shortNeedle", "Textures/Panel/misc-1.rgb",
{"shortNeedle", "Textures/Panel.old/misc-1.rgb",
107.0/128.0, 110.0/128.0, 113.0/128.0, 1.0},
{"bug", "Textures/Panel/misc-1.rgb",
{"bug", "Textures/Panel.old/misc-1.rgb",
108.0/128.0, 104.0/128.0, 112.0/128.0, 108.0/128.0},
{"turnBG", "Textures/Panel/faces-1.rgb",
{"turnBG", "Textures/Panel.old/faces-1.rgb",
0.5, 0.0, 1.0, 0.5},
{"turnPlane", "Textures/Panel/misc-1.rgb",
{"turnPlane", "Textures/Panel.old/misc-1.rgb",
0.0, 3.0/8.0, 3.0/8.0, 0.5},
{"turnBall", "Textures/Panel/misc-1.rgb",
{"turnBall", "Textures/Panel.old/misc-1.rgb",
108.0/128.0, 100.0/128.0, 112.0/128.0, 104.0/128.0},
{"compassBG", "Textures/Panel/faces-1.rgb",
{"compassBG", "Textures/Panel.old/faces-1.rgb",
0.0, 0.5, 0.5, 1.0},
{"compassCenter", "Textures/Panel/misc-1.rgb",
{"compassCenter", "Textures/Panel.old/misc-1.rgb",
15.0/32.0, 11.0/16.0, 25.0/32.0, 1.0},
{"headingKnob", "Textures/Panel/misc-1.rgb",
{"headingKnob", "Textures/Panel.old/misc-1.rgb",
0, 64.0/128.0, 21.0/128.0, 85.0/128.0},
{"knob", "Textures/Panel/misc-1.rgb",
{"knob", "Textures/Panel.old/misc-1.rgb",
79.0/128.0, 31.0/128.0, 101.0/128.0, 53.0/128.0},
{"verticalBG", "Textures/Panel/faces-1.rgb",
{"verticalBG", "Textures/Panel.old/faces-1.rgb",
0.0, 0.0, 0.5, 0.5},
{"rpmBG", "Textures/Panel/faces-3.rgb",
{"rpmBG", "Textures/Panel.old/faces-3.rgb",
0.0, 0.5, 0.5, 1.0},
{"flapsBG", "Textures/Panel/faces-3.rgb",
{"flapsBG", "Textures/Panel.old/faces-3.rgb",
0.5, 0.5, 1.0, 1.0},
{"clockBG", "Textures/Panel/faces-3.rgb",
{"clockBG", "Textures/Panel.old/faces-3.rgb",
0.5, 0.0, 1.0, 0.5},
{"controlsBG", "Textures/Panel/faces-3.rgb",
{"controlsBG", "Textures/Panel.old/faces-3.rgb",
0.0, 0.0, 0.5, 0.5},
{"navFG", "Textures/Panel/misc-1.rgb",
{"navFG", "Textures/Panel.old/misc-1.rgb",
0, 0, 0.25, 5.0/16.0},
{"obsKnob", "Textures/Panel/misc-1.rgb",
{"obsKnob", "Textures/Panel.old/misc-1.rgb",
0.0, 86.0/128.0, 21.0/128.0, 107.0/128.0},
{"toFlag", "Textures/Panel/misc-1.rgb",
{"toFlag", "Textures/Panel.old/misc-1.rgb",
120.0/128.0, 74.0/128.0, 1.0, 80.0/128.0},
{"fromFlag", "Textures/Panel/misc-1.rgb",
{"fromFlag", "Textures/Panel.old/misc-1.rgb",
120.0/128.0, 80.0/128.0, 1.0, 86.0/128.0},
{"offFlag", "Textures/Panel/misc-1.rgb",
{"offFlag", "Textures/Panel.old/misc-1.rgb",
120.0/128.0, 0.5, 1.0, 70.0/128.0},
{"navNeedle", "Textures/Panel/misc-1.rgb",
{"navNeedle", "Textures/Panel.old/misc-1.rgb",
56.0/128.0, 0.5, 58.0/128.0, 1.0},
{"adfNeedle", "Textures/Panel/misc-1.rgb",
{"adfNeedle", "Textures/Panel.old/misc-1.rgb",
120.0/128.0, 88.0/128.0, 1.0, 1.0},
{"adfKnob", "Textures/Panel/misc-1.rgb",
{"adfKnob", "Textures/Panel.old/misc-1.rgb",
0.0, 107.0/128.0, 21.0/128.0, 1.0},
{"adfPlane", "Textures/Panel/misc-1.rgb",
{"adfPlane", "Textures/Panel.old/misc-1.rgb",
102.0/128.0, 32.0/128.0, 1.0, 48.0/128.0},
{"adfFace", "Textures/Panel/faces-4.rgb",
{"adfFace", "Textures/Panel.old/faces-4.rgb",
0.0, 0.5, 0.5, 1.0},
{"navRadioBG", "Textures/Panel/radios-1.rgb",
{"navRadioBG", "Textures/Panel.old/radios-1.rgb",
0.0, 0.75, 1.0, 1.0},
{"adfRadioBG", "Textures/Panel/radios-1.rgb",
{"adfRadioBG", "Textures/Panel.old/radios-1.rgb",
0.0, 0.5, 1.0, 0.75},
{"autopilotBG", "Textures/Panel/radios-1.rgb",
{"autopilotBG", "Textures/Panel.old/radios-1.rgb",
0.0, 0.375, 1.0, 0.5},
{"hdgButtonOn", "Textures/Panel/misc-1.rgb",
{"hdgButtonOn", "Textures/Panel.old/misc-1.rgb",
39.0/128.0, 118.0/128.0, 54.0/128.0, 128.0/128.0},
{"hdgButtonOff", "Textures/Panel/misc-1.rgb",
{"hdgButtonOff", "Textures/Panel.old/misc-1.rgb",
22.0/128.0, 118.0/128.0, 37.0/128.0, 128.0/128.0},
{"navButtonOn", "Textures/Panel/misc-1.rgb",
{"navButtonOn", "Textures/Panel.old/misc-1.rgb",
39.0/128.0, 106.0/128.0, 54.0/128.0, 116.0/128.0},
{"navButtonOff", "Textures/Panel/misc-1.rgb",
{"navButtonOff", "Textures/Panel.old/misc-1.rgb",
22.0/128.0, 106.0/128.0, 37.0/128.0, 116.0/128.0},
{"altButtonOn", "Textures/Panel/misc-1.rgb",
{"altButtonOn", "Textures/Panel.old/misc-1.rgb",
39.0/128.0, 82.0/128.0, 54.0/128.0, 92.0/128.0},
{"altButtonOff", "Textures/Panel/misc-1.rgb",
{"altButtonOff", "Textures/Panel.old/misc-1.rgb",
22.0/128.0, 82.0/128.0, 37.0/128.0, 92.0/128.0},
{"dmeBG", "Textures/Panel/radios-1.rgb",
{"dmeBG", "Textures/Panel.old/radios-1.rgb",
0.0, 0.25, 0.375, 0.375},
{"compassRibbon", "Textures/Panel/compass-ribbon.rgb",
{"compassRibbon", "Textures/Panel.old/compass-ribbon.rgb",
0.0, 0.0, 1.0, 1.0},
{0, 0}
};
@ -1031,7 +1031,7 @@ fgCreateSmallSinglePropPanel (int xpos, int ypos, int finx, int finy)
for (int k = 0; layer.transformations[k].type; k++) {
TransData &trans = layer.transformations[k];
FGPanelTransformation::Type type;
FGPanelTransformation::Type type = FGPanelTransformation::XSHIFT;
switch (trans.type) {
case TransData::Rotation:
type = FGPanelTransformation::ROTATION;
@ -1065,7 +1065,7 @@ fgCreateSmallSinglePropPanel (int xpos, int ypos, int finx, int finy)
y = SIX_Y;
// Set the background texture
panel->setBackground(createTexture("Textures/Panel/panel-bg.rgb"));
panel->setBackground(createTexture("Textures/Panel.old/panel-bg.rgb"));
// Radio stack
x = SIX_X + (SIX_SPACING * 5);