From 5000731c039318a554fbf260c6a75492bcfe2a27 Mon Sep 17 00:00:00 2001 From: mfranz Date: Thu, 6 Jul 2006 16:46:25 +0000 Subject: [PATCH] fix feature (required for the compass tape) --- src/Instrumentation/HUD/HUD.hxx | 7 +++---- src/Instrumentation/HUD/HUD_gauge.cxx | 8 ++++---- src/Instrumentation/HUD/HUD_tape.cxx | 16 ++++++++++++---- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/Instrumentation/HUD/HUD.hxx b/src/Instrumentation/HUD/HUD.hxx index 678b19776..42e334f12 100644 --- a/src/Instrumentation/HUD/HUD.hxx +++ b/src/Instrumentation/HUD/HUD.hxx @@ -457,18 +457,17 @@ public: virtual void draw ( void ) {} // No-op here. Defined in derived classes. protected: - inline unsigned int modulo() const { return _modulo; } inline float factor() const { return _display_factor; } inline float range_to_show() const { return _range_shown; } Input _input; - float _major_divs; // major division marker units - float _minor_divs; // minor division marker units + float _major_divs; // major division marker units + float _minor_divs; // minor division marker units + unsigned int _modulo; // Roll over point private: float _range_shown; // Width Units. float _display_factor; // factor => screen units/range values. - unsigned int _modulo; // Roll over point }; diff --git a/src/Instrumentation/HUD/HUD_gauge.cxx b/src/Instrumentation/HUD/HUD_gauge.cxx index 5c9e99df0..f0b95fc24 100644 --- a/src/Instrumentation/HUD/HUD_gauge.cxx +++ b/src/Instrumentation/HUD/HUD_gauge.cxx @@ -219,7 +219,7 @@ void HUD::Gauge::draw(void) i = (int)vmin; for (; i _input.max())) + if (!_modulo && (v < _input.min() || v > _input.max())) continue; float y = _y + (v - vmin) * factor(); @@ -342,7 +342,11 @@ void HUD::Tape::draw(void) // (HUD_scale * pscale) } // end huds both } else { // major div - lenstr = snprintf(buf, BUFSIZE, "%d", int(v)); + int display_value = int(v); + if (_modulo) + display_value %= _modulo; + + lenstr = snprintf(buf, BUFSIZE, "%d", display_value); if (option_both()) { // draw_line(_x, y, marker_xs, y); @@ -501,7 +505,7 @@ void HUD::Tape::draw(void) // (HUD_scale * pscale) for (int i = 0; ; i++) { float v = vstart + i * _minor_divs; - if (!modulo() && (v < _input.min() || v > _input.max())) + if (!_modulo && (v < _input.min() || v > _input.max())) continue; float x = _x + (v - vmin) * factor(); @@ -543,7 +547,11 @@ void HUD::Tape::draw(void) // (HUD_scale * pscale) } } else { // major divs - lenstr = snprintf(buf, BUFSIZE, "%d", int(v)); + int display_value = int(v); + if (_modulo) + display_value %= _modulo; + + lenstr = snprintf(buf, BUFSIZE, "%d", display_value); // Draw major ticks and text only if far enough from the edge. // FIXME if (x < _x + 10 || x + 10 > _x + _w) -- 2.39.5