Changeset 42:719f590e4878 in xplra for src
- Timestamp:
- 02/14/13 19:09:26 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/plugin/src/xplra
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/plugin/src/xplra/MessageWindow.cc
r38 r42 73 73 74 74 MessageWindow::MessageWindow() : 75 showForced(false), 75 76 hideTime(0.0), 76 77 duration(0.0) … … 104 105 //------------------------------------------------------------------------------ 105 106 107 void MessageWindow::show() 108 { 109 showForced = true; 110 XPLMSetWindowIsVisible(windowID, 1); 111 } 112 113 //------------------------------------------------------------------------------ 114 115 void MessageWindow::hide() 116 { 117 showForced = false; 118 } 119 120 //------------------------------------------------------------------------------ 121 106 122 void MessageWindow::drawWindow() 107 123 { … … 115 131 } 116 132 117 if (now>=hideTime) { 133 if (now>=hideTime) hideTime = 0.0; 134 135 if (hideTime==0.0 && !showForced) { 118 136 XPLMSetWindowIsVisible(windowID, 0); 119 137 } else { 120 138 XPLMDrawTranslucentDarkBox(left, top, right, bottom); 121 XPLMDrawString(colour, left + 25, top - 15, 122 const_cast<char*>(displayedMessage.c_str()), 0, 123 xplmFont_Basic); 139 if (hideTime!=0.0) { 140 XPLMDrawString(colour, left + 25, top - 15, 141 const_cast<char*>(displayedMessage.c_str()), 0, 142 xplmFont_Basic); 143 } 124 144 } 125 145 } -
src/plugin/src/xplra/MessageWindow.h
r38 r42 105 105 106 106 /** 107 * Indicate if the message window should be shown 108 */ 109 bool showForced; 110 111 /** 107 112 * The currently displayed message. 108 113 */ … … 144 149 */ 145 150 ~MessageWindow(); 151 152 /** 153 * Force showing the message window. 154 */ 155 void show(); 156 157 /** 158 * Hide the message window if it does not have to display an 159 * actual message. 160 */ 161 void hide(); 146 162 147 163 private: -
src/plugin/src/xplra/plugin.cc
r38 r42 39 39 #include <XPLMUtilities.h> 40 40 #include <XPLMProcessing.h> 41 #include <XPLMMenus.h> 41 42 42 43 #include <cstdio> … … 66 67 */ 67 68 static ListenThread* listenThread = 0; 69 70 /** 71 * The ID of the menu of the plugin. 72 */ 73 static XPLMMenuID menuID = 0; 74 75 /** 76 * The index of the show message area menu item. 77 */ 78 static int showMessageAreaIndex = 0; 79 80 //------------------------------------------------------------------------------ 81 82 static void menuHandler(void* /*menuRef*/, void* /*itemRef*/) 83 { 84 // Util::debug("hu.varadiistvan.xplra menuHandler called\n"); 85 XPLMMenuCheck checked = xplm_Menu_NoCheck; 86 XPLMCheckMenuItemState(menuID, showMessageAreaIndex, &checked); 87 if (checked==xplm_Menu_Unchecked) { 88 XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Checked); 89 messageWindow->show(); 90 } else if (checked==xplm_Menu_Checked) { 91 XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Unchecked); 92 messageWindow->hide(); 93 } 94 } 68 95 69 96 //------------------------------------------------------------------------------ … … 96 123 XPLMHostApplicationID hostID = 0; 97 124 XPLMGetVersions(&xplaneVersion, &xplmVersion, &hostID); 125 126 int menuIndex = XPLMAppendMenuItem(XPLMFindPluginsMenu(), 127 "Remote Access", NULL, 1); 128 menuID = XPLMCreateMenu("Remote Access", XPLMFindPluginsMenu(), menuIndex, 129 &menuHandler, 0); 130 showMessageAreaIndex = XPLMAppendMenuItem(menuID, "Show message area", 131 0, 1); 132 XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Unchecked); 98 133 99 134 messageWindow = new MessageWindow();
Note:
See TracChangeset
for help on using the changeset viewer.