MOOS 0.2375
|
00001 00002 // 00003 // MOOS - Mission Oriented Operating Suite 00004 // 00005 // A suit of Applications and Libraries for Mobile Robotics Research 00006 // Copyright (C) 2001-2005 Massachusetts Institute of Technology and 00007 // Oxford University. 00008 // 00009 // This software was written by Paul Newman at MIT 2001-2002 and Oxford 00010 // University 2003-2005. email: pnewman@robots.ox.ac.uk. 00011 // 00012 // This file is part of a MOOS Utility Component. 00013 // 00014 // This program is free software; you can redistribute it and/or 00015 // modify it under the terms of the GNU General Public License as 00016 // published by the Free Software Foundation; either version 2 of the 00017 // License, or (at your option) any later version. 00018 // 00019 // This program is distributed in the hope that it will be useful, 00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00022 // General Public License for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License 00025 // along with this program; if not, write to the Free Software 00026 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00027 // 02111-1307, USA. 00028 // 00030 // ScopeTabPane.h: interface for the CScopeTabPane class. 00031 00032 // 00033 00035 00036 #ifdef _WIN32 00037 00038 #pragma warning(disable : 4786) 00039 00040 #endif 00041 00042 00043 00044 #if !defined(AFX_SCOPETABPANE_H__8ED1A25B_2FF0_4D44_A7DB_D9DF331642BA__INCLUDED_) 00045 00046 #define AFX_SCOPETABPANE_H__8ED1A25B_2FF0_4D44_A7DB_D9DF331642BA__INCLUDED_ 00047 00048 00049 00050 #if _MSC_VER > 1000 00051 #pragma once 00052 #endif // _MSC_VER > 1000 00053 #include <FL/Fl.H> 00054 #include <FL/Fl_Group.H> 00055 #include <FL/Fl_Browser.H> 00056 #include <FL/Fl_Hold_Browser.H> 00057 #include <FL/Fl_Check_Browser.H> 00058 #include <FL/Fl_Button.H> 00059 #include <FL/Fl_Input.H> 00060 #include <FL/Fl_Int_Input.H> 00061 #include <FLTKVW/MOOSFLTKUI.h> 00062 #include "ScopeGrid.h" 00063 #include "DBImage.h" 00064 #include <vector> 00065 #include <map> 00066 #include <MOOSLIB/MOOSLib.h> 00067 #include <MOOSUtilityLib/MOOSThread.h> 00068 00069 00070 00071 00072 class CScopeTabPane : public CMOOSFLTKUI 00073 00074 { 00075 00076 public: 00077 CScopeTabPane( int X, int Y, int W, int H, char *l=0 ); 00078 virtual ~CScopeTabPane(); 00079 static bool MOOSDisconnectCallback(void * pParam); 00080 static bool MOOSConnectCallback(void * pParam); 00081 bool OnMOOSConnect(); 00082 bool OnMOOSDisconnect(); 00083 void GetMOOSInfo(std::string & sHost,int &nPort) 00084 { 00085 nPort = (int)m_lPort; 00086 sHost = m_sHost; 00087 } 00088 void SetMOOSInfo(const std::string & sHost,int nPort) 00089 { 00090 m_lPort = (long)nPort; 00091 m_sHost = sHost; 00092 m_pDBHostInput->value(sHost.c_str()); 00093 m_pDBPortInput->value(MOOSFormat("%d",nPort).c_str()); 00094 00095 } 00096 00097 static bool FetchWorker(void* pParam) 00098 { 00099 CScopeTabPane* pMe = (CScopeTabPane*)pParam; 00100 return pMe->FetchLoop(); 00101 } 00102 00103 00104 00105 private: 00106 00107 typedef CMOOSFLTKUI BASE; 00108 enum UI_IDS 00109 { 00110 ID_PROCESS, 00111 ID_CONNECT, 00112 ID_SHOW_PENDING, 00113 }; 00114 00115 Fl_Button *m_pConnectButton; 00116 Fl_Input *m_pDBHostInput; 00117 Fl_Int_Input *m_pDBPortInput; 00118 CScopeGrid * m_pScopeGrid; 00119 Fl_Check_Browser *m_pProcessList; 00120 //Fl_Hold_Browser *m_pProcessList; 00121 Fl_Browser *m_pSubscribeList; 00122 Fl_Browser *m_pPublishList; 00123 00124 00125 00126 protected: 00127 00128 00129 class ProcessOptions 00130 { 00131 public: 00132 bool m_bShow; 00133 bool m_bUpdated; 00134 ProcessOptions(){m_bShow = true;m_bUpdated = true;}; 00135 }; 00136 00137 std::map<std::string,ProcessOptions> m_ProcessOptions; 00138 00139 virtual void OnControlWidget(Fl_Widget* pWidget,int ID); 00140 void OnTimer(); 00141 bool GetDBSummary(); 00142 bool GetDBProcSummary(); 00143 00144 std::string m_sHost; 00145 long m_lPort; 00146 CMOOSCommClient m_Comms; 00147 CDBImage m_DBImage; 00148 00149 bool FetchLoop(); 00150 CMOOSThread m_FetchThread; 00151 00152 std::string GetFocusProcess(); 00153 void SetMask(); 00154 00155 int m_nCounts; 00156 }; 00157 00158 00159 00160 #endif // !defined(AFX_SCOPETABPANE_H__8ED1A25B_2FF0_4D44_A7DB_D9DF331642BA__INCLUDED_) 00161