]> git.mxchange.org Git - flightgear.git/commitdiff
Fix line endings
authorfredb <fredb>
Sat, 18 Feb 2006 16:54:35 +0000 (16:54 +0000)
committerfredb <fredb>
Sat, 18 Feb 2006 16:54:35 +0000 (16:54 +0000)
src/Instrumentation/KLN89/kln89_page.cxx
src/Instrumentation/KLN89/kln89_page.hxx

index ee4e65bcd6623aac689f43d081c622941357289b..53fa3b1c35478d2bcfaff7a3262007745d682827 100644 (file)
-// kln89_page.cxx - base class for the "pages" that\r
-//                  are used in the KLN89 GPS unit simulation. \r
-//\r
-// Written by David Luff, started 2005.\r
-//\r
-// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk\r
-//\r
-// This program is free software; you can redistribute it and/or\r
-// modify it under the terms of the GNU General Public License as\r
-// published by the Free Software Foundation; either version 2 of the\r
-// License, or (at your option) any later version.\r
-//\r
-// This program is distributed in the hope that it will be useful, but\r
-// WITHOUT ANY WARRANTY; without even the implied warranty of\r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
-// General Public License for more details.\r
-//\r
-// You should have received a copy of the GNU General Public License\r
-// along with this program; if not, write to the Free Software\r
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
-//\r
-// $Id$\r
-\r
-#include "kln89_page.hxx"\r
-#include <Main/fg_props.hxx>\r
-\r
-KLN89Page::KLN89Page(KLN89* parent) \r
-: GPSPage(parent) {\r
-       _kln89 = (KLN89*)parent;\r
-       _entInvert = false;\r
-       _to_flag = true;\r
-}\r
-\r
-KLN89Page::~KLN89Page() {\r
-}\r
-\r
-void KLN89Page::Update(double dt) {\r
-       bool crsr = (_kln89->_mode == KLN89_MODE_CRSR ? true : false);\r
-       bool nav1 = (_name == "NAV" && _subPage == 0);\r
-       bool nav4 = (_name == "NAV" && _subPage == 3);\r
-       // The extra level of check for the ACT page is necessary since\r
-       // ACT is implemented by using the other waypoint pages as\r
-       // appropriate.\r
-       bool act = (_kln89->_activePage->GetName() == "ACT");\r
-       _kln89->DrawDivider();\r
-       if(crsr) {\r
-               if(!nav4) _kln89->DrawText("*CRSR*", 1, 0, 0);\r
-               if(_uLinePos == 0) _kln89->Underline(1, 3, 1, 3);\r
-       } else {\r
-               if(!nav4) {\r
-                       if(act) {\r
-                               _kln89->DrawText("ACT", 1, 0, 0);\r
-                       } else {\r
-                               _kln89->DrawText(_name, 1, 0, 0);\r
-                       }\r
-                       if(_name == "DIR") {\r
-                               // Don't draw a subpage number\r
-                       } else if(_name == "USR" || _name == "FPL") {\r
-                               // Zero-based\r
-                               _kln89->DrawText(GPSitoa(_subPage), 1, 4, 0);\r
-                       } else {\r
-                               // One-based\r
-                               _kln89->DrawText(GPSitoa(_subPage+1), 1, 4, 0);\r
-                       }\r
-               }\r
-       }\r
-       if(crsr && _uLinePos == 0 && _kln89->_blink) {\r
-               // Don't draw\r
-       } else {\r
-               if(_kln89->_obsMode) {\r
-                       _kln89->DrawText(GPSitoa(_kln89->_obsHeading), 1, 3, 1);\r
-               } else {\r
-                       _kln89->DrawText("Leg", 1, 3, 1);\r
-               }\r
-       }\r
-       _kln89->DrawText((_kln89->GetDistVelUnitsSI() ? "km" : "nm"), 1, 4, 3);\r
-       GPSWaypoint* awp = _parent->GetActiveWaypoint();\r
-       if(_kln89->_navFlagged) {\r
-               _kln89->DrawText("--.-", 1, 0 ,3);\r
-               // Only nav1 still gets speed drawn if nav is flagged - not ACT\r
-               if(!nav1) _kln89->DrawText("------", 1, 0, 2);\r
-       } else {\r
-               char buf[8];\r
-               float f = _parent->GetDistToActiveWaypoint() * (_kln89->GetDistVelUnitsSI() ? 0.001 : SG_METER_TO_NM);\r
-               snprintf(buf, 5, (f >= 100.0 ? "%4.0f" : "%4.1f"), f);\r
-               string s = buf;\r
-               _kln89->DrawText(s, 1, 4 - s.size(), 3, true);\r
-               // Draw active waypoint ID, except for\r
-               // nav1, act, and any waypoint pages matching \r
-               // active waypoint that need speed drawn instead.\r
-               if(act || nav1 || (awp && awp->id == _id)) {\r
-                       _kln89->DrawSpeed(_kln89->_groundSpeed_kts, 1, 5, 2);\r
-               } else {\r
-                       if(!(_kln89->_waypointAlert && _kln89->_blink)) _kln89->DrawText(awp->id, 1, 0, 2);\r
-               }\r
-       }\r
-       /*\r
-       if(_noNrst) {\r
-               _kln89->DrawText("  No  ", 1, 0, 1, false, 99);\r
-               _kln89->DrawText(" Nrst ", 1, 0, 0, false, 99);\r
-       }\r
-       */\r
-       if(_scratchpadMsg) {\r
-               _kln89->DrawText(_scratchpadLine1, 1, 0, 1, false, 99);\r
-               _kln89->DrawText(_scratchpadLine2, 1, 0, 0, false, 99);\r
-               _scratchpadTimer += dt;\r
-               if(_scratchpadTimer > 4.0) {\r
-                       _scratchpadMsg = false;\r
-                       _scratchpadTimer = 0.0;\r
-               }\r
-       }\r
-}\r
-\r
-void KLN89Page::ShowScratchpadMessage(const string& line1, const string& line2) {\r
-       _scratchpadLine1 = line1;\r
-       _scratchpadLine2 = line2;\r
-       _scratchpadTimer = 0.0;\r
-       _scratchpadMsg = true;\r
-}      \r
-\r
-void KLN89Page::Knob1Left1() {\r
-       if(_kln89->_mode == KLN89_MODE_CRSR) {\r
-               if(_uLinePos > 0) _uLinePos--;\r
-       }\r
-}\r
-\r
-void KLN89Page::Knob1Right1() {\r
-       if(_kln89->_mode == KLN89_MODE_CRSR) {\r
-               if(_uLinePos < _maxULinePos) _uLinePos++;\r
-       }\r
-}\r
-\r
-void KLN89Page::Knob2Left1() {\r
-       if(_kln89->_mode != KLN89_MODE_CRSR && !fgGetBool("/instrumentation/kln89/scan-pull")) {\r
-               GPSPage::Knob2Left1(); \r
-       } else {\r
-               if(_uLinePos == 0 && _kln89->_obsMode) {\r
-                       _kln89->_obsHeading--;\r
-                       if(_kln89->_obsHeading < 0) {\r
-                               _kln89->_obsHeading += 360;\r
-                       }\r
-                       _kln89->SetOBSFromWaypoint();\r
-               }\r
-       }\r
-}\r
-\r
-void KLN89Page::Knob2Right1() {\r
-       if(_kln89->_mode != KLN89_MODE_CRSR && !fgGetBool("/instrumentation/kln89/scan-pull")) {\r
-               GPSPage::Knob2Right1(); \r
-       } else {\r
-               if(_uLinePos == 0 && _kln89->_obsMode) {\r
-                       _kln89->_obsHeading++;\r
-                       if(_kln89->_obsHeading > 359) {\r
-                               _kln89->_obsHeading -= 360;\r
-                       }\r
-                       _kln89->SetOBSFromWaypoint();\r
-               }\r
-       }\r
-}\r
-\r
-void KLN89Page::CrsrPressed() {\r
-       // Stick some sensible defaults in\r
-       if(_kln89->_obsMode) {\r
-               _uLinePos = 0;\r
-       } else {\r
-               _uLinePos = 1;\r
-       }\r
-       _maxULinePos = 1;\r
-}\r
-\r
-void KLN89Page::EntPressed() {}\r
-void KLN89Page::ClrPressed() {}\r
-void KLN89Page::DtoPressed() {}\r
-void KLN89Page::NrstPressed() {}\r
-void KLN89Page::AltPressed() {}\r
-\r
-void KLN89Page::OBSPressed() {\r
-       if(_kln89->_obsMode) {\r
-               // If ORS2 and not slaved to gps\r
-               _uLinePos = 0;\r
-       } else {\r
-               // Don't leave the cursor on in the leg position.\r
-               if(_uLinePos == 0) {\r
-                       _kln89->_mode = KLN89_MODE_DISP;\r
-               }\r
-       }\r
-}\r
-\r
-void KLN89Page::MsgPressed() {}\r
-\r
-void KLN89Page::CleanUp() {\r
-       _kln89->_cleanUpPage = -1;\r
-}\r
-\r
-void KLN89Page::LooseFocus() {\r
-       _entInvert = false;\r
-}\r
-\r
-void KLN89Page::SetId(const string& s) {\r
-       _id = s;\r
-}\r
-\r
-const string& KLN89Page::GetId() {\r
-       return(_id);\r
-}\r
+// kln89_page.cxx - base class for the "pages" that
+//                  are used in the KLN89 GPS unit simulation. 
+//
+// Written by David Luff, started 2005.
+//
+// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// $Id$
+
+#include "kln89_page.hxx"
+#include <Main/fg_props.hxx>
+
+KLN89Page::KLN89Page(KLN89* parent) 
+: GPSPage(parent) {
+       _kln89 = (KLN89*)parent;
+       _entInvert = false;
+       _to_flag = true;
+}
+
+KLN89Page::~KLN89Page() {
+}
+
+void KLN89Page::Update(double dt) {
+       bool crsr = (_kln89->_mode == KLN89_MODE_CRSR ? true : false);
+       bool nav1 = (_name == "NAV" && _subPage == 0);
+       bool nav4 = (_name == "NAV" && _subPage == 3);
+       // The extra level of check for the ACT page is necessary since
+       // ACT is implemented by using the other waypoint pages as
+       // appropriate.
+       bool act = (_kln89->_activePage->GetName() == "ACT");
+       _kln89->DrawDivider();
+       if(crsr) {
+               if(!nav4) _kln89->DrawText("*CRSR*", 1, 0, 0);
+               if(_uLinePos == 0) _kln89->Underline(1, 3, 1, 3);
+       } else {
+               if(!nav4) {
+                       if(act) {
+                               _kln89->DrawText("ACT", 1, 0, 0);
+                       } else {
+                               _kln89->DrawText(_name, 1, 0, 0);
+                       }
+                       if(_name == "DIR") {
+                               // Don't draw a subpage number
+                       } else if(_name == "USR" || _name == "FPL") {
+                               // Zero-based
+                               _kln89->DrawText(GPSitoa(_subPage), 1, 4, 0);
+                       } else {
+                               // One-based
+                               _kln89->DrawText(GPSitoa(_subPage+1), 1, 4, 0);
+                       }
+               }
+       }
+       if(crsr && _uLinePos == 0 && _kln89->_blink) {
+               // Don't draw
+       } else {
+               if(_kln89->_obsMode) {
+                       _kln89->DrawText(GPSitoa(_kln89->_obsHeading), 1, 3, 1);
+               } else {
+                       _kln89->DrawText("Leg", 1, 3, 1);
+               }
+       }
+       _kln89->DrawText((_kln89->GetDistVelUnitsSI() ? "km" : "nm"), 1, 4, 3);
+       GPSWaypoint* awp = _parent->GetActiveWaypoint();
+       if(_kln89->_navFlagged) {
+               _kln89->DrawText("--.-", 1, 0 ,3);
+               // Only nav1 still gets speed drawn if nav is flagged - not ACT
+               if(!nav1) _kln89->DrawText("------", 1, 0, 2);
+       } else {
+               char buf[8];
+               float f = _parent->GetDistToActiveWaypoint() * (_kln89->GetDistVelUnitsSI() ? 0.001 : SG_METER_TO_NM);
+               snprintf(buf, 5, (f >= 100.0 ? "%4.0f" : "%4.1f"), f);
+               string s = buf;
+               _kln89->DrawText(s, 1, 4 - s.size(), 3, true);
+               // Draw active waypoint ID, except for
+               // nav1, act, and any waypoint pages matching 
+               // active waypoint that need speed drawn instead.
+               if(act || nav1 || (awp && awp->id == _id)) {
+                       _kln89->DrawSpeed(_kln89->_groundSpeed_kts, 1, 5, 2);
+               } else {
+                       if(!(_kln89->_waypointAlert && _kln89->_blink)) _kln89->DrawText(awp->id, 1, 0, 2);
+               }
+       }
+       /*
+       if(_noNrst) {
+               _kln89->DrawText("  No  ", 1, 0, 1, false, 99);
+               _kln89->DrawText(" Nrst ", 1, 0, 0, false, 99);
+       }
+       */
+       if(_scratchpadMsg) {
+               _kln89->DrawText(_scratchpadLine1, 1, 0, 1, false, 99);
+               _kln89->DrawText(_scratchpadLine2, 1, 0, 0, false, 99);
+               _scratchpadTimer += dt;
+               if(_scratchpadTimer > 4.0) {
+                       _scratchpadMsg = false;
+                       _scratchpadTimer = 0.0;
+               }
+       }
+}
+
+void KLN89Page::ShowScratchpadMessage(const string& line1, const string& line2) {
+       _scratchpadLine1 = line1;
+       _scratchpadLine2 = line2;
+       _scratchpadTimer = 0.0;
+       _scratchpadMsg = true;
+}      
+
+void KLN89Page::Knob1Left1() {
+       if(_kln89->_mode == KLN89_MODE_CRSR) {
+               if(_uLinePos > 0) _uLinePos--;
+       }
+}
+
+void KLN89Page::Knob1Right1() {
+       if(_kln89->_mode == KLN89_MODE_CRSR) {
+               if(_uLinePos < _maxULinePos) _uLinePos++;
+       }
+}
+
+void KLN89Page::Knob2Left1() {
+       if(_kln89->_mode != KLN89_MODE_CRSR && !fgGetBool("/instrumentation/kln89/scan-pull")) {
+               GPSPage::Knob2Left1(); 
+       } else {
+               if(_uLinePos == 0 && _kln89->_obsMode) {
+                       _kln89->_obsHeading--;
+                       if(_kln89->_obsHeading < 0) {
+                               _kln89->_obsHeading += 360;
+                       }
+                       _kln89->SetOBSFromWaypoint();
+               }
+       }
+}
+
+void KLN89Page::Knob2Right1() {
+       if(_kln89->_mode != KLN89_MODE_CRSR && !fgGetBool("/instrumentation/kln89/scan-pull")) {
+               GPSPage::Knob2Right1(); 
+       } else {
+               if(_uLinePos == 0 && _kln89->_obsMode) {
+                       _kln89->_obsHeading++;
+                       if(_kln89->_obsHeading > 359) {
+                               _kln89->_obsHeading -= 360;
+                       }
+                       _kln89->SetOBSFromWaypoint();
+               }
+       }
+}
+
+void KLN89Page::CrsrPressed() {
+       // Stick some sensible defaults in
+       if(_kln89->_obsMode) {
+               _uLinePos = 0;
+       } else {
+               _uLinePos = 1;
+       }
+       _maxULinePos = 1;
+}
+
+void KLN89Page::EntPressed() {}
+void KLN89Page::ClrPressed() {}
+void KLN89Page::DtoPressed() {}
+void KLN89Page::NrstPressed() {}
+void KLN89Page::AltPressed() {}
+
+void KLN89Page::OBSPressed() {
+       if(_kln89->_obsMode) {
+               // If ORS2 and not slaved to gps
+               _uLinePos = 0;
+       } else {
+               // Don't leave the cursor on in the leg position.
+               if(_uLinePos == 0) {
+                       _kln89->_mode = KLN89_MODE_DISP;
+               }
+       }
+}
+
+void KLN89Page::MsgPressed() {}
+
+void KLN89Page::CleanUp() {
+       _kln89->_cleanUpPage = -1;
+}
+
+void KLN89Page::LooseFocus() {
+       _entInvert = false;
+}
+
+void KLN89Page::SetId(const string& s) {
+       _id = s;
+}
+
+const string& KLN89Page::GetId() {
+       return(_id);
+}
index 9794c4e012c654141aaa485bede57e1aa68e1942..b5e854b681b20097436e0e036f15fbd2b6aaa130 100644 (file)
@@ -1,93 +1,93 @@
-// kln89_page.hxx - base class for the "pages" that\r
-//                  are used in the KLN89 GPS unit simulation. \r
-//\r
-// Written by David Luff, started 2005.\r
-//\r
-// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk\r
-//\r
-// This program is free software; you can redistribute it and/or\r
-// modify it under the terms of the GNU General Public License as\r
-// published by the Free Software Foundation; either version 2 of the\r
-// License, or (at your option) any later version.\r
-//\r
-// This program is distributed in the hope that it will be useful, but\r
-// WITHOUT ANY WARRANTY; without even the implied warranty of\r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
-// General Public License for more details.\r
-//\r
-// You should have received a copy of the GNU General Public License\r
-// along with this program; if not, write to the Free Software\r
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
-//\r
-// $Id$\r
-\r
-#ifndef _KLN89_PAGE_HXX\r
-#define _KLN89_PAGE_HXX\r
-\r
-#include <Instrumentation/dclgps.hxx>\r
-#include "kln89.hxx"\r
-\r
-class KLN89;\r
-\r
-class KLN89Page : public GPSPage {\r
-\r
-public:\r
-       KLN89Page(KLN89* parent);\r
-       virtual ~KLN89Page();\r
-       virtual void Update(double dt);\r
-       virtual void Knob1Left1();\r
-       virtual void Knob1Right1();\r
-       virtual void Knob2Left1();\r
-       virtual void Knob2Right1();\r
-       virtual void CrsrPressed();\r
-       virtual void EntPressed();\r
-       virtual void ClrPressed();\r
-       // Even though some/all of the buttons below aren't processed directly by the current page,\r
-       // the current page often needs to save or change some state when they are pressed, and \r
-       // hence should provide a function to handle them.\r
-       virtual void DtoPressed();\r
-       virtual void NrstPressed();\r
-       virtual void AltPressed();\r
-       virtual void OBSPressed();\r
-       virtual void MsgPressed();\r
-       \r
-       // See base class comments for this.\r
-       virtual void CleanUp();\r
-       \r
-       // ditto\r
-       virtual void LooseFocus();\r
-       \r
-       inline void SetEntInvert(bool b) { _entInvert = b; }\r
-       \r
-       // Get / Set a waypoint id, NOT the page name!\r
-       virtual void SetId(const string& s);\r
-       virtual const string& GetId();\r
-       \r
-protected:\r
-       KLN89* _kln89;\r
-       \r
-       // Underline position in cursor mode is not persistant when subpage is changed - hence we only need one variable per page for it.\r
-       // Note that pos 0 is special - this is the leg pos in field 1, so pos will normally be set to 1 when crsr is pressed.\r
-       // Also note that in general it doesn't seem to wrap.\r
-       unsigned int _uLinePos;\r
-       unsigned int _maxULinePos;\r
-       \r
-       // This is NOT the main gps to/from flag - derived page classes can use this flag\r
-       // for any purpose, typically whether a radial bearing should be displayed to or from.\r
-       bool _to_flag;  // true for TO, false for FROM\r
-       \r
-       // Invert ID and display ENT in field 1\r
-       bool _entInvert;\r
-       \r
-       string _id;             // The ID of the waypoint that the page is displaying.\r
-                                       // Doesn't make sense for all pages, but does for all the data pages.\r
-                                       \r
-       void ShowScratchpadMessage(const string& line1, const string& line2);\r
-                                       \r
-       bool _scratchpadMsg;            // Set true when there is a scratchpad message to display\r
-       double _scratchpadTimer;        // Used for displaying the scratchpad messages for the right amount of time.\r
-       string _scratchpadLine1;\r
-       string _scratchpadLine2;\r
-};\r
-\r
-#endif // _KLN89_PAGE_HXX\r
+// kln89_page.hxx - base class for the "pages" that
+//                  are used in the KLN89 GPS unit simulation. 
+//
+// Written by David Luff, started 2005.
+//
+// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// $Id$
+
+#ifndef _KLN89_PAGE_HXX
+#define _KLN89_PAGE_HXX
+
+#include <Instrumentation/dclgps.hxx>
+#include "kln89.hxx"
+
+class KLN89;
+
+class KLN89Page : public GPSPage {
+
+public:
+       KLN89Page(KLN89* parent);
+       virtual ~KLN89Page();
+       virtual void Update(double dt);
+       virtual void Knob1Left1();
+       virtual void Knob1Right1();
+       virtual void Knob2Left1();
+       virtual void Knob2Right1();
+       virtual void CrsrPressed();
+       virtual void EntPressed();
+       virtual void ClrPressed();
+       // Even though some/all of the buttons below aren't processed directly by the current page,
+       // the current page often needs to save or change some state when they are pressed, and 
+       // hence should provide a function to handle them.
+       virtual void DtoPressed();
+       virtual void NrstPressed();
+       virtual void AltPressed();
+       virtual void OBSPressed();
+       virtual void MsgPressed();
+       
+       // See base class comments for this.
+       virtual void CleanUp();
+       
+       // ditto
+       virtual void LooseFocus();
+       
+       inline void SetEntInvert(bool b) { _entInvert = b; }
+       
+       // Get / Set a waypoint id, NOT the page name!
+       virtual void SetId(const string& s);
+       virtual const string& GetId();
+       
+protected:
+       KLN89* _kln89;
+       
+       // Underline position in cursor mode is not persistant when subpage is changed - hence we only need one variable per page for it.
+       // Note that pos 0 is special - this is the leg pos in field 1, so pos will normally be set to 1 when crsr is pressed.
+       // Also note that in general it doesn't seem to wrap.
+       unsigned int _uLinePos;
+       unsigned int _maxULinePos;
+       
+       // This is NOT the main gps to/from flag - derived page classes can use this flag
+       // for any purpose, typically whether a radial bearing should be displayed to or from.
+       bool _to_flag;  // true for TO, false for FROM
+       
+       // Invert ID and display ENT in field 1
+       bool _entInvert;
+       
+       string _id;             // The ID of the waypoint that the page is displaying.
+                                       // Doesn't make sense for all pages, but does for all the data pages.
+                                       
+       void ShowScratchpadMessage(const string& line1, const string& line2);
+                                       
+       bool _scratchpadMsg;            // Set true when there is a scratchpad message to display
+       double _scratchpadTimer;        // Used for displaying the scratchpad messages for the right amount of time.
+       string _scratchpadLine1;
+       string _scratchpadLine2;
+};
+
+#endif // _KLN89_PAGE_HXX