]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/HUD/HUD_tape.cxx
Re-Name FGViewer to flightgear::View
[flightgear.git] / src / Instrumentation / HUD / HUD_tape.cxx
index 5e73dfc1b23b410746ff0039f2589400c95e0cf3..56b5b60713eb35e4e70e32d86e388a085ff91d70 100644 (file)
@@ -20,6 +20,7 @@
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 #include "HUD.hxx"
+#include "HUD_private.hxx"
 
 static const float TICK_OFFSET = 2.f;
 
@@ -89,7 +90,7 @@ void HUD::Tape::draw(void) //  (HUD_scale * pscale)
 
 void HUD::Tape::draw_vertical(float value)
 {
-    float vmin = 0.0, vmax = 0.0;
+    float vmin = 0.0;//, vmax = 0.0;
     float marker_xs;
     float marker_xe;
     float marker_ye;
@@ -101,16 +102,16 @@ void HUD::Tape::draw_vertical(float value)
 
     if (!_pointer) {
         vmin = value - _half_width_units; // width units == needle travel
-        vmax = value + _half_width_units; // or picture unit span.
+//        vmax = value + _half_width_units; // or picture unit span.
         text_y = _center_y;
 
     } else if (_pointer_type == MOVING) {
         vmin = _input.min();
-        vmax = _input.max();
+//        vmax = _input.max();
 
     } else { // FIXED
         vmin = value - _half_width_units; // width units == needle travel
-        vmax = value + _half_width_units; // or picture unit span.
+//        vmax = value + _half_width_units; // or picture unit span.
         text_y = _center_y;
     }
 
@@ -243,11 +244,12 @@ void HUD::Tape::draw_vertical(float value)
     for (int i = 0; ; i++) {
         float v = vstart + i * _minor_divs;
 
-        if (!_modulo)
+        if (!_modulo) {
             if (v < _input.min())
                 continue;
             else if (v > _input.max())
                 break;
+        }
 
         float y = _y + (v - vmin) * factor();
 
@@ -335,8 +337,8 @@ void HUD::Tape::draw_vertical(float value)
                     continue;
 
                 if (_label_gap == 0.0
-                        || b < _center_y - _label_gap && t < _center_y - _label_gap
-                        || b > _center_y + _label_gap && t > _center_y + _label_gap) {
+                        || (b < _center_y - _label_gap && t < _center_y - _label_gap)
+                        || (b > _center_y + _label_gap && t > _center_y + _label_gap)) {
                     draw_text(x, y, s);
                 }
             }
@@ -347,12 +349,12 @@ void HUD::Tape::draw_vertical(float value)
 
 void HUD::Tape::draw_horizontal(float value)
 {
-    float vmin = 0.0, vmax = 0.0;
+    float vmin = 0.0;//, vmax = 0.0;
     float marker_xs;
-    float marker_xe;
+//    float marker_xe;
     float marker_ys;
     float marker_ye;
-    float text_y = 0.0;
+//    float text_y = 0.0;
 
     float top = _y + _h;
     float right = _x + _w;
@@ -360,17 +362,17 @@ void HUD::Tape::draw_horizontal(float value)
 
     if (!_pointer) {
         vmin = value - _half_width_units; // width units == needle travel
-        vmax = value + _half_width_units; // or picture unit span.
-        text_y = _center_y;
+//        vmax = value + _half_width_units; // or picture unit span.
+//        text_y = _center_y;
 
     } else if (_pointer_type == MOVING) {
         vmin = _input.min();
-        vmax = _input.max();
+//        vmax = _input.max();
 
     } else { // FIXED
         vmin = value - _half_width_units; // width units == needle travel
-        vmax = value + _half_width_units; // or picture unit span.
-        text_y = _center_y;
+//        vmax = value + _half_width_units; // or picture unit span.
+//        text_y = _center_y;
     }
 
     // left tick bar
@@ -383,7 +385,7 @@ void HUD::Tape::draw_horizontal(float value)
 
     marker_ys = _y;    // Starting point for
     marker_ye = top;           // tick y location calcs
-    marker_xe = right;
+//    marker_xe = right;
     marker_xs = _x + ((value - vmin) * factor());
 
     if (option_top()) {
@@ -451,11 +453,12 @@ void HUD::Tape::draw_horizontal(float value)
     for (int i = 0; ; i++) {
         float v = vstart + i * _minor_divs;
 
-        if (!_modulo)
+        if (!_modulo) {
             if (v < _input.min())
                 continue;
             else if (v > _input.max())
                 break;
+        }
 
         float x = _x + (v - vmin) * factor();
 
@@ -520,8 +523,8 @@ void HUD::Tape::draw_horizontal(float value)
                     continue;
 
                 if (_label_gap == 0.0
-                        || l < _center_x - _label_gap && r < _center_x - _label_gap
-                        || l > _center_x + _label_gap && r > _center_x + _label_gap) {
+                        || (l < _center_x - _label_gap && r < _center_x - _label_gap)
+                        || (l > _center_x + _label_gap && r > _center_x + _label_gap)) {
                     draw_text(x, y, s);
                 }
             }
@@ -532,7 +535,7 @@ void HUD::Tape::draw_horizontal(float value)
 
 char *HUD::Tape::format_value(float v)
 {
-    if (fabsf(v) < 1e-8)   // avoid -0.0
+    if (fabs(v) < 1e-8)   // avoid -0.0
         v = 0.0f;
 
     if (_label_fmt == INT)