Changeset 50:d650ff7422a5 in xplra for src/plugin/src/xplra/MessageWindow.cc
- Timestamp:
- 02/16/13 10:13:44 (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/plugin/src/xplra/MessageWindow.cc
r49 r50 42 42 using hu::varadiistvan::xplcommon::Util; 43 43 44 using std::string; 44 45 using std::min; 45 46 using std::max; … … 76 77 77 78 MessageWindow::MessageWindow() : 79 maxMessageLength(0), 78 80 showForced(false), 79 81 hideTime(0.0), … … 89 91 heightDataRef = XPLMFindDataRef("sim/graphics/view/window_height"); 90 92 93 int digitsOnly = 0; 94 XPLMGetFontDimensions(xplmFont_Basic, &fontWidth, &fontHeight, &digitsOnly); 95 96 Util::debug("hu.varadiistvan.xplra.MessageWindow: fontWidth=%d, fontHeight=%d\n", 97 fontWidth, fontHeight); 98 91 99 resetLocation(); 92 100 … … 148 156 XPLMDrawTranslucentDarkBox(left, top, right, bottom); 149 157 if (hideTime!=0.0) { 150 XPLMDrawString(colour, left + 25, top - 15, 151 const_cast<char*>(displayedMessage.c_str()), 0, 158 159 string dm(displayedMessage, 0, maxMessageLength); 160 161 XPLMDrawString(colour, 162 left + horizontalMarginSize, 163 bottom + verticalMarginSize + baseLineSize, 164 const_cast<char*>(dm.c_str()), 0, 152 165 xplmFont_Basic); 153 166 } … … 208 221 if (newLeft>=0 && (right-newLeft)>=minimalWidth) { 209 222 left = newLeft; 223 recalculateMaxMessageLength(); 210 224 } 211 225 } else if (mouseMode==MOUSE_RESIZE_RIGHT) { … … 214 228 if (newRight<screenWidth && (newRight-left)>=minimalWidth) { 215 229 right = newRight; 230 recalculateMaxMessageLength(); 216 231 } 217 232 } 218 233 219 234 XPLMSetWindowGeometry(windowID, left, top, right, bottom); 220 221 // clickedX = x;222 // clickedY = y;223 235 } 224 236 … … 267 279 // screenWidth, screenHeight); 268 280 269 left = 50; right = screenWidth - left; 270 top = screenHeight * 9 / 10; bottom = top - 25; 281 left = 50; 282 right = screenWidth - left; 283 284 top = screenHeight * 9 / 10; 285 bottom = top - fontHeight - 2*verticalMarginSize; 286 287 recalculateMaxMessageLength(); 288 } 289 290 //------------------------------------------------------------------------------ 291 292 void MessageWindow::recalculateMaxMessageLength() 293 { 294 maxMessageLength = (right + 1 - left) - 2 * horizontalMarginSize; 295 maxMessageLength /= fontWidth; 271 296 } 272 297
Note:
See TracChangeset
for help on using the changeset viewer.