Changeset 8 for trunk/src/kernel


Ignore:
Timestamp:
Nov 16, 2005, 8:36:46 PM (20 years ago)
Author:
dmik
Message:

Transferred Qt for OS/2 version 3.3.1-rc5 sources from the CVS

Location:
trunk/src/kernel
Files:
18 added
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel/qapplication.cpp

    r7 r8  
    739739  If \a GUIenabled is FALSE, the application does not connect to the
    740740  X-server.
    741   On Windows and Macintosh, currently the window system is always
     741  On Windows, OS/2 and Macintosh, currently the window system is always
    742742  initialized, regardless of the value of GUIenabled. This may change in
    743743  future versions of Qt.
     
    12321232            else
    12331233                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
    12341237#elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS)
    12351238            style = "CDE";                      // default style for X11 on Solaris
     
    15411544}
    15421545
    1543 #ifdef Q_WS_WIN
     1546#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    15441547extern const char *qAppFileName();
    15451548#endif
    15461549
    15471550#ifndef QT_NO_DIR
    1548 #ifndef Q_WS_WIN
     1551#if !defined(Q_WS_WIN) && !(defined Q_WS_PM)
    15491552static QString resolveSymlinks( const QString& path, int depth = 0 )
    15501553{
     
    15901593    }
    15911594}
    1592 #endif // Q_WS_WIN
     1595#endif // !Q_WS_WIN && !Q_WS_PM
    15931596
    15941597/*!
     
    16271630QString QApplication::applicationFilePath()
    16281631{
    1629 #ifdef Q_WS_WIN
     1632#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    16301633    return QDir::cleanDirPath( QFile::decodeName( qAppFileName() ) );
    16311634#else
     
    17061709        QString installPathPlugins = QString::fromLocal8Bit(qInstallPathPlugins());
    17071710        if ( QFile::exists(installPathPlugins) ) {
    1708 #ifdef Q_WS_WIN
     1711#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    17091712            installPathPlugins.replace('\\', '/');
    17101713#endif
     
    17151718        if (qApp)
    17161719            app_location = qApp->applicationFilePath();
    1717 #ifdef Q_WS_WIN
     1720#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    17181721        else {
    17191722            app_location = QString(qAppFileName());
  • trunk/src/kernel/qclipboard.cpp

    r7 r8  
    155155}
    156156
    157 #ifndef Q_WS_WIN32
     157#if !defined(Q_WS_WIN32) && !defined(Q_WS_PM)
    158158/*!
    159159    \internal
     
    173173
    174174    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).
    175182*/
    176183
  • trunk/src/kernel/qcolor.cpp

    r7 r8  
    162162#define COLOR0_PIX 0x00ffffff
    163163#define COLOR1_PIX 0
     164#elif defined(Q_WS_PM)
     165#define COLOR0_PIX (uint)CLR_FALSE
     166#define COLOR1_PIX (uint)CLR_TRUE
    164167#else
    165168#define COLOR0_PIX 0
     
    871874        return ((QColor*)this)->alloc();
    872875    else if ( colormodel == d8 )
    873 #ifdef Q_WS_WIN
     876#if defined(Q_WS_WIN)
    874877        // since d.d8.pix is uchar we have to use the PALETTEINDEX
    875878        // macro to get the respective palette entry index.
    876879        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;
    877888#else
    878889        return d.d8.pix;
  • trunk/src/kernel/qdragobject.cpp

    r7 r8  
    838838            return r;
    839839        QString text( d->txt );
    840 #if defined(Q_WS_WIN)
     840#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    841841        int index = text.find( QString::fromLatin1("\r\n"), 0 );
    842842        while ( index != -1 ) {
     
    14931493        return QCString();
    14941494
    1495 #ifdef Q_WS_WIN
     1495#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    14961496
    14971497
     
    16031603                file.insert(0,'/');
    16041604        }
    1605 #ifdef Q_WS_WIN
     1605#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    16061606        if ( file.length() > 2 && file[0] == '/' && file[2] == '|' ) {
    16071607            file[2] = ':';
     
    16131613#endif
    16141614    }
    1615 #ifdef Q_WS_WIN
     1615#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    16161616    else {
    16171617        file = uriToUnicodeUri(uri);
  • trunk/src/kernel/qeventloop_p.h

    r7 r8  
    6060#endif
    6161
    62 #if defined(Q_OS_UNIX) || defined (Q_WS_WIN)
     62#if defined(Q_OS_UNIX) || defined(Q_WS_WIN) || defined(Q_WS_PM)
    6363#include "qptrlist.h"
    64 #endif // Q_OS_UNIX || Q_WS_WIN
     64#endif // Q_OS_UNIX || Q_WS_WIN || Q_WS_PM
    6565
    66 #if defined(Q_OS_UNIX)
     66#if defined(Q_OS_UNIX) || defined(Q_WS_PM)
    6767struct QSockNot
    6868{
     
    8686#endif // Q_OS_UNIX
    8787
    88 #if defined(Q_WS_WIN)
     88#if defined(Q_WS_WIN) 
    8989struct QSockNot {
    9090    QSocketNotifier *obj;
     
    124124#endif // Q_WS_X11
    125125
    126 #if defined(Q_OS_UNIX)
     126#if defined(Q_OS_UNIX) 
    127127    int thread_pipe[2];
    128 
     128#endif
     129#if defined(Q_OS_UNIX) || defined(Q_WS_PM)
    129130    // pending socket notifiers list
    130131    QPtrList<QSockNot> sn_pending_list;
     
    135136#endif
    136137
    137 #ifdef Q_WS_WIN
     138#if defined(Q_WS_WIN)
    138139    // pending socket notifiers list
    139140    QPtrList<QSockNot> sn_pending_list;
    140141#endif // Q_WS_WIN
    141142
     143#if defined(Q_WS_PM)
     144    HAB hab;
     145    HMQ hmq;
     146#endif
     147
    142148};
    143149
  • trunk/src/kernel/qfont.cpp

    r7 r8  
    13941394        "courier",      "Courier New",
    13951395        "helvetica",    "Arial",
     1396#elif defined(Q_WS_PM)
     1397        "times",        "Times New Roman",
    13961398#endif
    1397 
    13981399        0,              0
    13991400    };
     
    31003101}
    31013102
    3102 #if defined(Q_WS_WIN ) || defined (Q_WS_QWS)
     3103#if defined(Q_WS_WIN) || defined(Q_WS_PM) || defined (Q_WS_QWS)
    31033104void QFontCache::cleanupPrinterFonts()
    31043105{
  • trunk/src/kernel/qfontdata_p.h

    r7 r8  
    101101        if ( family != other.family ) return family < other.family;
    102102
    103 #ifdef Q_WS_X11
     103#if defined(Q_WS_X11)
    104104        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
    107108        return FALSE;
    108109    }
     
    242243    void insertEngine( const Key &key, QFontEngine *engine );
    243244
    244 #if defined(Q_WS_WIN) || defined(Q_WS_QWS)
     245#if defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_WS_QWS)
    245246    void cleanupPrinterFonts();
    246247#endif
  • trunk/src/kernel/qfontdatabase.cpp

    r7 r8  
    7171#endif
    7272
     73#define SMOOTH_SCALABLE 0xffff
     74
    7375static int ucstricmp( const QString &as, const QString &bs )
    7476{
     
    138140    unsigned short pixelSize;
    139141
     142#ifdef Q_WS_PM
     143    unsigned short pointSize;                   // in deca-points
     144    LONG lMatch;
     145#endif
    140146#ifdef Q_WS_X11
    141147    int count;
     
    206212          fakeOblique( FALSE ), count( 0 ), pixelSizes( 0 )
    207213    {
    208 #if defined(Q_WS_X11)
     214#if defined(Q_WS_PM)
     215        szFacename[0] = 0;
     216#elif defined(Q_WS_X11)
    209217        weightName = setwidthName = 0;
    210 #endif // Q_WS_X11
     218#endif
    211219    }
    212220
     
    228236    QtFontSize *pixelSizes;
    229237
     238#ifdef Q_WS_PM
     239    CHAR szFacename [FACESIZE];
     240#endif
    230241#ifdef Q_WS_X11
    231242    const char *weightName;
     
    233244#endif // Q_WS_X11
    234245
     246#ifdef Q_WS_PM
     247    QtFontSize *pixelSize(
     248        unsigned short size, bool = FALSE, unsigned short pointSize = 0 );
     249#else   
    235250    QtFontSize *pixelSize( unsigned short size, bool = FALSE );
     251#endif   
    236252};
    237253
     
    247263}
    248264
     265#ifdef Q_WS_PM
     266QtFontSize *QtFontStyle::pixelSize(
     267    unsigned short size, bool add, unsigned short pointSize )
     268#else
    249269QtFontSize *QtFontStyle::pixelSize( unsigned short size, bool add )
     270#endif
    250271{
    251272    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       
    252283        if ( pixelSizes[i].pixelSize == size )
     284#endif           
    253285            return pixelSizes + i;
    254286    }
     
    261293                              (((count+8) >> 3 ) << 3) * sizeof(QtFontSize) );
    262294    pixelSizes[count].pixelSize = size;
     295#ifdef Q_WS_PM
     296    pixelSizes[count].pointSize = pointSize;
     297    pixelSizes[count].lMatch = 0;
     298#endif
    263299#ifdef Q_WS_X11
    264300    pixelSizes[count].count = 0;
     
    336372          name( n ), count( 0 ), foundries( 0 ) {
    337373        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       
    338379    }
    339380    ~QtFontFamily() {
     
    357398    bool fullyLoaded : 1;
    358399    QString name;
     400#ifndef Q_WS_X11
    359401    QString rawName;
     402#endif   
    360403#ifdef Q_WS_X11
    361404    QCString fontFilename;
     
    393436class QFontDatabasePrivate {
    394437public:
    395     QFontDatabasePrivate() : count( 0 ), families( 0 ) { }
     438    QFontDatabasePrivate() :
     439        count( 0 ), families( 0 ) { }
    396440    ~QFontDatabasePrivate() {
     441#ifdef Q_WS_PM
     442        cleanup();
     443#else
    397444        while ( count-- )
    398445            delete families[count];
    399446        free( families );
     447#endif
    400448    }
    401449    QtFontFamily *family( const QString &f, bool = FALSE );
     
    403451    int count;
    404452    QtFontFamily **families;
     453
     454#ifdef Q_WS_PM
     455    static QFontDatabasePrivate* instance();
     456private:   
     457    void cleanup() {
     458        while ( count )
     459            delete families[--count];
     460        free( families );
     461        families = 0;
     462    }
     463    void reload();
     464#endif
    405465};
    406466
     
    627687
    628688static QSingleCleanupHandler<QFontDatabasePrivate> qfontdatabase_cleanup;
     689#ifdef Q_WS_PM
     690QFontDatabasePrivate* 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
    629701static QFontDatabasePrivate *db=0;
    630 #define SMOOTH_SCALABLE 0xffff
     702#endif
    631703
    632704#if defined( Q_WS_X11 )
     
    636708#elif defined( Q_WS_WIN )
    637709#  include "qfontdatabase_win.cpp"
     710#elif defined( Q_WS_PM )
     711#  include "qfontdatabase_pm.cpp"
    638712#elif defined( Q_WS_QWS )
    639713#  include "qfontdatabase_qws.cpp"
     
    643717
    644718
    645 #if defined(Q_WS_X11) || defined(Q_WS_WIN)
     719#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_PM)
    646720static
    647721unsigned int bestFoundry( QFont::Script script, unsigned int score, int styleStrategy,
     
    650724                          QtFontFoundry **best_foundry, QtFontStyle **best_style,
    651725                          QtFontSize **best_size
    652 #ifdef Q_WS_X11
     726#if defined(Q_WS_X11)
    653727                          , QtFontEncoding **best_encoding, int force_encoding_id
     728#elif defined(Q_WS_PM)
     729                          , int pointSize
    654730#endif
    655731                          )
     
    711787        // 1. see if we have an exact matching size
    712788        if (! (styleStrategy & QFont::ForceOutline)) {
     789#if defined(Q_WS_PM)
     790            size = style->pixelSize(pixelSize, FALSE, pointSize);
     791#else           
    713792            size = style->pixelSize(pixelSize);
     793#endif           
    714794            if (size) px = size->pixelSize;
    715795        }
     
    843923#endif
    844924
     925#ifdef Q_WS_PM
     926    QFontDatabasePrivate *db = QFontDatabasePrivate::instance();
     927#else   
    845928    if ( !db )
    846929        initializeDb();
     930#endif
    847931
    848932    QFontEngine *fe = 0;
    849933    if ( fp ) {
     934#ifndef Q_WS_PM
    850935        if ( fp->rawMode ) {
    851936            fe = loadEngine( script, fp, request, 0, 0, 0
     
    859944            return fe;
    860945        }
     946#endif // !Q_WS_PM
    861947
    862948        QFontCache::Key key( request, script,
    863 #ifdef Q_WS_WIN
     949#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    864950                             (int)fp->paintdevice
    865951#else
     
    880966    parseFontName( request.family, foundry_name, family_name );
    881967
     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   
    8821007#ifdef Q_WS_X11
    8831008    if (family_name.isEmpty() && script == QFont::Han) {
     
    9051030              "    stretch: %d\n"
    9061031              "    pixelSize: %d\n"
     1032              "    pointSize: %d\n"
    9071033              "    pitch: %c",
    9081034              family_name.isEmpty() ? "-- first in script --" : family_name.latin1(),
    9091035              foundry_name.isEmpty() ? "-- any --" : foundry_name.latin1(),
    9101036              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 );
    9121040
    9131041#ifdef QT_XFT2
     
    9441072            uint score_adjust = 0;
    9451073            QFont::Script override_script = script;
     1074#ifndef Q_WS_PM
    9461075            if ( ! ( try_family->scripts[script] & QtFontFamily::Supported )
    9471076                 && script != QFont::Unicode) {
     
    9781107                }
    9791108            }
     1109#endif // !Q_WS_PM
    9801110
    9811111            QtFontFoundry *try_foundry = 0;
     
    9921122                             try_family, foundry_name, styleKey, request.pixelSize, pitch,
    9931123                             &try_foundry, &try_style, &try_size
    994 #ifdef Q_WS_X11
     1124#if defined(Q_WS_X11)
    9951125                             , &try_encoding, force_encoding_id
     1126#elif defined(Q_WS_PM)
     1127                             , request.pointSize
    9961128#endif
    9971129                    );
     
    10021134                                        QString::null, styleKey, request.pixelSize,
    10031135                                        pitch, &try_foundry, &try_style, &try_size
    1004 #ifdef Q_WS_X11
     1136#if defined(Q_WS_X11)
    10051137                                        , &try_encoding, force_encoding_id
     1138#elif defined(Q_WS_PM)
     1139                                        , request.pointSize
    10061140#endif
    10071141                    );
     
    10471181
    10481182            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)
    10501186                             , best_size, best_encoding, ( force_encoding_id >= 0 )
    10511187#endif
     
    10601196            }
    10611197
     1198#ifdef Q_WS_PM
     1199            // On OS/2, fontDef.pixelSize and fontDef.pointSize are filled
     1200            // by QFontEnginePM constructor
     1201#else             
    10621202            if ( best_style->smoothScalable )
    10631203                fe->fontDef.pixelSize = request.pixelSize;
     
    10821222                fe->fontDef.pointSize = request.pointSize;
    10831223            }
     1224#endif           
    10841225            fe->fontDef.styleHint     = request.styleHint;
    10851226            fe->fontDef.styleStrategy = request.styleStrategy;
     
    10941235
    10951236    if ( fe ) {
     1237#ifdef Q_WS_PM
     1238///@@TODO (dmik): should do something here?
     1239#else
    10961240        if ( script != QFont::Unicode && !canRender( fe, script ) ) {
    10971241            FM_DEBUG( "  WARN: font loaded cannot render sample 0x%04x",
     
    11171261            return fe;
    11181262        }
     1263#endif // !Q_WS_PM
    11191264
    11201265        if ( fp ) {
    11211266            QFontCache::Key key( request, script,
    1122 #ifdef Q_WS_WIN
     1267#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    11231268                                 (int)fp->paintdevice
    11241269#else
     
    11281273            QFontCache::instance->insertEngine( key, fe );
    11291274
     1275#ifndef Q_WS_PM
    11301276            for ( int i = 0; i < QFont::NScripts; ++i ) {
    11311277                if ( i == script ) continue;
     
    11371283                QFontCache::instance->insertEngine( key, fe );
    11381284            }
     1285#endif // !Q_WS_PM
    11391286        }
    11401287    } else {
    11411288        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
    11421293            FM_DEBUG( "returning box engine" );
    11431294
     
    11461297            if ( fp ) {
    11471298                QFontCache::Key key( request, script,
    1148 #ifdef Q_WS_WIN
     1299#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    11491300                                     (int)fp->paintdevice
    11501301#else
     
    11541305                QFontCache::instance->insertEngine( key, fe );
    11551306            }
     1307#endif // Q_WS_PM
    11561308        }
    11571309    }
     
    11591311    return fe;
    11601312}
    1161 #endif // Q_WS_X11 || Q_WS_WIN
     1313#endif // Q_WS_X11 || Q_WS_WIN || Q_WS_PM
    11621314
    11631315
     
    13551507QFontDatabase::QFontDatabase()
    13561508{
     1509#ifdef Q_WS_PM
     1510    d = QFontDatabasePrivate::instance();   
     1511#else   
    13571512    createDatabase();
    13581513
    13591514    d = db;
     1515#endif
    13601516}
    13611517
     
    16351791
    16361792                if (size->pixelSize != 0 && size->pixelSize != USHRT_MAX) {
    1637 #ifdef Q_WS_X11
     1793#if defined(Q_WS_X11)
    16381794                    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;
    16391800#else
    16401801                    const uint pointSize = size->pixelSize; // embedded uses 72dpi
     
    17401901
    17411902                if ( size->pixelSize != 0 && size->pixelSize != USHRT_MAX ) {
    1742 #ifdef Q_WS_X11
     1903#if defined(Q_WS_X11)
    17431904                    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;
    17441910#else
    17451911                    const uint pointSize = size->pixelSize; // embedded uses 72dpi
  • trunk/src/kernel/qfontengine_p.h

    r7 r8  
    4040#endif
    4141
     42#ifdef Q_WS_PM
     43#include "qt_os2.h"
     44#endif
     45
    4246#include "qtextengine_p.h"
    4347
    4448class QPaintDevice;
    4549
    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;
    5258struct TransformedFont;
    5359
    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 )
    5561class QFontEngine : public QShared
    5662{
     
    7177        Win,
    7278        Uniscribe,
     79
     80        // OS/2 types
     81        PM,
    7382
    7483        // Apple MacOS types
     
    151160    short rbearing;
    152161#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
    153170#ifdef Q_WS_X11
    154171    TransformedFont *transformed_fonts;
     
    605622#endif
    606623
    607 #endif // Q_WS_WIN
    608 
    609 #endif
     624#elif defined( Q_WS_PM )
     625
     626class QFontEnginePM : public QFontEngine
     627{
     628public:
     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  
    827827    pixmap->fill( dis.background() );
    828828
     829    if ( !normalMask.mask() )
     830        normalMask.setMask( normalMask );
     831   
    829832    QPainter painter;
    830833    painter.begin( pixmap );
    831     painter.setPen( dis.base() );
     834    painter.setPen( dis.light() );
    832835    painter.drawPixmap( 1, 1, normalMask );
    833     painter.setPen( dis.foreground() );
     836    painter.setPen( dis.dark() );
    834837    painter.drawPixmap( 0, 0, normalMask );
    835838    painter.end();
    836 
    837     if ( !normalMask.mask() )
    838         normalMask.setMask( normalMask );
    839839
    840840    QBitmap mask( pixmap->size() );
  • trunk/src/kernel/qlocalfs.cpp

    r7 r8  
    155155                           fi->size(), fi->lastModified(), fi->lastRead(), fi->isDir(), fi->isFile(),
    156156                           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        }
    157166    }
    158167    emit newChildren( infos, op );
  • trunk/src/kernel/qmime.cpp

    r7 r8  
    356356    QStringList::Iterator it;
    357357    if ( abs_name[0] == '/'
    358 #ifdef Q_WS_WIN
     358#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    359359            || ( abs_name[0] && abs_name[1] == ':' ) || abs_name.startsWith("\\\\")
    360360#endif
     
    456456    if ( context.isNull() ||
    457457         !(context[0] == '/'
    458 #ifdef Q_WS_WIN
     458#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    459459         || ( context[0] && context[1] == ':')
    460460#endif
  • trunk/src/kernel/qnetworkprotocol.cpp

    r7 r8  
    8484            oldOps.removeFirst();
    8585        }
    86         delete opStartTimer;
    8786    }
    8887
     
    430429QNetworkProtocol::~QNetworkProtocol()
    431430{
     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    }
    432438    delete d;
    433439}
     
    12571263void QNetworkOperation::deleteMe()
    12581264{
    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;
    12601271}
    12611272
  • trunk/src/kernel/qobject.cpp

    r7 r8  
    214214
    215215
    216 // Event functions, implemented in qapplication_xxx.cpp
     216// Event functions, implemented in qeventloop_xxx.cpp
    217217
    218218int   qStartTimer( int interval, QObject *obj );
  • trunk/src/kernel/qpainter.cpp

    r7 r8  
    16351635        } else {
    16361636            txop = TxScale;
    1637 #if defined(Q_WS_WIN)
     1637#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    16381638            setf(DirtyFont);
    16391639#endif
     
    16411641    } else {
    16421642        txop = TxRotShear;
    1643 #if defined(Q_WS_WIN)
     1643#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    16441644        setf(DirtyFont);
    16451645#endif
     
    23452345        if ( !pdev->cmd( QPaintDevice::PdcDrawPixmap, this, param ) || !hdc )
    23462346            return;
     2347#elif defined(Q_WS_PM)
     2348        if ( !pdev->cmd( QPaintDevice::PdcDrawPixmap, this, param ) || !hps )
     2349            return;
    23472350#elif defined(Q_WS_QWS)
    23482351        pdev->cmd( QPaintDevice::PdcDrawPixmap, this, param );
     
    24932496        if ( !pdev->cmd( QPaintDevice::PdcDrawImage, this, param ) || !hdc )
    24942497            return;
     2498#elif defined(Q_WS_PM)
     2499        if ( !pdev->cmd( QPaintDevice::PdcDrawImage, this, param ) || !hps )
     2500            return;
    24952501#elif defined (Q_WS_QWS)
    24962502        pdev->cmd( QPaintDevice::PdcDrawImage, this, param );
     
    25512557#if defined(Q_WS_WIN)
    25522558        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 )
    25532562            return;
    25542563#elif defined(Q_WS_QWS)
     
    27932802                     !hdc )
    27942803                    return;                     // QPrinter wants PdcDrawText2
     2804#elif defined(Q_WS_PM)
     2805                if ( !pdev->cmd( QPaintDevice::PdcDrawText2Formatted,
     2806                                 this, param) ||
     2807                     !hps )
     2808                    return;
    27952809#elif defined(Q_WS_QWS)
    27962810                pdev->cmd( QPaintDevice::PdcDrawText2Formatted, this, param);
  • trunk/src/kernel/qpixmap.cpp

    r7 r8  
    367367#if defined(Q_WS_WIN)
    368368        hdc = pixmap.hdc;                       // copy Windows device context
     369#elif defined(Q_WS_PM)
     370        hps = pixmap.hps;                       // copy OS/2 PM presentation space
    369371#elif defined(Q_WS_X11)
    370372        hd = pixmap.hd;                         // copy X11 drawable
     
    475477#if defined(Q_WS_WIN)
    476478        hdc = pixmap.hdc;
     479#elif defined(Q_WS_PM)
     480        hps = pixmap.hps;
    477481#elif defined(Q_WS_X11)
    478482        hd = pixmap.hd;                         // copy QPaintDevice drawable
     
    735739            delete data->mask;
    736740            data->mask = 0;
     741#if defined (Q_WS_PM)
     742            if ( data->maskedHbm ) {
     743                GpiDeleteBitmap( data->maskedHbm );
     744                data->maskedHbm = 0;
     745            }
     746#endif
    737747        }
    738748        return;
     
    754764    data->alphapm = 0;
    755765#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
    756773
    757774    delete data->mask;
  • trunk/src/kernel/qrichtext.cpp

    r7 r8  
    7676#endif
    7777
     78#ifdef Q_WS_PM
     79#include "qt_os2.h"
     80#endif
     81
    7882#define QChar_linesep QChar(0x2028U)
    7983
     
    98102            value = value * metrics.logicalDpiY() / gdc;
    99103        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;
    100109#elif defined (Q_WS_MAC)
    101110        value = value * metrics.logicalDpiY() / 75; // ##### FIXME
     
    517526    bool justInsert = TRUE;
    518527    QString s( str );
    519 #if defined(Q_WS_WIN)
     528#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    520529    if ( checkNewLine ) {
    521530        int i = 0;
  • trunk/src/kernel/qscriptengine.cpp

    r7 r8  
    10411041#elif defined( Q_WS_WIN )
    10421042# include "qscriptengine_win.cpp"
     1043#elif defined( Q_WS_PM )
     1044# include "qscriptengine_pm.cpp"
    10431045#elif defined( Q_WS_MAC )
    10441046# include "qscriptengine_mac.cpp"
  • trunk/src/kernel/qsizegrip.cpp

    r7 r8  
    5050#include "qobjectlist.h"
    5151#include "qt_windows.h"
     52#elif defined (Q_WS_PM)
     53#include "qobjectlist.h"
     54#include "qt_os2.h"
    5255#elif defined(Q_WS_MAC)
    5356bool qt_mac_update_sizer(QWidget *, int); //qwidget_mac.cpp
     
    236239        tlw->resize( w, h );
    237240    }
    238 #ifdef Q_WS_WIN
     241#if defined (Q_WS_WIN)
    239242    MSG msg;
    240243    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 ) )
    241249      ;
    242250#endif
  • trunk/src/kernel/qt_gfx.pri

    r7 r8  
    77        system-mng {
    88            win32:LIBS += libmng.lib
     9            os2:LIBS += libmng.lib
    910            unix:LIBS  += -lmng
    1011        } else {
     
    4647           unix:LIBS += -ljpeg
    4748           win32:LIBS += libjpeg.lib
     49           os2:LIBS += libjpeg.lib
    4850        } else {
    4951            INCLUDEPATH += 3rdparty/libjpeg
     
    105107            unix:LIBS  += -lpng
    106108            win32:LIBS += libpng.lib
     109            os2:LIBS += png.lib
    107110        } else {
    108111            INCLUDEPATH  += 3rdparty/libpng
     
    147150   unix:LIBS += -lz
    148151   win32:LIBS += libz.lib
     152   os2:LIBS += z.lib
    149153}
    150154
  • trunk/src/kernel/qt_kernel.pri

    r7 r8  
    122122                  $$KERNEL_CPP/qfontengine_win.cpp
    123123
     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
    124141        unix:x11 {
    125142              SOURCES += $$KERNEL_CPP/qapplication_x11.cpp \
     
    260277        }
    261278}
     279
     280#@@TODO(dmik): headers and sources below are substracted until implemented
     281os2 {
     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  
    826826#elif defined( Q_WS_WIN )
    827827# include "qtextengine_win.cpp"
     828#elif defined( Q_WS_PM )
     829# include "qtextengine_pm.cpp"
    828830#elif defined( Q_WS_MAC )
    829831# include "qtextengine_mac.cpp"
  • trunk/src/kernel/qtextengine_p.h

    r7 r8  
    167167    unsigned short reserved          :1;
    168168    unsigned short engineReserved    :2;
     169};
     170
     171inline 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.
     188typedef unsigned char glyph_t;
     189//typedef unsigned short glyph_t;
     190
     191struct qoffset_t {
     192    int x;
     193    int y;
     194};
     195
     196typedef int advance_t;
     197
     198//@@TODO (dmik): it's a dummy version...
     199struct QScriptAnalysis {
     200    unsigned short script         :10;
     201    unsigned short bidiLevel         :5;
     202    unsigned short override          :1;
     203    unsigned short reserved          :1;
    169204};
    170205
  • trunk/src/kernel/qthread.cpp

    r7 r8  
    4141#include <private/qthreadinstance_p.h>
    4242
     43#ifndef QT_NO_COMPAT
    4344#ifndef QT_H
    4445#  include "qapplication.h"
    4546#endif // QT_H
     47#endif // QT_NO_COMPAT
    4648
    4749#if QT_VERSION >= 0x040000
  • trunk/src/kernel/qtranslator.cpp

    r7 r8  
    406406
    407407    if ( filename[0] == '/'
    408 #ifdef Q_WS_WIN
     408#if defined(Q_WS_WIN) || defined(Q_WS_PM)
    409409         || (filename[0] && filename[1] == ':') || filename[0] == '\\'
    410410#endif
  • trunk/src/kernel/qurl.cpp

    r7 r8  
    834834        d->host.remove( (uint)0, 1 );
    835835
    836 #if defined(Q_OS_WIN32)
     836#if defined(Q_OS_WIN32) || defined(Q_OS_OS2)
    837837    // hack for windows file://machine/path syntax
    838838    if ( d->protocol == "file" ) {
     
    10281028            d->cleanPath = d->path;
    10291029        } else if ( isLocalFile() ) {
    1030 #if defined(Q_OS_WIN32)
     1030#if defined(Q_OS_WIN32) || defined(Q_OS_OS2)
    10311031            // hack for stuff like \\machine\path and //machine/path on windows
    10321032            if ( ( d->path.left( 1 ) == "/" || d->path.left( 1 ) == "\\" ) &&
     
    11011101{
    11021102    if ( d->path.isEmpty() || d->path.endsWith( "/" )
    1103 #ifdef Q_WS_WIN
     1103#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
    11041104        || d->path.endsWith( "\\" )
    11051105#endif
  • trunk/src/kernel/qwidget.cpp

    r7 r8  
    6161#include "qinputcontext_p.h"
    6262#endif
     63#if defined(Q_WS_PM)
     64#include "qt_os2.h"
     65#endif
    6366#if defined(Q_WS_QWS)
    6467#include "qwsmanager_qws.h"
     
    513516  QWidget utility functions
    514517 *****************************************************************************/
    515 
    516518static QFont qt_naturalWidgetFont( QWidget* w ) {
    517519    QFont naturalfont = QApplication::font( w );
     
    32593261#if defined(Q_WS_WIN)
    32603262        && 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()
    32613267#endif
    32623268        )
     
    32943300            SetFocus( winId() );
    32953301        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 {
    32963308#endif
    32973309#if defined(QT_ACCESSIBILITY_SUPPORT)
    32983310            QAccessible::updateAccessibility( this, 0, QAccessible::Focus );
    32993311#endif
    3300 #if defined(Q_WS_WIN)
     3312#if defined(Q_WS_WIN) // || defined(Q_WS_PM)
    33013313        }
    33023314#endif
     
    33453357            SetFocus( 0 );
    33463358        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 {
    33473365#endif
    33483366#if defined(QT_ACCESSIBILITY_SUPPORT)
    33493367            QAccessible::updateAccessibility( this, 0, QAccessible::Focus );
    33503368#endif
    3351 #if defined(Q_WS_WIN)
     3369#if defined(Q_WS_WIN) // || defined(Q_WS_PM)
    33523370        }
    33533371#endif
     
    35673585    }
    35683586#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.
    35693591
    35703592    return FALSE;
     
    39854007    // On Windows, show the popup now so that our own focus handling
    39864008    // 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.       
    39874010#if defined(Q_WS_WIN)
    39884011    if ( testWFlags(WType_Popup) )
     
    40064029        showWindow();
    40074030
    4008 #if !defined(Q_WS_WIN)
     4031//@@TODO (dmik): need the same in OS/2? guess not.       
     4032#if !defined(Q_WS_WIN)
    40094033    if ( testWFlags(WType_Popup) )
    40104034        qApp->openPopup( this );
     
    40484072        qt_leave_modal( this );
    40494073
    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)
    40514076    if ( isTopLevel() && !isPopup() && parentWidget() && isActiveWindow() )
    40524077        parentWidget()->setActiveWindow();      // Activate parent
     
    49274952        }
    49284953
     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.         
    49294959    case QEvent::WindowBlocked:
    49304960    case QEvent::WindowUnblocked:
     
    49384968        }
    49394969        break;
     4970#endif       
    49404971
    49414972    default:
     
    55275558*/
    55285559bool 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*/
     5580bool QWidget::pmEvent( QMSG * )
    55295581{
    55305582    return FALSE;
Note: See TracChangeset for help on using the changeset viewer.