@@ -12,21 +12,30 @@ double WindAngleGauge::clamp_180(double deg) {
1212WindAngleGauge::WindAngleGauge () {
1313 set_title (" APP WIND" );
1414 set_unit (" AWA" );
15-
1615 set_range (-180.0 , 180.0 );
1716
17+ apply_geometry_overrides_ ();
18+ }
19+
20+ void WindAngleGauge::apply_theme (const CircularGauge::Theme& theme) {
21+ CircularGauge::apply_theme (theme);
22+ apply_geometry_overrides_ (); // re-apply 30°/10° geometry after theme overwrite
23+ }
24+
25+ void WindAngleGauge::apply_geometry_overrides_ () {
1826 // Full 360° dial:
1927 // 0° at top (bow), +90° right, -90° left, ±180° bottom (stern).
2028 style ().start_deg = -90.0 - 180.0 ; // -270
2129 style ().end_deg = -90.0 + 180.0 ; // +90
2230
23- // Major every 30° across -180..+180 => 13 majors.
24- // Minor every 10° => 2 minors between majors.
31+ // Major every 30° across -180..+180 => 13 majors (12 intervals => 360/12=30°) .
32+ // Minor every 10° => 2 minors between majors (30/(2+1)=10°) .
2533 style ().major_ticks = 13 ;
2634 style ().minor_ticks = 2 ;
2735
28- // Move readout down so it doesn't get covered by the needle.
29- style ().value_radius_frac = 0.28 ;
36+ // Lower the AWS readout noticeably so it doesn't get covered by the needle.
37+ // (Your previous 0.28 was still close to center.)
38+ style ().value_radius_frac = 0.48 ;
3039
3140 style ().value_precision = 0 ;
3241}
@@ -42,8 +51,8 @@ double WindAngleGauge::value_to_angle_rad(double v) const {
4251}
4352
4453std::string WindAngleGauge::format_major_label (int /* major_index*/ , double major_value) const {
45- int v = static_cast < int >( std::lround ( clamp_180 (major_value)));
46- if (std::abs (v) == 180 ) v = 180 ;
54+ // -180, -150, ... 0 ... +150, +180
55+ const int v = static_cast < int > (std::lround ( clamp_180 (major_value))) ;
4756 return std::to_string (v);
4857}
4958
@@ -54,21 +63,35 @@ std::string WindAngleGauge::format_value_readout(double /*v*/) const {
5463 return std::string (buf);
5564}
5665
66+ // ---------------- WindSpeedGauge ----------------
67+
5768WindSpeedGauge::WindSpeedGauge () {
5869 set_title (" WIND SPD" );
5970 set_unit (" kn" );
60-
6171 set_range (0.0 , 40.0 );
6272
73+ apply_geometry_overrides_ ();
74+ }
75+
76+ void WindSpeedGauge::apply_theme (const CircularGauge::Theme& theme) {
77+ CircularGauge::apply_theme (theme);
78+ apply_geometry_overrides_ ();
79+ }
80+
81+ void WindSpeedGauge::apply_geometry_overrides_ () {
6382 style ().start_deg = -225.0 ;
64- style ().end_deg = 45.0 ;
83+ style ().end_deg = 45.0 ;
84+
6585 style ().major_ticks = 9 ; // 0..40 step 5
6686 style ().minor_ticks = 4 ;
6787 style ().value_precision = 1 ;
6888
69- style ().value_radius_frac = 0.22 ;
89+ // Slightly below center for speed gauge, but not as low as wind angle readout.
90+ style ().value_radius_frac = 0.30 ;
7091}
7192
93+ // ---------------- Panel ----------------
94+
7295WindInstrumentPanel::WindInstrumentPanel ()
7396: Gtk::Box(Gtk::Orientation::VERTICAL) {
7497 set_spacing (12 );
@@ -98,19 +121,22 @@ WindInstrumentPanel::WindInstrumentPanel()
98121void WindInstrumentPanel::apply_theme (const SailTheme& t) {
99122 theme_ = t;
100123
124+ // These now keep their 30°/10° and readout offsets after theming
101125 angle_.apply_theme (theme_.gauge );
102126 speed_.apply_theme (theme_.gauge );
103127
104128 // Zones per request:
105- // - no-go: -20..+20 (NOT red; use amber/orange )
129+ // - no-go: -20..+20 (NOT red; "usual" caution color )
106130 // - port scale: -60..-20 (red)
107131 // - stbd scale: +20..+60 (green)
132+ // - mirrored downwind: red on port side, green on stbd side
108133 std::vector<CircularGauge::Zone> zones;
109- // zones.push_back({ -20.0, 20.0, theme_.accent_no_go, 0.90 }); // no-go (caution)
110- zones.push_back ({ -60.0 , -20.0 , theme_.accent_red , 1.0 }); // port scale (red)
111- zones.push_back ({ 20.0 , 60.0 , theme_.accent_green , 1.0 }); // stbd scale (green)
112- zones.push_back ({-160.0 , -120.0 , theme_.accent_red , 1.0 }); // port scale (red)
113- zones.push_back ({ 120.0 , 160.0 , theme_.accent_green , 1.0 }); // stbd scale (green)
134+ zones.push_back ({ -20.0 , 20.0 , theme_.accent_no_go , 1.0 }); // no-go (caution)
135+ zones.push_back ({ -60.0 , -20.0 , theme_.accent_red , 1.0 }); // port red
136+ zones.push_back ({ 20.0 , 60.0 , theme_.accent_green , 1.0 }); // stbd green
137+
138+ zones.push_back ({-160.0 , -120.0 , theme_.accent_red , 1.0 }); // downwind port red
139+ zones.push_back ({ 120.0 , 160.0 , theme_.accent_green , 1.0 }); // downwind stbd green
114140
115141 angle_.set_zones (std::move (zones));
116142 speed_.set_zones ({});
0 commit comments