]> git.mxchange.org Git - flightgear.git/commitdiff
KLN89: Allow user to set default first char of waypoint as per real life unit.
authorDave Luff <daveluff@ntlworld.com>
Mon, 6 Dec 2010 22:50:37 +0000 (22:50 +0000)
committerDave Luff <daveluff@ntlworld.com>
Mon, 6 Dec 2010 22:50:37 +0000 (22:50 +0000)
src/Instrumentation/KLN89/kln89.cxx
src/Instrumentation/KLN89/kln89.hxx
src/Instrumentation/KLN89/kln89_page_fpl.cxx
src/Instrumentation/KLN89/kln89_page_set.cxx

index 57985a729225ff467e92d60849130018bd244727..7e0a1834e2e5a7eae0b59921c95e6e3d20acb574 100644 (file)
@@ -228,6 +228,7 @@ KLN89::KLN89(RenderArea2D* instrument)
        _suaAlertEnabled = false;
        _altAlertEnabled = false;
        _minDisplayBrightness = 4;
+       _defaultFirstChar = 'A';
        
        // Mega-hack - hardwire airport town and state names for the FG base area since we don't have any data for these at the moment
        // TODO - do this better one day!
index 052d1b90c3b78aa3322314c53ed48ee298d47fa1..f242b71b71ce6ef5beb0def932957507ed6879d7 100644 (file)
@@ -302,6 +302,7 @@ private:
        bool _suaAlertEnabled;          // Alert user to potential SUA entry
        bool _altAlertEnabled;          // Alert user to min safe alt violation
        int _minDisplayBrightness;      // Minimum display brightness in low light.
+       char _defaultFirstChar;         // Default first waypoint character.
 };
 
 #endif  // _KLN89_HXX
index 0cb8d13b8df9fbd46cc11ebb6ccde23117c0feda..b48f957bcb672404033a0e0bf6f2fcf678d84ad2 100644 (file)
@@ -1013,7 +1013,11 @@ void KLN89FplPage::Knob2Left1() {
             } else if(appWp) {
                 ShowScratchpadMessage("Invald", " Add  ");
             } else {
-                if((_wLinePos + 1) > _entWpStr.size()) {
+                if(!_entWpStr.size()) {
+                    _entWpStr += _kln89->DecChar(_kln89->_defaultFirstChar, false, true);
+                } else if((_wLinePos + 1) > _entWpStr.size()) {
+                    // I don't think we can ever reach this state since I think it only ever applies to the
+                    // first char and gets caught by the line above, but it can stay for now just in case.
                     _entWpStr += '9';
                 } else {
                     _entWpStr[_wLinePos] = _kln89->DecChar(_entWpStr[_wLinePos], (_wLinePos == 0 ? false : true));
@@ -1093,7 +1097,11 @@ void KLN89FplPage::Knob2Right1() {
             } else if(appWp) {
                 ShowScratchpadMessage("Invald", " Add  ");
             } else {
-                if((_wLinePos + 1) > _entWpStr.size()) {
+                if(!_entWpStr.size()) {
+                    _entWpStr += _kln89->_defaultFirstChar;
+                } else if((_wLinePos + 1) > _entWpStr.size()) {
+                    // I don't think we can ever reach this state since I think it only ever applies to the
+                    // first char and gets caught by the line above, but it can stay for now just in case.
                     _entWpStr += 'A';
                 } else {
                     _entWpStr[_wLinePos] = _kln89->IncChar(_entWpStr[_wLinePos], (_wLinePos == 0 ? false : true));
index 3ab3228d77df35a0f2642713908092ea75104108..8ec82807b2b15c7b356f68913a7dec79fe3298ac 100644 (file)
@@ -76,6 +76,14 @@ void KLN89SetPage::Update(double dt) {
                _kln89->DrawText("Character of", 2, 1, 2);
                _kln89->DrawText("Wpt identifier", 2, 0, 1);
                _kln89->DrawText("Entry:", 2, 3, 0);
+               if(_kln89->_mode == KLN89_MODE_CRSR && _uLinePos == 1) {
+                       if(!_kln89->_blink) {
+                               _kln89->DrawChar(_kln89->_defaultFirstChar, 2, 10, 0);
+                       }
+                       _kln89->Underline(2, 10, 0, 1);
+               } else {
+                       _kln89->DrawChar(_kln89->_defaultFirstChar, 2, 10, 0);
+               }
                break;
        case 6:
                _kln89->DrawText("NEAREST APT", 2, 1, 3);
@@ -203,6 +211,7 @@ void KLN89SetPage::CrsrPressed() {
                _maxULinePos = 1;
                break;
        case 5:
+               _maxULinePos = 1;
                break;
        case 6:
                _maxULinePos = 2;
@@ -241,6 +250,9 @@ void KLN89SetPage::Knob2Left1() {
                        }
                        break;
                case 5:
+                       if(_uLinePos == 1) {
+                               _kln89->_defaultFirstChar = _kln89->DecChar(_kln89->_defaultFirstChar, false, true);
+                       }
                        break;
                case 6:
                        break;
@@ -287,6 +299,9 @@ void KLN89SetPage::Knob2Right1() {
                        }
                        break;
                case 5:
+                       if(_uLinePos == 1) {
+                               _kln89->_defaultFirstChar = _kln89->IncChar(_kln89->_defaultFirstChar, false, true);
+                       }
                        break;
                case 6:
                        break;