Changeset 174 for trunk/src/kernel
- Timestamp:
- Nov 6, 2007, 11:27:57 PM (18 years ago)
- Location:
- trunk/src/kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel/qapplication.cpp
r172 r174 1235 1235 else 1236 1236 style = "Windows"; // default styles for Windows 1237 #elif defined(Q_WS_PM) 1238 /// @todo (dmik) temporary, until the native style is done 1239 style = "Windows"; // default style for OS/2 1237 // this is temporarily disabled until most bugs are fixed, 1238 // see http://svn.netlabs.org/qr3/ticket/9 for details 1239 //#elif defined(Q_WS_PM) 1240 // style = "Warp4"; // default style for OS/2 1241 //#endif 1240 1242 #elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS) 1241 1243 style = "CDE"; // default style for X11 on Solaris … … 1253 1255 if ( !app_style && // platform default style not available, try alternatives 1254 1256 !(app_style = QStyleFactory::create( "Windows" ) ) && 1257 // !(app_style = QStyleFactory::create( "Warp4" ) ) && 1255 1258 !(app_style = QStyleFactory::create( "Platinum" ) ) && 1256 1259 !(app_style = QStyleFactory::create( "MotifPlus" ) ) && … … 1370 1373 The string must be one of the QStyleFactory::keys(), typically one 1371 1374 of "windows", "motif", "cde", "motifplus", "platinum", "sgi" and 1372 "compact". Depending on the platform, "windowsxp", " aqua" or1375 "compact". Depending on the platform, "windowsxp", "warp4", "aqua" or 1373 1376 "macintosh" may be available. 1374 1377 -
trunk/src/kernel/qapplication_pm.cpp
r171 r174 131 131 const QPixmap *, int, int, int ); 132 132 133 Q_EXPORT 133 134 QRgb qt_sysclr2qrgb( LONG sysClr ) 134 135 { … … 139 140 } 140 141 141 QFont qt_sysfont2qfont( const PSZ scope ) { 142 static 143 QFont qt_sysfont2qfont( const PSZ scope ) 144 { 142 145 static const PSZ app = "PM_SystemFonts"; 143 static const PSZ def = " 8.Helv";146 static const PSZ def = "10.System Proportional"; 144 147 ULONG keyLen = 0; 145 QFont f( " Helv", 8);148 QFont f( "System Proportional", 10 ); 146 149 147 150 if ( PrfQueryProfileSize( HINI_USERPROFILE, app, scope, &keyLen ) && keyLen ) { … … 369 372 // Do the font settings 370 373 374 #ifndef QT_PM_NO_DEFAULTFONT_OVERRIDE 371 375 QFont windowFont = qt_sysfont2qfont( "WindowText" ); 376 #else 377 QFont windowFont = qt_sysfont2qfont( "DefaultFont" ); 378 #endif 372 379 QFont menuFont = qt_sysfont2qfont( "Menus" ); 373 380 QFont iconFont = qt_sysfont2qfont( "IconText" ); … … 440 447 *qt_std_pal = pal; 441 448 442 // a special palette for menus 443 acg.setColor( QColorGroup::Highlight, 449 // special palettes 450 QColorGroup scg; 451 452 // menus 453 scg = acg; 454 scg.setColor( QColorGroup::Background, 455 QColor( qt_sysclr2qrgb( SYSCLR_MENU ) ) ); 456 scg.setColor( QColorGroup::Highlight, 444 457 QColor( qt_sysclr2qrgb( SYSCLR_MENUHILITEBGND ) ) ); 445 acg.setColor( QColorGroup::HighlightedText,458 scg.setColor( QColorGroup::HighlightedText, 446 459 QColor( qt_sysclr2qrgb( SYSCLR_MENUHILITE ) ) ); 447 QApplication::setPalette( QPalette( acg, dcg, icg ), TRUE, "QPopupMenu"); 448 QApplication::setPalette( QPalette( acg, dcg, icg ), TRUE, "QMenuBar"); 460 pal.setActive( scg ); 461 pal.setInactive( scg ); 462 QApplication::setPalette( pal, TRUE, "QPopupMenu" ); 463 QApplication::setPalette( pal, TRUE, "QMenuBar" ); 464 465 // static widget texts 466 scg = acg; 467 QColor staticTextCol( qt_sysclr2qrgb( SYSCLR_WINDOWSTATICTEXT ) ); 468 scg.setColor( QColorGroup::Foreground, staticTextCol ); 469 scg.setColor( QColorGroup::Text, staticTextCol ); 470 pal.setActive( scg ); 471 pal.setInactive( scg ); 472 QApplication::setPalette( pal, TRUE, "QLabel" ); 473 QApplication::setPalette( pal, TRUE, "QGroupBox" ); 449 474 } 450 475 … … 457 482 { 458 483 public: 459 static bool &installed() { return QtOS2SysXcptMainHandler::installed; } 484 static bool &installed() { return QtOS2SysXcptMainHandler::installed; } 460 485 static ERR &libcHandler() { return QtOS2SysXcptMainHandler::libcHandler; } 461 486 static ERR handler() { return QtOS2SysXcptMainHandler::handler; } … … 486 511 DosGetInfoBlocks( &ptib, NULL ); 487 512 Q_ASSERT( ptib && ptib->tib_ptib2 ); 488 513 489 514 if ( ptib && ptib->tib_ptib2 ) { 490 // must be called only on the main (first) thread 515 // must be called only on the main (first) thread 491 516 Q_ASSERT( ptib->tib_ptib2->tib2_ultid == 1 ); 492 517 // also make sure that QtOS2SysXcptMainHandler was not already … … 551 576 // default font 552 577 if ( !qt_app_has_font ) 553 QApplication::setFont( QFont( "Helv", 8) );578 QApplication::setFont( QFont( "System Proportional", 10 ) ); 554 579 555 580 // QFont::locale_init(); ### Uncomment when it does something on OS/2 … … 590 615 591 616 #if !defined(QT_OS2_NO_SYSEXCEPTIONS) 592 // remove the exception handler if it was installed in qt_init() 617 // remove the exception handler if it was installed in qt_init() 593 618 PTIB ptib = NULL; 594 619 DosGetInfoBlocks( &ptib, NULL ); 595 620 Q_ASSERT( ptib && ptib->tib_ptib2 ); 596 621 597 622 if ( ptib && ptib->tib_ptib2 ) { 598 // must be called only on the main (first) thread 623 // must be called only on the main (first) thread 599 624 Q_ASSERT( ptib->tib_ptib2->tib2_ultid == 1 ); 600 625 // also make sure the handler was really installed by qt_init() … … 1003 1028 enum { 1004 1029 // some undocumented messages (they have the WM_U_ prefix for clarity) 1005 1030 1006 1031 // sent to hwnd that has been entered to by a mouse pointer. 1007 1032 // FID_CLIENT also receives enter messages of its WC_FRAME. … … 2064 2089 return; 2065 2090 } 2066 2091 2067 2092 // find the modal's group leader 2068 2093 QWidget *mgl = modal->parentWidget(); … … 2548 2573 #endif 2549 2574 if ( curWin != winId() ) { // new current window 2550 /// @todo (dmik) 2575 /// @todo (dmik) 2551 2576 // add CS_HITTEST to our window classes and handle WM_HITTEST, 2552 2577 // otherwise disabled windows will not get mouse events? … … 2764 2789 // Alt+letter shortcuts in the NLS keyboard mode together with Alt+NLS_letter 2765 2790 // shortcuts (nice feature imho). Note that Alt+NLS_letter shortcuts are 2766 // correctly processed in any case. 2791 // correctly processed in any case. 2767 2792 2768 2793 // cache table to store Qt::Key_... values for 256 hardware scancodes -
trunk/src/kernel/qfont_pm.cpp
r8 r174 58 58 { 59 59 switch( styleHint ) { 60 case QFont::Times: 61 return QString::fromLatin1("Times New Roman"); 62 case QFont::Courier: 63 return QString::fromLatin1("Courier"); 64 case QFont::Decorative: 65 return QString::fromLatin1("Times New Roman"); 66 case QFont::Helvetica: 67 return QString::fromLatin1("Helvetica"); 68 case QFont::System: 69 //@@TODO (dmik): check for OS/2 ver and return the appropriate system font 70 // (i.e. "System Proportional" for ver <= Warp 3) 71 return QString::fromLatin1("WarpSans"); 72 default: 60 case QFont::Times: 61 return QString::fromLatin1( "Times New Roman" ); 62 case QFont::Courier: 63 return QString::fromLatin1( "Courier" ); 64 case QFont::Decorative: 65 return QString::fromLatin1( "Times New Roman" ); 66 case QFont::Helvetica: 67 return QString::fromLatin1( "Helvetica" ); 68 case QFont::System: { 69 #ifndef QT_PM_NO_DEFAULTFONT_OVERRIDE 70 static ULONG ver[2] = {0}; 71 if ( ver[0] == ver[1] == 0 ) { 72 DosQuerySysInfo( QSV_VERSION_MAJOR, QSV_VERSION_MINOR, 73 &ver, sizeof(ver) ); 74 } 75 if ( ver[0] == 20 && ver[1] >= 40 ) 76 return QString::fromLatin1( "WarpSans" ); 77 else 78 #endif 79 return QString::fromLatin1( "System Proportional" ); 80 } 81 default: 73 82 // the family to be used when no StyleHint is set (in accordance 74 83 // with the font matching algorithm stated in QFont docs) 75 return QString::fromLatin1( "Helvetica");84 return QString::fromLatin1( "Helvetica" ); 76 85 } 77 86 //@@TODO (dmik): should we also add default font substitutions to … … 79 88 } 80 89 81 //@@TODO (dmik): remove82 //extern HDC shared_dc; // common dc for all fonts83 84 //@@TODO (dmik): remove?85 //// ### maybe move to qapplication_win86 //QFont qt_LOGFONTtoQFont(LOGFONT& lf, bool /*scale*/)87 //{88 // QString family = QT_WA_INLINE( QString::fromUcs2((ushort*)lf.lfFaceName),89 // QString::fromLocal8Bit((char*)lf.lfFaceName) );90 // QFont qf(family);91 // qf.setItalic(lf.lfItalic);92 // if (lf.lfWeight != FW_DONTCARE) {93 // int weight;94 // if ( lf.lfWeight < 400 )95 // weight = QFont::Light;96 // else if ( lf.lfWeight < 600 )97 // weight = QFont::Normal;98 // else if ( lf.lfWeight < 700 )99 // weight = QFont::DemiBold;100 // else if ( lf.lfWeight < 800 )101 // weight = QFont::Bold;102 // else103 // weight = QFont::Black;104 // qf.setWeight(weight);105 // }106 // int lfh = QABS( lf.lfHeight );107 // Q_ASSERT(shared_dc);108 // qf.setPointSizeFloat( lfh * 72.0 / GetDeviceCaps(shared_dc,LOGPIXELSY) );109 // qf.setUnderline(FALSE);110 // qf.setOverline(FALSE);111 // qf.setStrikeOut(FALSE);112 // return qf;113 //}114 115 116 //@@TODO (dmik): need these two funcs?117 //static inline float pixelSize( const QFontDef &request, QPaintDevice *paintdevice,118 // int )119 //{120 // float pSize;121 // if ( request.pointSize != -1 ) {122 // if ( paintdevice ) {123 // pSize = request.pointSize *124 // QPaintDeviceMetrics( paintdevice ).logicalDpiY() / 720.;125 // } else {126 // LONG dpi;127 // DevQueryCaps( GpiQueryDevice( qt_display_ps() ),128 // CAPS_VERTICAL_FONT_RES, 1, &val );129 // pSize = (request.pointSize*dpi + 360) / 720;130 // }131 // } else {132 // pSize = request.pixelSize;133 // }134 // return pSize;135 //}136 //137 //static inline float pointSize( const QFontDef &fd, QPaintDevice *paintdevice,138 // int )139 //{140 // float pSize;141 // if ( fd.pointSize == -1 ) {142 // if ( paintdevice ) {143 // pSize = fd.pixelSize * 720. /144 // QPaintDeviceMetrics( paintdevice ).logicalDpiY();145 // } else {146 // LONG dpi;147 // DevQueryCaps( GpiQueryDevice( qt_display_ps() ),148 // CAPS_VERTICAL_FONT_RES, 1, &val );149 // pSize = fd.pixelSize * 72.0 / dpi;150 // }151 // } else {152 // pSize = fd.pointSize;153 // }154 // return pSize;155 //}156 157 90 /***************************************************************************** 158 91 QFont member functions … … 165 98 if ( QFontCache::instance ) 166 99 return; 167 //@@TODO (dmik): remove168 // shared_dc = CreateCompatibleDC( qt_display_dc() );169 //#if defined(QT_CHECK_RANGE)170 // if ( !shared_dc )171 // qSystemWarning( "QFont::initialize() (qfont_win.cpp, 163): couldn't create device context" );172 //#endif173 100 new QFontCache(); 174 101 … … 180 107 { 181 108 delete QFontCache::instance; 182 //@@TODO (dmik): remove183 // DeleteDC( shared_dc );184 // shared_dc = 0;185 109 } 186 110 … … 194 118 // sanity checks 195 119 if (!QFontCache::instance) 196 120 qWarning("Must construct a QApplication before a QFont"); 197 121 Q_ASSERT( script >= 0 && script < QFont::LastPrivateScript ); 198 122 #endif // QT_CHECK_STATE … … 204 128 } else { 205 129 DevQueryCaps( GpiQueryDevice( qt_display_ps() ), 206 CAPS_VERTICAL_FONT_RES, 1, (PLONG) &dpi );130 CAPS_VERTICAL_FONT_RES, 1, (PLONG) &dpi ); 207 131 } 208 132 if (req.pointSize != -1) … … 212 136 213 137 if ( ! engineData ) { 214 215 216 217 218 219 220 221 222 223 224 225 138 QFontCache::Key key( req, QFont::NoScript, (int)paintdevice ); 139 140 // look for the requested font in the engine data cache 141 engineData = QFontCache::instance->findEngineData( key ); 142 143 if ( ! engineData) { 144 // create a new one 145 engineData = new QFontEngineData; 146 QFontCache::instance->insertEngineData( key, engineData ); 147 } else { 148 engineData->ref(); 149 } 226 150 } 227 151 … … 239 163 240 164 if (!req.family.isEmpty()) { 241 242 243 244 245 246 247 248 165 family_list = QStringList::split( ',', req.family ); 166 167 // append the substitute list for each family in family_list 168 QStringList subs_list; 169 QStringList::ConstIterator it = family_list.begin(), end = family_list.end(); 170 for ( ; it != end; ++it ) 171 subs_list += QFont::substitutes( *it ); 172 family_list += subs_list; 249 173 250 174 //@@TODO (dmik): need something here? 251 252 175 // append the default fallback font for the specified script 176 // family_list << ... ; ########### 253 177 254 178 // add the family corresponding to font's styleHint 255 179 QString hintFamily = qt_pm_default_family( request.styleHint ); 256 180 if ( ! family_list.contains( hintFamily ) ) 257 181 family_list << hintFamily; 258 182 … … 262 186 // below added to the list. 263 187 264 265 266 267 268 269 270 271 188 // add the default family 189 QString defaultFamily = QApplication::font().family(); 190 if ( ! family_list.contains( defaultFamily ) ) 191 family_list << defaultFamily; 192 193 // add QFont::defaultFamily() to the list, for compatibility with 194 // previous versions 195 family_list << QApplication::font().defaultFamily(); 272 196 } 273 197 … … 277 201 QStringList::ConstIterator it = family_list.begin(), end = family_list.end(); 278 202 for ( ; ! engine && it != end; ++it ) { 279 280 281 282 283 284 285 286 287 288 289 290 203 req.family = *it; 204 205 engine = QFontDatabase::findFont( script, this, req ); 206 if ( engine ) { 207 if ( engine->type() != QFontEngine::Box ) 208 break; 209 210 if ( ! req.family.isEmpty() ) 211 engine = 0; 212 213 continue; 214 } 291 215 } 292 216 … … 343 267 QString QFont::lastResortFont() const 344 268 { 345 return QString::fromLatin1( "System Proportional");269 return QString::fromLatin1( "System Proportional" ); 346 270 } 347 271 … … 351 275 QFontMetrics member functions 352 276 *****************************************************************************/ 353 354 //@@TODO (dmik): remove355 //#define IS_TRUETYPE (QT_WA_INLINE( engine->tm.w.tmPitchAndFamily, engine->tm.a.tmPitchAndFamily ) & TMPF_TRUETYPE)356 //#define TMX engine->tm.w357 //#define TMW engine->tm.w358 //#define TMA engine->tm.a359 277 360 278 //@@TODO (dmik): do we need a separate (other than in qfont.cpp)
Note:
See TracChangeset
for help on using the changeset viewer.