Changeset 44:f5222044879c in xplra for src
- Timestamp:
- 02/15/13 18:51:58 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/plugin/src/xplra
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/plugin/src/xplra/ListenThread.h
r38 r44 44 44 //------------------------------------------------------------------------------ 45 45 46 class MessageWindow;46 class Globals; 47 47 48 48 //------------------------------------------------------------------------------ … … 58 58 private: 59 59 /** 60 * The version of X-Plane.60 * The global objects. 61 61 */ 62 int xplaneVersion; 63 64 /** 65 * The version of the XPLM library. 66 */ 67 int xplmVersion; 68 69 /** 70 * The message window for showing messages. 71 */ 72 MessageWindow& messageWindow; 62 Globals& globals; 73 63 74 64 /** … … 92 82 * Construct the thread. 93 83 */ 94 ListenThread(int xplaneVersion, int xplmVersion, 95 MessageWindow& messageWindow); 84 ListenThread(Globals& globals); 96 85 97 86 /** 98 * Get the versions87 * Get the globals 99 88 */ 100 void getVersions(int& xplane, int& xplm) const; 101 102 /** 103 * Get the message window. 104 */ 105 MessageWindow& getMessageWindow(); 89 Globals& getGlobals(); 106 90 107 91 /** … … 120 104 //------------------------------------------------------------------------------ 121 105 122 inline ListenThread::ListenThread(int xplaneVersion, int xplmVersion, 123 MessageWindow& messageWindow) : 106 inline ListenThread::ListenThread(Globals& globals) : 124 107 Thread(true), 125 xplaneVersion(xplaneVersion), 126 xplmVersion(xplmVersion), 127 messageWindow(messageWindow), 108 globals(globals), 128 109 quitEvent(&waiter) 129 110 { … … 132 113 //------------------------------------------------------------------------------ 133 114 134 inline void ListenThread::getVersions(int& xplane, int& xplm) const115 inline Globals& ListenThread::getGlobals() 135 116 { 136 xplane = xplaneVersion; 137 xplm = xplmVersion; 138 } 139 140 //------------------------------------------------------------------------------ 141 142 inline MessageWindow& ListenThread::getMessageWindow() 143 { 144 return messageWindow; 117 return globals; 145 118 } 146 119 -
src/plugin/src/xplra/Makefile.am
r43 r44 18 18 SetMultiDataRefRequest.cc \ 19 19 ReloadPluginsRequest.cc \ 20 Globals.cc \ 20 21 MessageWindow.cc \ 21 22 MessageRequest.cc \ … … 37 38 SetMultiDataRefRequest.h \ 38 39 ReloadPluginsRequest.h \ 40 Globals.h \ 39 41 MessageWindow.h \ 40 42 MessageRequest.h \ -
src/plugin/src/xplra/ServerThread.cc
r39 r44 41 41 #include "ReloadPluginsRequest.h" 42 42 #include "MessageRequest.h" 43 #include "Globals.h" 43 44 44 45 #include <hu/varadiistvan/xplcommon/Util.h> … … 400 401 int xplmVersion = 0; 401 402 402 listenThread.get Versions(xplaneVersion, xplmVersion);403 listenThread.getGlobals().getVersions(xplaneVersion, xplmVersion); 403 404 404 405 stream.writeU8(Protocol::RESULT_OK); … … 433 434 stream.writeU8(Protocol::RESULT_INVALID_DURATION); 434 435 } else { 435 MessageRequest request(listenThread.getMessageWindow(), message, duration); 436 MessageRequest request(listenThread.getGlobals().getMessageWindow(), 437 message, duration); 436 438 if (!requestQueue.execute(&request)) return false; 437 439 -
src/plugin/src/xplra/plugin.cc
r43 r44 31 31 #include "ListenThread.h" 32 32 33 #include "MessageWindow.h" 34 #include "Menu.h" 33 #include "Globals.h" 35 34 36 35 #include <hu/varadiistvan/xplcommon/Util.h> … … 38 37 39 38 #include <XPLMDefs.h> 40 #include <XPLMUtilities.h>41 39 #include <XPLMProcessing.h> 42 40 #include <XPLMMenus.h> … … 53 51 54 52 using xplra::ListenThread; 55 using xplra::MessageWindow; 56 using xplra::Menu; 53 using xplra::Globals; 57 54 58 55 using hu::varadiistvan::xplcommon::Util; … … 61 58 62 59 /** 63 * The window to display messages from the clients.60 * The global objects. 64 61 */ 65 static MessageWindow* messageWindow = 0; 66 67 /** 68 * The menu. 69 */ 70 static Menu* menu = 0; 62 static Globals* globals = 0; 71 63 72 64 /** … … 100 92 // XPLMRegisterFlightLoopCallback(&callback, 5.0, 0); 101 93 102 int xplaneVersion = 0; 103 int xplmVersion = 0; 104 XPLMHostApplicationID hostID = 0; 105 XPLMGetVersions(&xplaneVersion, &xplmVersion, &hostID); 94 globals = new Globals(); 106 95 107 messageWindow = new MessageWindow(); 108 menu = new Menu(*messageWindow); 109 110 listenThread = new ListenThread(xplaneVersion, xplmVersion, 111 *messageWindow); 96 listenThread = new ListenThread(*globals); 112 97 listenThread->start(); 113 98 } … … 134 119 } 135 120 136 delete menu; menu = 0; 137 delete messageWindow; messageWindow = 0; 121 delete globals; globals = 0; 138 122 } 139 123
Note:
See TracChangeset
for help on using the changeset viewer.