Changeset 8 for trunk/src/kernel
- Timestamp:
- Nov 16, 2005, 8:36:46 PM (20 years ago)
- Location:
- trunk/src/kernel
- Files:
-
- 18 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel/qapplication.cpp
r7 r8 739 739 If \a GUIenabled is FALSE, the application does not connect to the 740 740 X-server. 741 On Windows and Macintosh, currently the window system is always741 On Windows, OS/2 and Macintosh, currently the window system is always 742 742 initialized, regardless of the value of GUIenabled. This may change in 743 743 future versions of Qt. … … 1232 1232 else 1233 1233 style = "Windows"; // default styles for Windows 1234 #elif defined(Q_WS_PM) 1235 /// @todo (dmik) temporary, until the native style is done 1236 style = "Windows"; // default style for OS/2 1234 1237 #elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS) 1235 1238 style = "CDE"; // default style for X11 on Solaris … … 1541 1544 } 1542 1545 1543 #if def Q_WS_WIN1546 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 1544 1547 extern const char *qAppFileName(); 1545 1548 #endif 1546 1549 1547 1550 #ifndef QT_NO_DIR 1548 #if ndef Q_WS_WIN1551 #if !defined(Q_WS_WIN) && !(defined Q_WS_PM) 1549 1552 static QString resolveSymlinks( const QString& path, int depth = 0 ) 1550 1553 { … … 1590 1593 } 1591 1594 } 1592 #endif // Q_WS_WIN1595 #endif // !Q_WS_WIN && !Q_WS_PM 1593 1596 1594 1597 /*! … … 1627 1630 QString QApplication::applicationFilePath() 1628 1631 { 1629 #if def Q_WS_WIN1632 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 1630 1633 return QDir::cleanDirPath( QFile::decodeName( qAppFileName() ) ); 1631 1634 #else … … 1706 1709 QString installPathPlugins = QString::fromLocal8Bit(qInstallPathPlugins()); 1707 1710 if ( QFile::exists(installPathPlugins) ) { 1708 #if def Q_WS_WIN1711 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 1709 1712 installPathPlugins.replace('\\', '/'); 1710 1713 #endif … … 1715 1718 if (qApp) 1716 1719 app_location = qApp->applicationFilePath(); 1717 #if def Q_WS_WIN1720 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 1718 1721 else { 1719 1722 app_location = QString(qAppFileName()); -
trunk/src/kernel/qclipboard.cpp
r7 r8 155 155 } 156 156 157 #if ndef Q_WS_WIN32157 #if !defined(Q_WS_WIN32) && !defined(Q_WS_PM) 158 158 /*! 159 159 \internal … … 173 173 174 174 This signal is emitted when the clipboard data is changed. 175 176 \note On OS/2, this signal is guaranteed to be emitted only if no other 177 non-Qt applications (for example, the standard Clipboard Viewer shipped 178 with OS/2) register themselves as clipboard viewers -- this is the 179 limitation of the Presentation Manager, not Qt. Reconnecting this signal 180 to a slot will restore its functionality (until another non-Qt application 181 will again register itself as the clipboard viewer). 175 182 */ 176 183 -
trunk/src/kernel/qcolor.cpp
r7 r8 162 162 #define COLOR0_PIX 0x00ffffff 163 163 #define COLOR1_PIX 0 164 #elif defined(Q_WS_PM) 165 #define COLOR0_PIX (uint)CLR_FALSE 166 #define COLOR1_PIX (uint)CLR_TRUE 164 167 #else 165 168 #define COLOR0_PIX 0 … … 871 874 return ((QColor*)this)->alloc(); 872 875 else if ( colormodel == d8 ) 873 #if def Q_WS_WIN876 #if defined(Q_WS_WIN) 874 877 // since d.d8.pix is uchar we have to use the PALETTEINDEX 875 878 // macro to get the respective palette entry index. 876 879 return (0x01000000 | (int)(short)(d.d8.pix)); 880 #elif defined(Q_WS_PM) 881 // the code below allows us to use negative color values (such as 882 // CLR_WHITE) in range from -1 to -128 as direct pixel colors (i.e. 883 // set using setPixel()) keeping their special meening. 884 if ( d.d8.direct ) 885 return (int) ((char) d.d8.pix); 886 else 887 return d.d8.pix; 877 888 #else 878 889 return d.d8.pix; -
trunk/src/kernel/qdragobject.cpp
r7 r8 838 838 return r; 839 839 QString text( d->txt ); 840 #if defined(Q_WS_WIN) 840 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 841 841 int index = text.find( QString::fromLatin1("\r\n"), 0 ); 842 842 while ( index != -1 ) { … … 1493 1493 return QCString(); 1494 1494 1495 #if def Q_WS_WIN1495 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 1496 1496 1497 1497 … … 1603 1603 file.insert(0,'/'); 1604 1604 } 1605 #if def Q_WS_WIN1605 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 1606 1606 if ( file.length() > 2 && file[0] == '/' && file[2] == '|' ) { 1607 1607 file[2] = ':'; … … 1613 1613 #endif 1614 1614 } 1615 #if def Q_WS_WIN1615 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 1616 1616 else { 1617 1617 file = uriToUnicodeUri(uri); -
trunk/src/kernel/qeventloop_p.h
r7 r8 60 60 #endif 61 61 62 #if defined(Q_OS_UNIX) || defined (Q_WS_WIN)62 #if defined(Q_OS_UNIX) || defined(Q_WS_WIN) || defined(Q_WS_PM) 63 63 #include "qptrlist.h" 64 #endif // Q_OS_UNIX || Q_WS_WIN 64 #endif // Q_OS_UNIX || Q_WS_WIN || Q_WS_PM 65 65 66 #if defined(Q_OS_UNIX) 66 #if defined(Q_OS_UNIX) || defined(Q_WS_PM) 67 67 struct QSockNot 68 68 { … … 86 86 #endif // Q_OS_UNIX 87 87 88 #if defined(Q_WS_WIN) 88 #if defined(Q_WS_WIN) 89 89 struct QSockNot { 90 90 QSocketNotifier *obj; … … 124 124 #endif // Q_WS_X11 125 125 126 #if defined(Q_OS_UNIX) 126 #if defined(Q_OS_UNIX) 127 127 int thread_pipe[2]; 128 128 #endif 129 #if defined(Q_OS_UNIX) || defined(Q_WS_PM) 129 130 // pending socket notifiers list 130 131 QPtrList<QSockNot> sn_pending_list; … … 135 136 #endif 136 137 137 #if def Q_WS_WIN138 #if defined(Q_WS_WIN) 138 139 // pending socket notifiers list 139 140 QPtrList<QSockNot> sn_pending_list; 140 141 #endif // Q_WS_WIN 141 142 143 #if defined(Q_WS_PM) 144 HAB hab; 145 HMQ hmq; 146 #endif 147 142 148 }; 143 149 -
trunk/src/kernel/qfont.cpp
r7 r8 1394 1394 "courier", "Courier New", 1395 1395 "helvetica", "Arial", 1396 #elif defined(Q_WS_PM) 1397 "times", "Times New Roman", 1396 1398 #endif 1397 1398 1399 0, 0 1399 1400 }; … … 3100 3101 } 3101 3102 3102 #if defined(Q_WS_WIN 3103 #if defined(Q_WS_WIN) || defined(Q_WS_PM) || defined (Q_WS_QWS) 3103 3104 void QFontCache::cleanupPrinterFonts() 3104 3105 { -
trunk/src/kernel/qfontdata_p.h
r7 r8 101 101 if ( family != other.family ) return family < other.family; 102 102 103 #if def Q_WS_X11103 #if defined(Q_WS_X11) 104 104 if ( addStyle != other.addStyle ) return addStyle < other.addStyle; 105 #endif // Q_WS_X11 106 105 #elif defined(Q_WS_PM) 106 if ( pointSize != other.pointSize ) return pointSize < other.pointSize; 107 #endif 107 108 return FALSE; 108 109 } … … 242 243 void insertEngine( const Key &key, QFontEngine *engine ); 243 244 244 #if defined(Q_WS_WIN) || defined(Q_WS_ QWS)245 #if defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_WS_QWS) 245 246 void cleanupPrinterFonts(); 246 247 #endif -
trunk/src/kernel/qfontdatabase.cpp
r7 r8 71 71 #endif 72 72 73 #define SMOOTH_SCALABLE 0xffff 74 73 75 static int ucstricmp( const QString &as, const QString &bs ) 74 76 { … … 138 140 unsigned short pixelSize; 139 141 142 #ifdef Q_WS_PM 143 unsigned short pointSize; // in deca-points 144 LONG lMatch; 145 #endif 140 146 #ifdef Q_WS_X11 141 147 int count; … … 206 212 fakeOblique( FALSE ), count( 0 ), pixelSizes( 0 ) 207 213 { 208 #if defined(Q_WS_X11) 214 #if defined(Q_WS_PM) 215 szFacename[0] = 0; 216 #elif defined(Q_WS_X11) 209 217 weightName = setwidthName = 0; 210 #endif // Q_WS_X11218 #endif 211 219 } 212 220 … … 228 236 QtFontSize *pixelSizes; 229 237 238 #ifdef Q_WS_PM 239 CHAR szFacename [FACESIZE]; 240 #endif 230 241 #ifdef Q_WS_X11 231 242 const char *weightName; … … 233 244 #endif // Q_WS_X11 234 245 246 #ifdef Q_WS_PM 247 QtFontSize *pixelSize( 248 unsigned short size, bool = FALSE, unsigned short pointSize = 0 ); 249 #else 235 250 QtFontSize *pixelSize( unsigned short size, bool = FALSE ); 251 #endif 236 252 }; 237 253 … … 247 263 } 248 264 265 #ifdef Q_WS_PM 266 QtFontSize *QtFontStyle::pixelSize( 267 unsigned short size, bool add, unsigned short pointSize ) 268 #else 249 269 QtFontSize *QtFontStyle::pixelSize( unsigned short size, bool add ) 270 #endif 250 271 { 251 272 for ( int i = 0; i < count; i++ ) { 273 #ifdef Q_WS_PM 274 if ( 275 pixelSizes[i].pixelSize == size && 276 ( 277 size == SMOOTH_SCALABLE || 278 !pointSize || 279 pixelSizes[i].pointSize == pointSize 280 ) 281 ) 282 #else 252 283 if ( pixelSizes[i].pixelSize == size ) 284 #endif 253 285 return pixelSizes + i; 254 286 } … … 261 293 (((count+8) >> 3 ) << 3) * sizeof(QtFontSize) ); 262 294 pixelSizes[count].pixelSize = size; 295 #ifdef Q_WS_PM 296 pixelSizes[count].pointSize = pointSize; 297 pixelSizes[count].lMatch = 0; 298 #endif 263 299 #ifdef Q_WS_X11 264 300 pixelSizes[count].count = 0; … … 336 372 name( n ), count( 0 ), foundries( 0 ) { 337 373 memset( scripts, 0, sizeof( scripts ) ); 374 #ifdef Q_WS_PM 375 //@@TODO (dmik): temporary solution to let QFontDialog work: 376 // at least UnknownScript is supported. 377 scripts[QFont::UnknownScript] = Supported; 378 #endif 338 379 } 339 380 ~QtFontFamily() { … … 357 398 bool fullyLoaded : 1; 358 399 QString name; 400 #ifndef Q_WS_X11 359 401 QString rawName; 402 #endif 360 403 #ifdef Q_WS_X11 361 404 QCString fontFilename; … … 393 436 class QFontDatabasePrivate { 394 437 public: 395 QFontDatabasePrivate() : count( 0 ), families( 0 ) { } 438 QFontDatabasePrivate() : 439 count( 0 ), families( 0 ) { } 396 440 ~QFontDatabasePrivate() { 441 #ifdef Q_WS_PM 442 cleanup(); 443 #else 397 444 while ( count-- ) 398 445 delete families[count]; 399 446 free( families ); 447 #endif 400 448 } 401 449 QtFontFamily *family( const QString &f, bool = FALSE ); … … 403 451 int count; 404 452 QtFontFamily **families; 453 454 #ifdef Q_WS_PM 455 static QFontDatabasePrivate* instance(); 456 private: 457 void cleanup() { 458 while ( count ) 459 delete families[--count]; 460 free( families ); 461 families = 0; 462 } 463 void reload(); 464 #endif 405 465 }; 406 466 … … 627 687 628 688 static QSingleCleanupHandler<QFontDatabasePrivate> qfontdatabase_cleanup; 689 #ifdef Q_WS_PM 690 QFontDatabasePrivate* QFontDatabasePrivate::instance() 691 { 692 static QFontDatabasePrivate *db = 0; 693 if ( !db ) { 694 db = new QFontDatabasePrivate; 695 qfontdatabase_cleanup.set(&db); 696 db->reload(); 697 } 698 return db; 699 } 700 #else 629 701 static QFontDatabasePrivate *db=0; 630 # define SMOOTH_SCALABLE 0xffff702 #endif 631 703 632 704 #if defined( Q_WS_X11 ) … … 636 708 #elif defined( Q_WS_WIN ) 637 709 # include "qfontdatabase_win.cpp" 710 #elif defined( Q_WS_PM ) 711 # include "qfontdatabase_pm.cpp" 638 712 #elif defined( Q_WS_QWS ) 639 713 # include "qfontdatabase_qws.cpp" … … 643 717 644 718 645 #if defined(Q_WS_X11) || defined(Q_WS_WIN) 719 #if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_PM) 646 720 static 647 721 unsigned int bestFoundry( QFont::Script script, unsigned int score, int styleStrategy, … … 650 724 QtFontFoundry **best_foundry, QtFontStyle **best_style, 651 725 QtFontSize **best_size 652 #if def Q_WS_X11726 #if defined(Q_WS_X11) 653 727 , QtFontEncoding **best_encoding, int force_encoding_id 728 #elif defined(Q_WS_PM) 729 , int pointSize 654 730 #endif 655 731 ) … … 711 787 // 1. see if we have an exact matching size 712 788 if (! (styleStrategy & QFont::ForceOutline)) { 789 #if defined(Q_WS_PM) 790 size = style->pixelSize(pixelSize, FALSE, pointSize); 791 #else 713 792 size = style->pixelSize(pixelSize); 793 #endif 714 794 if (size) px = size->pixelSize; 715 795 } … … 843 923 #endif 844 924 925 #ifdef Q_WS_PM 926 QFontDatabasePrivate *db = QFontDatabasePrivate::instance(); 927 #else 845 928 if ( !db ) 846 929 initializeDb(); 930 #endif 847 931 848 932 QFontEngine *fe = 0; 849 933 if ( fp ) { 934 #ifndef Q_WS_PM 850 935 if ( fp->rawMode ) { 851 936 fe = loadEngine( script, fp, request, 0, 0, 0 … … 859 944 return fe; 860 945 } 946 #endif // !Q_WS_PM 861 947 862 948 QFontCache::Key key( request, script, 863 #if def Q_WS_WIN949 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 864 950 (int)fp->paintdevice 865 951 #else … … 880 966 parseFontName( request.family, foundry_name, family_name ); 881 967 968 #ifdef Q_WS_PM 969 // the "System VIO" PM font is broken in such way that its real pixel 970 // sizes do not correspond to their nominal point sizes specified in the 971 // font header (i.e. pixelSize is not equal to (pointSize * dpi) / 720). 972 // therefore we use the special table to convert pointSize to pixelSize 973 // in order to let bestFoundry() select the proper font with its nominal 974 // point size corresponding to the requested one. 975 // NOTE: this will produce incorrect results if "System VIO" is NOT 976 // an OS/2 standatd supplied bitmap font. 977 if( !ucstricmp( family_name, "System VIO") ) { 978 // possible sizes of the "System VIO" font ("pixel, point" pairs), 979 // sorted by point size 980 static const short SystemVIO_sz[] = { 981 12, 20, 16, 30, 982 8, 40, 13, 50, 983 15, 60, 24, 70, 984 8, 80, 10, 90, 985 12, 100, 14, 110, 986 16, 120, 18, 130, 987 16, 140, 12, 150, 988 20, 160, 21, 170, 989 29, 180, 990 }; 991 const int SystemVIO_sz_len = sizeof(SystemVIO_sz) / sizeof(SystemVIO_sz[0]); 992 int pt = request.pointSize; 993 pt = QMAX( pt, SystemVIO_sz [1] ); // min limit 994 pt = QMIN( pt, SystemVIO_sz [SystemVIO_sz_len - 1] ); // max limit 995 int i = 1; 996 while ( SystemVIO_sz[i] < pt ) i += 2; 997 if ( SystemVIO_sz[i] > pt ) { 998 int prev = SystemVIO_sz[i-2]; 999 int mid = prev + (SystemVIO_sz[i] - prev + 1) / 2; 1000 if ( pt < mid ) i -= 2; 1001 } 1002 ((QFontDef&)request).pixelSize = SystemVIO_sz[i-1]; 1003 ((QFontDef&)request).pointSize = SystemVIO_sz[i]; 1004 } 1005 #endif 1006 882 1007 #ifdef Q_WS_X11 883 1008 if (family_name.isEmpty() && script == QFont::Han) { … … 905 1030 " stretch: %d\n" 906 1031 " pixelSize: %d\n" 1032 " pointSize: %d\n" 907 1033 " pitch: %c", 908 1034 family_name.isEmpty() ? "-- first in script --" : family_name.latin1(), 909 1035 foundry_name.isEmpty() ? "-- any --" : foundry_name.latin1(), 910 1036 script, scriptName( script ).latin1(), 911 request.weight, request.italic, request.stretch, request.pixelSize, pitch ); 1037 request.weight, request.italic, request.stretch, 1038 request.pixelSize, request.pointSize, 1039 pitch ); 912 1040 913 1041 #ifdef QT_XFT2 … … 944 1072 uint score_adjust = 0; 945 1073 QFont::Script override_script = script; 1074 #ifndef Q_WS_PM 946 1075 if ( ! ( try_family->scripts[script] & QtFontFamily::Supported ) 947 1076 && script != QFont::Unicode) { … … 978 1107 } 979 1108 } 1109 #endif // !Q_WS_PM 980 1110 981 1111 QtFontFoundry *try_foundry = 0; … … 992 1122 try_family, foundry_name, styleKey, request.pixelSize, pitch, 993 1123 &try_foundry, &try_style, &try_size 994 #if def Q_WS_X111124 #if defined(Q_WS_X11) 995 1125 , &try_encoding, force_encoding_id 1126 #elif defined(Q_WS_PM) 1127 , request.pointSize 996 1128 #endif 997 1129 ); … … 1002 1134 QString::null, styleKey, request.pixelSize, 1003 1135 pitch, &try_foundry, &try_style, &try_size 1004 #if def Q_WS_X111136 #if defined(Q_WS_X11) 1005 1137 , &try_encoding, force_encoding_id 1138 #elif defined(Q_WS_PM) 1139 , request.pointSize 1006 1140 #endif 1007 1141 ); … … 1047 1181 1048 1182 fe = loadEngine( script, fp, request, best_family, best_foundry, best_style 1049 #ifdef Q_WS_X11 1183 #if defined(Q_WS_PM) 1184 , best_size 1185 #elif defined(Q_WS_X11) 1050 1186 , best_size, best_encoding, ( force_encoding_id >= 0 ) 1051 1187 #endif … … 1060 1196 } 1061 1197 1198 #ifdef Q_WS_PM 1199 // On OS/2, fontDef.pixelSize and fontDef.pointSize are filled 1200 // by QFontEnginePM constructor 1201 #else 1062 1202 if ( best_style->smoothScalable ) 1063 1203 fe->fontDef.pixelSize = request.pixelSize; … … 1082 1222 fe->fontDef.pointSize = request.pointSize; 1083 1223 } 1224 #endif 1084 1225 fe->fontDef.styleHint = request.styleHint; 1085 1226 fe->fontDef.styleStrategy = request.styleStrategy; … … 1094 1235 1095 1236 if ( fe ) { 1237 #ifdef Q_WS_PM 1238 ///@@TODO (dmik): should do something here? 1239 #else 1096 1240 if ( script != QFont::Unicode && !canRender( fe, script ) ) { 1097 1241 FM_DEBUG( " WARN: font loaded cannot render sample 0x%04x", … … 1117 1261 return fe; 1118 1262 } 1263 #endif // !Q_WS_PM 1119 1264 1120 1265 if ( fp ) { 1121 1266 QFontCache::Key key( request, script, 1122 #if def Q_WS_WIN1267 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 1123 1268 (int)fp->paintdevice 1124 1269 #else … … 1128 1273 QFontCache::instance->insertEngine( key, fe ); 1129 1274 1275 #ifndef Q_WS_PM 1130 1276 for ( int i = 0; i < QFont::NScripts; ++i ) { 1131 1277 if ( i == script ) continue; … … 1137 1283 QFontCache::instance->insertEngine( key, fe ); 1138 1284 } 1285 #endif // !Q_WS_PM 1139 1286 } 1140 1287 } else { 1141 1288 if ( request.family.isEmpty() ) { 1289 #ifdef Q_WS_PM 1290 //@@TODO (dmik): what to return in such case? 1291 qFatal( "QFontDatabase::findFont: request.family is empty and nothing is found, should it ever happen?" ); 1292 #else 1142 1293 FM_DEBUG( "returning box engine" ); 1143 1294 … … 1146 1297 if ( fp ) { 1147 1298 QFontCache::Key key( request, script, 1148 #if def Q_WS_WIN1299 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 1149 1300 (int)fp->paintdevice 1150 1301 #else … … 1154 1305 QFontCache::instance->insertEngine( key, fe ); 1155 1306 } 1307 #endif // Q_WS_PM 1156 1308 } 1157 1309 } … … 1159 1311 return fe; 1160 1312 } 1161 #endif // Q_WS_X11 || Q_WS_WIN 1313 #endif // Q_WS_X11 || Q_WS_WIN || Q_WS_PM 1162 1314 1163 1315 … … 1355 1507 QFontDatabase::QFontDatabase() 1356 1508 { 1509 #ifdef Q_WS_PM 1510 d = QFontDatabasePrivate::instance(); 1511 #else 1357 1512 createDatabase(); 1358 1513 1359 1514 d = db; 1515 #endif 1360 1516 } 1361 1517 … … 1635 1791 1636 1792 if (size->pixelSize != 0 && size->pixelSize != USHRT_MAX) { 1637 #if def Q_WS_X111793 #if defined(Q_WS_X11) 1638 1794 const uint pointSize = qRound(qt_pointSize(size->pixelSize, 0, -1)); 1795 #elif defined(Q_WS_PM) 1796 //@@TODO (dmik): some bitmap fonts (i.e. System VIO) have point sizes 1797 // that do not really correlate with their actual pixel sizes (i.e. 1798 // their pointsize != pixelsizde * DPI / 72), What to return in that case? 1799 const uint pointSize = size->pointSize / 10; 1639 1800 #else 1640 1801 const uint pointSize = size->pixelSize; // embedded uses 72dpi … … 1740 1901 1741 1902 if ( size->pixelSize != 0 && size->pixelSize != USHRT_MAX ) { 1742 #if def Q_WS_X111903 #if defined(Q_WS_X11) 1743 1904 const uint pointSize = qRound(qt_pointSize(size->pixelSize, 0, -1)); 1905 #elif defined(Q_WS_PM) 1906 //@@TODO (dmik): some bitmap fonts (i.e. System VIO) have point sizes 1907 // that do not really correlate with their actual pixel sizes (i.e. 1908 // their pointsize != pixelsizde * DPI / 72), What to return in that case? 1909 const uint pointSize = size->pointSize / 10; 1744 1910 #else 1745 1911 const uint pointSize = size->pixelSize; // embedded uses 72dpi -
trunk/src/kernel/qfontengine_p.h
r7 r8 40 40 #endif 41 41 42 #ifdef Q_WS_PM 43 #include "qt_os2.h" 44 #endif 45 42 46 #include "qtextengine_p.h" 43 47 44 48 class QPaintDevice; 45 49 46 struct glyph_metrics_t; 47 class QChar; 48 typedef unsigned short glyph_t; 49 struct qoffset_t; 50 typedef int advance_t; 51 class QOpenType; 50 //@@TODO (dmik): these all are defined in the included "qtextengine_p.h", 51 // what do we need it here for? 52 //struct glyph_metrics_t; 53 //class QChar; 54 //typedef unsigned short glyph_t; 55 //struct qoffset_t; 56 //typedef int advance_t; 57 //class QOpenType; 52 58 struct TransformedFont; 53 59 54 #if defined( Q_WS_X11 ) || defined( Q_WS_WIN) || defined( Q_WS_ MAC )60 #if defined( Q_WS_X11 ) || defined( Q_WS_WIN) || defined( Q_WS_PM) || defined( Q_WS_MAC ) 55 61 class QFontEngine : public QShared 56 62 { … … 71 77 Win, 72 78 Uniscribe, 79 80 // OS/2 types 81 PM, 73 82 74 83 // Apple MacOS types … … 151 160 short rbearing; 152 161 #endif // Q_WS_WIN 162 #ifdef Q_WS_PM 163 HPS ps() const; 164 void selectTo( HPS ps ) const; 165 166 HPS hps; 167 FATTRS fa; 168 PFONTMETRICS pfm; 169 #endif 153 170 #ifdef Q_WS_X11 154 171 TransformedFont *transformed_fonts; … … 605 622 #endif 606 623 607 #endif // Q_WS_WIN 608 609 #endif 624 #elif defined( Q_WS_PM ) 625 626 class QFontEnginePM : public QFontEngine 627 { 628 public: 629 QFontEnginePM( HPS ps, PFATTRS pfa, int pixelSize, int pointSize ); 630 virtual ~QFontEnginePM() { delete[] widthCache; } 631 632 Error stringToCMap( const QChar *str, int len, glyph_t *glyphs, advance_t *advances, int *nglyphs, bool mirrored ) const; 633 634 void draw( QPainter *p, int x, int y, const QTextEngine *engine, const QScriptItem *si, int textFlags ); 635 636 glyph_metrics_t boundingBox( const glyph_t *glyphs, 637 const advance_t *advances, const qoffset_t *offsets, int numGlyphs ); 638 glyph_metrics_t boundingBox( glyph_t glyph ); 639 640 int ascent() const; 641 int descent() const; 642 int leading() const; 643 int maxCharWidth() const; 644 int minLeftBearing() const; 645 int minRightBearing() const; 646 647 //@@TODO (dmik): need other implementation? 648 const char *name() const { return 0; } 649 650 bool canRender( const QChar *string, int len ); 651 652 Type type() const; 653 654 //@@TODO (dmik): the current implementation of font-related code does not 655 // support true unicode (chars and strings are converted using 656 // QString::local8bit), so 256 is enough. It will be changed later (when, 657 // for example, ft2lib will be used). See also stringToCMap() implementation. 658 enum { widthCacheSize = 256 }; 659 unsigned char *widthCache; 660 }; 661 662 #endif 663 664 #endif -
trunk/src/kernel/qiconset.cpp
r7 r8 827 827 pixmap->fill( dis.background() ); 828 828 829 if ( !normalMask.mask() ) 830 normalMask.setMask( normalMask ); 831 829 832 QPainter painter; 830 833 painter.begin( pixmap ); 831 painter.setPen( dis. base() );834 painter.setPen( dis.light() ); 832 835 painter.drawPixmap( 1, 1, normalMask ); 833 painter.setPen( dis. foreground() );836 painter.setPen( dis.dark() ); 834 837 painter.drawPixmap( 0, 0, normalMask ); 835 838 painter.end(); 836 837 if ( !normalMask.mask() )838 normalMask.setMask( normalMask );839 839 840 840 QBitmap mask( pixmap->size() ); -
trunk/src/kernel/qlocalfs.cpp
r7 r8 155 155 fi->size(), fi->lastModified(), fi->lastRead(), fi->isDir(), fi->isFile(), 156 156 fi->isSymLink(), fi->isWritable(), fi->isReadable(), fi->isExecutable() ); 157 // ### Block signals to initiate a hack in QNetworkOperation that will 158 // prevent the op from being deleted during the qApp->processEvents() call 159 op->blockSignals( TRUE ); 160 qApp->processEvents(); 161 op->blockSignals( FALSE ); 162 if ( op->state() == StStopped ) { 163 op->free(); 164 return; 165 } 157 166 } 158 167 emit newChildren( infos, op ); -
trunk/src/kernel/qmime.cpp
r7 r8 356 356 QStringList::Iterator it; 357 357 if ( abs_name[0] == '/' 358 #if def Q_WS_WIN358 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 359 359 || ( abs_name[0] && abs_name[1] == ':' ) || abs_name.startsWith("\\\\") 360 360 #endif … … 456 456 if ( context.isNull() || 457 457 !(context[0] == '/' 458 #if def Q_WS_WIN458 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 459 459 || ( context[0] && context[1] == ':') 460 460 #endif -
trunk/src/kernel/qnetworkprotocol.cpp
r7 r8 84 84 oldOps.removeFirst(); 85 85 } 86 delete opStartTimer;87 86 } 88 87 … … 430 429 QNetworkProtocol::~QNetworkProtocol() 431 430 { 431 QNetworkOperation *op = d->opInProgress; 432 if ( op ) { 433 op->setState( StStopped ); 434 op->setProtocolDetail( tr( "Operation stopped by the user" ) ); 435 emit finished( op ); 436 // op->free() will be called by QNetworkOperationPrivate dtor below 437 } 432 438 delete d; 433 439 } … … 1257 1263 void QNetworkOperation::deleteMe() 1258 1264 { 1259 delete this; 1265 // ### A hackish workaround to prevent this op from being deleted during 1266 // the qApp->processEvents() call in QLocalFs::operationListChildren(). 1267 // The proper way is to add something like QNetworkOperation::cancelFree() 1268 // to stop deleteTimer and make it a documented method. 1269 if ( !signalsBlocked() ) 1270 delete this; 1260 1271 } 1261 1272 -
trunk/src/kernel/qobject.cpp
r7 r8 214 214 215 215 216 // Event functions, implemented in q application_xxx.cpp216 // Event functions, implemented in qeventloop_xxx.cpp 217 217 218 218 int qStartTimer( int interval, QObject *obj ); -
trunk/src/kernel/qpainter.cpp
r7 r8 1635 1635 } else { 1636 1636 txop = TxScale; 1637 #if defined(Q_WS_WIN) 1637 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 1638 1638 setf(DirtyFont); 1639 1639 #endif … … 1641 1641 } else { 1642 1642 txop = TxRotShear; 1643 #if defined(Q_WS_WIN) 1643 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 1644 1644 setf(DirtyFont); 1645 1645 #endif … … 2345 2345 if ( !pdev->cmd( QPaintDevice::PdcDrawPixmap, this, param ) || !hdc ) 2346 2346 return; 2347 #elif defined(Q_WS_PM) 2348 if ( !pdev->cmd( QPaintDevice::PdcDrawPixmap, this, param ) || !hps ) 2349 return; 2347 2350 #elif defined(Q_WS_QWS) 2348 2351 pdev->cmd( QPaintDevice::PdcDrawPixmap, this, param ); … … 2493 2496 if ( !pdev->cmd( QPaintDevice::PdcDrawImage, this, param ) || !hdc ) 2494 2497 return; 2498 #elif defined(Q_WS_PM) 2499 if ( !pdev->cmd( QPaintDevice::PdcDrawImage, this, param ) || !hps ) 2500 return; 2495 2501 #elif defined (Q_WS_QWS) 2496 2502 pdev->cmd( QPaintDevice::PdcDrawImage, this, param ); … … 2551 2557 #if defined(Q_WS_WIN) 2552 2558 if ( !pdev->cmd( QPaintDevice::PdcDrawImage, this, param ) || !hdc ) 2559 return; 2560 #elif defined(Q_WS_PM) 2561 if ( !pdev->cmd( QPaintDevice::PdcDrawImage, this, param ) || !hps ) 2553 2562 return; 2554 2563 #elif defined(Q_WS_QWS) … … 2793 2802 !hdc ) 2794 2803 return; // QPrinter wants PdcDrawText2 2804 #elif defined(Q_WS_PM) 2805 if ( !pdev->cmd( QPaintDevice::PdcDrawText2Formatted, 2806 this, param) || 2807 !hps ) 2808 return; 2795 2809 #elif defined(Q_WS_QWS) 2796 2810 pdev->cmd( QPaintDevice::PdcDrawText2Formatted, this, param); -
trunk/src/kernel/qpixmap.cpp
r7 r8 367 367 #if defined(Q_WS_WIN) 368 368 hdc = pixmap.hdc; // copy Windows device context 369 #elif defined(Q_WS_PM) 370 hps = pixmap.hps; // copy OS/2 PM presentation space 369 371 #elif defined(Q_WS_X11) 370 372 hd = pixmap.hd; // copy X11 drawable … … 475 477 #if defined(Q_WS_WIN) 476 478 hdc = pixmap.hdc; 479 #elif defined(Q_WS_PM) 480 hps = pixmap.hps; 477 481 #elif defined(Q_WS_X11) 478 482 hd = pixmap.hd; // copy QPaintDevice drawable … … 735 739 delete data->mask; 736 740 data->mask = 0; 741 #if defined (Q_WS_PM) 742 if ( data->maskedHbm ) { 743 GpiDeleteBitmap( data->maskedHbm ); 744 data->maskedHbm = 0; 745 } 746 #endif 737 747 } 738 748 return; … … 754 764 data->alphapm = 0; 755 765 #endif // Q_WS_X11 && !QT_NO_XFTFREETYPE 766 767 #if defined (Q_WS_PM) 768 if ( data->maskedHbm ) { 769 GpiDeleteBitmap( data->maskedHbm ); 770 data->maskedHbm = 0; 771 } 772 #endif 756 773 757 774 delete data->mask; -
trunk/src/kernel/qrichtext.cpp
r7 r8 76 76 #endif 77 77 78 #ifdef Q_WS_PM 79 #include "qt_os2.h" 80 #endif 81 78 82 #define QChar_linesep QChar(0x2028U) 79 83 … … 98 102 value = value * metrics.logicalDpiY() / gdc; 99 103 ReleaseDC( 0, hdc ); 104 #elif defined (Q_WS_PM) 105 LONG dpi; 106 DevQueryCaps( GpiQueryDevice( qt_display_ps() ), 107 CAPS_VERTICAL_FONT_RES, 1, &dpi ); 108 value = value * metrics.logicalDpiY() / dpi; 100 109 #elif defined (Q_WS_MAC) 101 110 value = value * metrics.logicalDpiY() / 75; // ##### FIXME … … 517 526 bool justInsert = TRUE; 518 527 QString s( str ); 519 #if defined(Q_WS_WIN) 528 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 520 529 if ( checkNewLine ) { 521 530 int i = 0; -
trunk/src/kernel/qscriptengine.cpp
r7 r8 1041 1041 #elif defined( Q_WS_WIN ) 1042 1042 # include "qscriptengine_win.cpp" 1043 #elif defined( Q_WS_PM ) 1044 # include "qscriptengine_pm.cpp" 1043 1045 #elif defined( Q_WS_MAC ) 1044 1046 # include "qscriptengine_mac.cpp" -
trunk/src/kernel/qsizegrip.cpp
r7 r8 50 50 #include "qobjectlist.h" 51 51 #include "qt_windows.h" 52 #elif defined (Q_WS_PM) 53 #include "qobjectlist.h" 54 #include "qt_os2.h" 52 55 #elif defined(Q_WS_MAC) 53 56 bool qt_mac_update_sizer(QWidget *, int); //qwidget_mac.cpp … … 236 239 tlw->resize( w, h ); 237 240 } 238 #if def Q_WS_WIN241 #if defined (Q_WS_WIN) 239 242 MSG msg; 240 243 while( PeekMessage( &msg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE ) ) 244 ; 245 #elif defined (Q_WS_PM) 246 //@@TODO (dmik): is the code below really necessary? 247 QMSG qmsg; 248 while( WinPeekMsg( 0, &qmsg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE ) ) 241 249 ; 242 250 #endif -
trunk/src/kernel/qt_gfx.pri
r7 r8 7 7 system-mng { 8 8 win32:LIBS += libmng.lib 9 os2:LIBS += libmng.lib 9 10 unix:LIBS += -lmng 10 11 } else { … … 46 47 unix:LIBS += -ljpeg 47 48 win32:LIBS += libjpeg.lib 49 os2:LIBS += libjpeg.lib 48 50 } else { 49 51 INCLUDEPATH += 3rdparty/libjpeg … … 105 107 unix:LIBS += -lpng 106 108 win32:LIBS += libpng.lib 109 os2:LIBS += png.lib 107 110 } else { 108 111 INCLUDEPATH += 3rdparty/libpng … … 147 150 unix:LIBS += -lz 148 151 win32:LIBS += libz.lib 152 os2:LIBS += z.lib 149 153 } 150 154 -
trunk/src/kernel/qt_kernel.pri
r7 r8 122 122 $$KERNEL_CPP/qfontengine_win.cpp 123 123 124 os2:SOURCES += \ 125 $$KERNEL_CPP/qapplication_pm.cpp \ 126 $$KERNEL_CPP/qclipboard_pm.cpp \ 127 $$KERNEL_CPP/qcolor_pm.cpp \ 128 $$KERNEL_CPP/qcursor_pm.cpp \ 129 $$KERNEL_CPP/qdesktopwidget_pm.cpp \ 130 $$KERNEL_CPP/qeventloop_pm.cpp \ 131 $$KERNEL_CPP/qfont_pm.cpp \ 132 $$KERNEL_CPP/qmime_pm.cpp \ 133 $$KERNEL_CPP/qpixmap_pm.cpp \ 134 $$KERNEL_CPP/qpaintdevice_pm.cpp \ 135 $$KERNEL_CPP/qpainter_pm.cpp \ 136 $$KERNEL_CPP/qregion_pm.cpp \ 137 $$KERNEL_CPP/qthread_pm.cpp \ 138 $$KERNEL_CPP/qwidget_pm.cpp \ 139 $$KERNEL_CPP/qfontengine_pm.cpp 140 124 141 unix:x11 { 125 142 SOURCES += $$KERNEL_CPP/qapplication_x11.cpp \ … … 260 277 } 261 278 } 279 280 #@@TODO(dmik): headers and sources below are substracted until implemented 281 os2 { 282 HEADERS -= \ 283 $$KERNEL_P/qinputcontext_p.h \ 284 $$KERNEL_H/qpolygonscanner.h \ 285 $$KERNEL_H/qprinter.h \ 286 $$KERNEL_H/qprocess.h \ 287 $$KERNEL_H/qsessionmanager.h \ 288 $$KERNEL_H/qsound.h 289 290 SOURCES -= \ 291 $$KERNEL_CPP/qpolygonscanner.cpp \ 292 $$KERNEL_CPP/qprinter.cpp \ 293 $$KERNEL_CPP/qprocess.cpp \ 294 $$KERNEL_CPP/qsound.cpp 295 } -
trunk/src/kernel/qtextengine.cpp
r7 r8 826 826 #elif defined( Q_WS_WIN ) 827 827 # include "qtextengine_win.cpp" 828 #elif defined( Q_WS_PM ) 829 # include "qtextengine_pm.cpp" 828 830 #elif defined( Q_WS_MAC ) 829 831 # include "qtextengine_mac.cpp" -
trunk/src/kernel/qtextengine_p.h
r7 r8 167 167 unsigned short reserved :1; 168 168 unsigned short engineReserved :2; 169 }; 170 171 inline bool operator == ( const QScriptAnalysis &sa1, const QScriptAnalysis &sa2 ) 172 { 173 return 174 sa1.script == sa2.script && 175 sa1.bidiLevel == sa2.bidiLevel; 176 // ### 177 // && override == other.override; 178 } 179 180 #elif defined( Q_WS_PM ) 181 182 //@@TODO (dmik): the definitions below is almost unchecked (no true unicode 183 // support yet) 184 185 //@@TODO (dmik): curretnly glyphs are just 8 bit chars (see 186 // QFontEnginePM::stringToCMap()), so glyph_t is temporarily defined as 187 // unsigned char. it should be changed later. 188 typedef unsigned char glyph_t; 189 //typedef unsigned short glyph_t; 190 191 struct qoffset_t { 192 int x; 193 int y; 194 }; 195 196 typedef int advance_t; 197 198 //@@TODO (dmik): it's a dummy version... 199 struct QScriptAnalysis { 200 unsigned short script :10; 201 unsigned short bidiLevel :5; 202 unsigned short override :1; 203 unsigned short reserved :1; 169 204 }; 170 205 -
trunk/src/kernel/qthread.cpp
r7 r8 41 41 #include <private/qthreadinstance_p.h> 42 42 43 #ifndef QT_NO_COMPAT 43 44 #ifndef QT_H 44 45 # include "qapplication.h" 45 46 #endif // QT_H 47 #endif // QT_NO_COMPAT 46 48 47 49 #if QT_VERSION >= 0x040000 -
trunk/src/kernel/qtranslator.cpp
r7 r8 406 406 407 407 if ( filename[0] == '/' 408 #if def Q_WS_WIN408 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 409 409 || (filename[0] && filename[1] == ':') || filename[0] == '\\' 410 410 #endif -
trunk/src/kernel/qurl.cpp
r7 r8 834 834 d->host.remove( (uint)0, 1 ); 835 835 836 #if defined(Q_OS_WIN32) 836 #if defined(Q_OS_WIN32) || defined(Q_OS_OS2) 837 837 // hack for windows file://machine/path syntax 838 838 if ( d->protocol == "file" ) { … … 1028 1028 d->cleanPath = d->path; 1029 1029 } else if ( isLocalFile() ) { 1030 #if defined(Q_OS_WIN32) 1030 #if defined(Q_OS_WIN32) || defined(Q_OS_OS2) 1031 1031 // hack for stuff like \\machine\path and //machine/path on windows 1032 1032 if ( ( d->path.left( 1 ) == "/" || d->path.left( 1 ) == "\\" ) && … … 1101 1101 { 1102 1102 if ( d->path.isEmpty() || d->path.endsWith( "/" ) 1103 #if def Q_WS_WIN1103 #if defined(Q_WS_WIN) || defined(Q_OS_OS2) 1104 1104 || d->path.endsWith( "\\" ) 1105 1105 #endif -
trunk/src/kernel/qwidget.cpp
r7 r8 61 61 #include "qinputcontext_p.h" 62 62 #endif 63 #if defined(Q_WS_PM) 64 #include "qt_os2.h" 65 #endif 63 66 #if defined(Q_WS_QWS) 64 67 #include "qwsmanager_qws.h" … … 513 516 QWidget utility functions 514 517 *****************************************************************************/ 515 516 518 static QFont qt_naturalWidgetFont( QWidget* w ) { 517 519 QFont naturalfont = QApplication::font( w ); … … 3259 3261 #if defined(Q_WS_WIN) 3260 3262 && GetFocus() == winId() 3263 #elif defined(Q_WS_PM) 3264 //@@TODO (dmik): currently we don't use WinSetFocus(). what for? Qt seems 3265 // to completely handle focus traversal itself. 3266 // && WinQueryFocus( HWND_DESKTOP ) == winId() 3261 3267 #endif 3262 3268 ) … … 3294 3300 SetFocus( winId() ); 3295 3301 else { 3302 #elif defined(Q_WS_PM) 3303 //@@TODO (dmik): currently we don't use WinSetFocus(). what for? Qt seems 3304 // to completely handle focus traversal itself. 3305 // if ( !topLevelWidget()->isPopup() ) 3306 // WinSetFocus( HWND_DESKTOP, winId() ); 3307 // else { 3296 3308 #endif 3297 3309 #if defined(QT_ACCESSIBILITY_SUPPORT) 3298 3310 QAccessible::updateAccessibility( this, 0, QAccessible::Focus ); 3299 3311 #endif 3300 #if defined(Q_WS_WIN) 3312 #if defined(Q_WS_WIN) // || defined(Q_WS_PM) 3301 3313 } 3302 3314 #endif … … 3345 3357 SetFocus( 0 ); 3346 3358 else { 3359 #elif defined(Q_WS_PM) 3360 //@@TODO (dmik): currently we don't use WinSetFocus(). what for? Qt seems 3361 // to completely handle focus traversal itself. 3362 // if ( !isPopup() && WinQueryFocus( HWND_DESKTOP ) == winId() ) 3363 // WinSetFocus( HWND_DESKTOP, topLevelWidget()->winId() ); 3364 // else { 3347 3365 #endif 3348 3366 #if defined(QT_ACCESSIBILITY_SUPPORT) 3349 3367 QAccessible::updateAccessibility( this, 0, QAccessible::Focus ); 3350 3368 #endif 3351 #if defined(Q_WS_WIN) 3369 #if defined(Q_WS_WIN) // || defined(Q_WS_PM) 3352 3370 } 3353 3371 #endif … … 3567 3585 } 3568 3586 #endif 3587 //@@TODO (dmik): I think we don't need the same as above in OS/2, 3588 // because if the window is active (in Qt terminology) 3589 // qApp->activeWindow() will be equal to toplevelWidget() which is 3590 // checked at the beginnig. 3569 3591 3570 3592 return FALSE; … … 3985 4007 // On Windows, show the popup now so that our own focus handling 3986 4008 // stores the correct old focus widget even if it's stolen in the showevent 4009 //@@TODO (dmik): need the same in OS/2? guess not. 3987 4010 #if defined(Q_WS_WIN) 3988 4011 if ( testWFlags(WType_Popup) ) … … 4006 4029 showWindow(); 4007 4030 4008 #if !defined(Q_WS_WIN) 4031 //@@TODO (dmik): need the same in OS/2? guess not. 4032 #if !defined(Q_WS_WIN) 4009 4033 if ( testWFlags(WType_Popup) ) 4010 4034 qApp->openPopup( this ); … … 4048 4072 qt_leave_modal( this ); 4049 4073 4050 #if defined(Q_WS_WIN) 4074 //@@TODO (dmik): is it correct for OS/2? 4075 #if defined(Q_WS_WIN) || defined(Q_WS_PM) 4051 4076 if ( isTopLevel() && !isPopup() && parentWidget() && isActiveWindow() ) 4052 4077 parentWidget()->setActiveWindow(); // Activate parent … … 4927 4952 } 4928 4953 4954 #ifndef Q_WS_PM 4955 // We disable this on OS/2 since we send these events from qt_sendBlocked() 4956 // which does it more accurately compared to the code below -- only those 4957 // widgets that have actually been blocked/unblocked (not less and not 4958 // more) will receive these events. 4929 4959 case QEvent::WindowBlocked: 4930 4960 case QEvent::WindowUnblocked: … … 4938 4968 } 4939 4969 break; 4970 #endif 4940 4971 4941 4972 default: … … 5527 5558 */ 5528 5559 bool QWidget::winEvent( MSG * ) 5560 { 5561 return FALSE; 5562 } 5563 5564 #endif 5565 #if defined(Q_WS_PM) 5566 5567 /*! 5568 This special event handler can be reimplemented in a subclass to 5569 receive native OS/2 PM events. 5570 5571 In your reimplementation of this function, if you want to stop the 5572 event being handled by Qt, return TRUE. If you return FALSE, this 5573 native event is passed back to Qt, which translates the event into 5574 a Qt event and sends it to the widget. 5575 5576 \warning This function is not portable. 5577 5578 \sa QApplication::pmEventFilter() 5579 */ 5580 bool QWidget::pmEvent( QMSG * ) 5529 5581 { 5530 5582 return FALSE;
Note:
See TracChangeset
for help on using the changeset viewer.