Changeset 47:411a69092798 in xplra
- Timestamp:
- 02/16/13 09:24:42 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/plugin/src/xplra
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/plugin/src/xplra/Menu.cc
r43 r47 39 39 //------------------------------------------------------------------------------ 40 40 41 void* const Menu::showMessageAreaRef = reinterpret_cast<void*>(1); 42 43 void* const Menu::resetMessageAreaRef = reinterpret_cast<void*>(2); 44 45 //------------------------------------------------------------------------------ 46 41 47 void Menu::menuHandlerCallback(void* menuRef, void* itemRef) 42 48 { … … 58 64 &menuHandlerCallback, this); 59 65 showMessageAreaIndex = XPLMAppendMenuItem(menuID, "Show message area", 60 0, 1);66 showMessageAreaRef, 1); 61 67 XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Unchecked); 68 XPLMAppendMenuItem(menuID, "Reset message area", resetMessageAreaRef, 1); 62 69 } 63 70 64 71 //------------------------------------------------------------------------------ 65 72 66 void Menu::handleMenu(void* /*itemRef*/)73 void Menu::handleMenu(void* itemRef) 67 74 { 68 XPLMMenuCheck checked = xplm_Menu_NoCheck; 69 XPLMCheckMenuItemState(menuID, showMessageAreaIndex, &checked); 70 if (checked==xplm_Menu_Unchecked) { 71 XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Checked); 72 messageWindow.show(); 73 } else if (checked==xplm_Menu_Checked) { 74 XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Unchecked); 75 messageWindow.hide(); 75 if (itemRef==showMessageAreaRef) { 76 XPLMMenuCheck checked = xplm_Menu_NoCheck; 77 XPLMCheckMenuItemState(menuID, showMessageAreaIndex, &checked); 78 if (checked==xplm_Menu_Unchecked) { 79 XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Checked); 80 messageWindow.show(); 81 } else if (checked==xplm_Menu_Checked) { 82 XPLMCheckMenuItem(menuID, showMessageAreaIndex, xplm_Menu_Unchecked); 83 messageWindow.hide(); 84 } 85 } else if (itemRef==resetMessageAreaRef) { 86 messageWindow.reset(); 76 87 } 77 88 } -
src/plugin/src/xplra/Menu.h
r43 r47 55 55 56 56 /** 57 * Item reference for the show message area menu item. 58 */ 59 static void* const showMessageAreaRef; 60 61 /** 62 * Item reference for the show message area menu item. 63 */ 64 static void* const resetMessageAreaRef; 65 66 /** 57 67 * Reference to the message window. 58 68 */ -
src/plugin/src/xplra/MessageWindow.cc
r46 r47 80 80 heightDataRef = XPLMFindDataRef("sim/graphics/view/window_height"); 81 81 82 int screenWidth = XPLMGetDatai(widthDataRef); 83 int screenHeight = XPLMGetDatai(heightDataRef); 84 85 // Util::debug("hu.varadiistvan.xplra.MessageWindow: screenWidth=%d, screenHeight=%d\n", 86 // screenWidth, screenHeight); 87 88 left = 50; right = screenWidth - left; 89 top = screenHeight * 9 / 10; bottom = top - 25; 82 resetLocation(); 90 83 91 84 windowID = XPLMCreateWindow(left, top, right, bottom, 0, … … 116 109 { 117 110 showForced = false; 111 } 112 113 //------------------------------------------------------------------------------ 114 115 void MessageWindow::reset() 116 { 117 resetLocation(); 118 XPLMSetWindowGeometry(windowID, left, top, right, bottom); 118 119 } 119 120 … … 196 197 //------------------------------------------------------------------------------ 197 198 199 void MessageWindow::resetLocation() 200 { 201 int screenWidth = XPLMGetDatai(widthDataRef); 202 int screenHeight = XPLMGetDatai(heightDataRef); 203 204 // Util::debug("hu.varadiistvan.xplra.MessageWindow: screenWidth=%d, screenHeight=%d\n", 205 // screenWidth, screenHeight); 206 207 left = 50; right = screenWidth - left; 208 top = screenHeight * 9 / 10; bottom = top - 25; 209 } 210 211 //------------------------------------------------------------------------------ 212 198 213 // Local Variables: 199 214 // mode: C++ -
src/plugin/src/xplra/MessageWindow.h
r42 r47 161 161 void hide(); 162 162 163 /** 164 * Reset the location of the message window. 165 */ 166 void reset(); 167 163 168 private: 164 169 /** … … 192 197 */ 193 198 void setNewMessage(const std::string& msg, float d); 199 200 /** 201 * Reset the location of the message window. 202 */ 203 void resetLocation(); 194 204 195 205 friend class MessageRequest;
Note:
See TracChangeset
for help on using the changeset viewer.