Changeset 174 for trunk


Ignore:
Timestamp:
Nov 6, 2007, 11:27:57 PM (18 years ago)
Author:
dmik
Message:

Styles: Implemented the first version of the Warp4 style (contributed by Cornelis Bockemuehl).

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.cmd

    r167 r174  
    5050Opt.!RELEASE    = 1
    5151Opt.!DLL        = 1
    52 Opt.!CustomDLLName = 'myqt'   
     52Opt.!CustomDLLName = 'myqt'
    5353/* optional module configuration */
    5454Opt.!NETWORK    = 1
     
    304304    call WriteVar G.!ConfigCache, 'Opt.!Extra.!FT2LIB.!choice'
    305305    call WriteVar G.!ConfigCache, 'Opt.!Extra.!FT2LIB.!enabled'
    306 */   
     306*/
    307307    call WriteVar G.!ConfigCache, 'Opt.!QTCustomDefines'
    308    
     308
    309309    call lineout G.!ConfigCache
    310310
     
    424424    /*
    425425     *  determine whether to setup the environment for the debug version of Qt
    426      *  or for the release one 
     426     *  or for the release one
    427427     */
    428428    call lineout G.!QtCmd, '/* determine the default DEBUG value using .qtos2config */'
     
    442442    call lineout G.!QtCmd, 'else parse arg args'
    443443    call lineout G.!QtCmd, ''
    444     /* 
     444    /*
    445445     *  setup GCC before everything else, to prevent it from possible reordering
    446446     *  of some essential paths
     
    479479     *  in order to appear last in PATH (to ensure that, on the contrary, paths
    480480     *  to the linker and to the make tool choosen by the user are always at
    481      *  the beginning) 
     481     *  the beginning)
    482482     */
    483483    call ConfigureCompiler_GenAddPathEnv 'PATH',,
     
    556556
    557557    /* Qt library type */
    558    
     558
    559559    G.!Choices.0 = 2
    560560    G.!Choices.1 = 'Dynamic link library (DLL)'
     
    562562    choice = GetChoice('Select the Qt library type:', 'G.!Choices', -Opt.!DLL + 2)
    563563    Opt.!DLL = -choice + 2
    564    
     564
    565565    OfficialBuildConfig = ''
    566    
     566
    567567    if (Opt.!DLL == 1) then do
    568         call SaySay 'You are going to build Qt as a dynamic link library.  In order' 
     568        call SaySay 'You are going to build Qt as a dynamic link library.  In order'
    569569        call SaySay 'to prevent possible DLL naming conflicts (a.k.a. DLL hell) with'
    570570        call SaySay 'the official binary distribution of Qt and with other custom'
     
    583583                leave
    584584            end
    585             upperName = translate(name) 
     585            upperName = translate(name)
    586586            if (upperName \= '' & length(upperName) <= 8 &,
    587587                verify(upperName,'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_') == 0 &,
     
    597597
    598598    /* Qt library debug level */
    599    
     599
    600600    G.!Choices.0 = 2
    601601    G.!Choices.1 = 'Release (no debug information)'
     
    605605
    606606    /* Optional Qt modules */
    607    
     607
    608608    G.!Choices.0 = 6
    609609    do forever
     
    655655
    656656    call WriteConfigCache
    657 */   
     657*/
    658658    /* Custom Qt defines */
    659                  
     659
    660660    if (OfficialBuildConfig == '') then do
    661661        call SaySay 'Enter a list of custom Qt defines separated by spaces'
     
    665665        Opt.!QTCustomDefines = strip(Opt.!QTCustomDefines)
    666666    end
    667    
     667
    668668    call WriteConfigCache
    669669
    670670    /* Generate setup files for Qt */
    671    
     671
    672672    BasicModules = 'kernel tools widgets dialogs styles'
    673673    BasicModulesHeader =,
     
    749749*/
    750750    ExtraConfig = strip(ExtraConfig)
    751    
     751
    752752    ConfigHeader =,
    753753        '/* Everything */'G.!EOL||,
     
    769769        '#define QT_NO_STYLE_WINDOWSXP'G.!EOL||,
    770770        '#endif'G.!EOL
    771    
     771
    772772    ConfigSource =,
    773773        '#include <qglobal.h>'G.!EOL||,
     
    793793        'const char *qInstallPathTranslations() { return QT_INSTALL_TRANSLATIONS + 11; }'G.!EOL||,
    794794        'const char *qInstallPathSysconf() { return 0; }'G.!EOL
    795        
     795
    796796    call SaySay 'You have selected the following compiler configuration:'
    797797    say
     
    805805    call SaySay 'Modules        : 'BasicModules OptionalModules
    806806    call SaySay 'Other features : 'OptionalConfig
    807     if (Opt.!QTCustomDefines \= '') then   
     807    if (Opt.!QTCustomDefines \= '') then
    808808        call SaySay 'Custom defines : 'Opt.!QTCustomDefines
    809809    say
     
    834834    call lineout qmake_cache, 'sql-drivers+='
    835835    call lineout qmake_cache, 'sql-plugins+='
    836     call lineout qmake_cache, 'styles+=windows'
     836    call lineout qmake_cache, 'styles+=windows warp4 motif'
    837837    call lineout qmake_cache, 'style-plugins+='
    838838    call lineout qmake_cache, 'imageformat-plugins+='
     
    879879     *  recompiling every source when no affecting settings are changed
    880880     */
    881    
     881
    882882    create = \FileExists(qmodules_h)
    883883    if (\create) then create = CompareFileToVar(qmodules_h, ModulesHeader) \= 0
     
    903903        call charout qconfig_cpp
    904904    end
    905    
     905
    906906    call CopyFile QuotePath(G.!QTDirP)'\qmake\"Makefile.os2-g++"',,
    907907                  G.!QMakeMakefile
     
    944944        call DeleteFile build_log
    945945    end
    946    
     946
    947947    build_target = ''
    948948
     
    11741174    if (Opt.!Extra.!FT2LIB.!changed \== 1) then def = 'Y'; else def = ''
    11751175    return GetYesNo("Accept the above version?", def)
    1176    
     1176
    11771177/**
    11781178 */
     
    12051205    if (contents > aVar) then return 1
    12061206    return 0
    1207  
     1207
    12081208CopyFile: procedure expose (Globals)
    12091209    parse arg fileFrom, fileTo
     
    12871287    call SysCurPos row, col
    12881288    return
    1289    
     1289
    12901290/**
    12911291 *  Displays a prompt to input a text line and returns the line entered by the
     
    13091309    allow_empty = pos('N', mode) == 0
    13101310    allow_cancel = pos('C', mode) > 0
    1311    
     1311
    13121312    line = default
    13131313    len = length(line)
     
    13241324            iterate
    13251325        end
    1326        
     1326
    13271327        select
    13281328            when (\extended & key == '08'x) then do
     
    14051405        end
    14061406    end
    1407    
     1407
    14081408    say
    14091409    return line
     
    16481648
    16491649    parse arg stem, prompt, searchPattern, checkPath, checkVer, errPath, mode
    1650    
     1650
    16511651    mode = translate(mode)
    16521652    if (pos('C', mode) > 0) then mode = 'C'
     
    16541654
    16551655    if (symbol('Static.!MenuSelectPath.!Recent') \= 'VAR') then
    1656         Static.!MenuSelectPath.!Recent = '' 
    1657    
     1656        Static.!MenuSelectPath.!Recent = ''
     1657
    16581658    do forever
    16591659
     
    16651665        choice = GetChoice(prompt, stem, default, mode)
    16661666        call SysStemDelete stem, n
    1667    
     1667
    16681668        if (choice == -1) then return '' /* canceled */
    16691669
     
    16731673                            '(or Esc to cancel):',,
    16741674                            Static.!MenuSelectPath.!Recent)
    1675             if (path == '') then iterate /* canceled */ 
     1675            if (path == '') then iterate /* canceled */
    16761676            Static.!MenuSelectPath.!Recent = path
    16771677            call SaySay 'Please wait...'
     
    17421742    parse arg path
    17431743    return Replace(path, '\', '\\')
    1744    
     1744
    17451745/**
    17461746 *  Fixes the directory path by a) converting all slashes to back
     
    18361836    say 'RC:255:CR'
    18371837    exit 255
    1838    
     1838
    18391839/**
    18401840 *  Magic log handler.
     
    18451845    file = strip(file)
    18461846    signal on halt name MagicLogHalt
    1847     rc = 0 
     1847    rc = 0
    18481848    do while (stream('STDIN', 'S') == 'READY')
    18491849        line = linein()
  • trunk/src/kernel/qapplication.cpp

    r172 r174  
    12351235            else
    12361236                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
    12401242#elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS)
    12411243            style = "CDE";                      // default style for X11 on Solaris
     
    12531255        if ( !app_style &&              // platform default style not available, try alternatives
    12541256             !(app_style = QStyleFactory::create( "Windows" ) ) &&
     1257//           !(app_style = QStyleFactory::create( "Warp4" ) ) &&
    12551258             !(app_style = QStyleFactory::create( "Platinum" ) ) &&
    12561259             !(app_style = QStyleFactory::create( "MotifPlus" ) ) &&
     
    13701373  The string must be one of the QStyleFactory::keys(), typically one
    13711374  of "windows", "motif", "cde", "motifplus", "platinum", "sgi" and
    1372   "compact". Depending on the platform, "windowsxp", "aqua" or
     1375  "compact". Depending on the platform, "windowsxp", "warp4", "aqua" or
    13731376  "macintosh" may be available.
    13741377
  • trunk/src/kernel/qapplication_pm.cpp

    r171 r174  
    131131                           const QPixmap *, int, int, int );
    132132
     133Q_EXPORT
    133134QRgb qt_sysclr2qrgb( LONG sysClr )
    134135{
     
    139140}
    140141
    141 QFont qt_sysfont2qfont( const PSZ scope ) {
     142static
     143QFont qt_sysfont2qfont( const PSZ scope )
     144{
    142145    static const PSZ app = "PM_SystemFonts";
    143     static const PSZ def = "8.Helv";
     146    static const PSZ def = "10.System Proportional";
    144147    ULONG keyLen = 0;
    145     QFont f( "Helv", 8 );
     148    QFont f( "System Proportional", 10 );
    146149
    147150    if ( PrfQueryProfileSize( HINI_USERPROFILE, app, scope, &keyLen ) && keyLen ) {
     
    369372    // Do the font settings
    370373
     374#ifndef QT_PM_NO_DEFAULTFONT_OVERRIDE
    371375    QFont windowFont = qt_sysfont2qfont( "WindowText" );
     376#else
     377    QFont windowFont = qt_sysfont2qfont( "DefaultFont" );
     378#endif
    372379    QFont menuFont = qt_sysfont2qfont( "Menus" );
    373380    QFont iconFont = qt_sysfont2qfont( "IconText" );
     
    440447    *qt_std_pal = pal;
    441448
    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,
    444457                  QColor( qt_sysclr2qrgb( SYSCLR_MENUHILITEBGND ) ) );
    445     acg.setColor( QColorGroup::HighlightedText,
     458    scg.setColor( QColorGroup::HighlightedText,
    446459                  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" );
    449474}
    450475
     
    457482{
    458483public:
    459     static bool &installed() { return QtOS2SysXcptMainHandler::installed; } 
     484    static bool &installed() { return QtOS2SysXcptMainHandler::installed; }
    460485    static ERR &libcHandler() { return QtOS2SysXcptMainHandler::libcHandler; }
    461486    static ERR handler() { return QtOS2SysXcptMainHandler::handler; }
     
    486511    DosGetInfoBlocks( &ptib, NULL );
    487512    Q_ASSERT( ptib && ptib->tib_ptib2 );
    488    
     513
    489514    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
    491516        Q_ASSERT( ptib->tib_ptib2->tib2_ultid == 1 );
    492517        // also make sure that QtOS2SysXcptMainHandler was not already
     
    551576    // default font
    552577    if ( !qt_app_has_font )
    553         QApplication::setFont( QFont( "Helv", 8 ) );
     578        QApplication::setFont( QFont( "System Proportional", 10 ) );
    554579
    555580    // QFont::locale_init();  ### Uncomment when it does something on OS/2
     
    590615
    591616#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()
    593618    PTIB ptib = NULL;
    594619    DosGetInfoBlocks( &ptib, NULL );
    595620    Q_ASSERT( ptib && ptib->tib_ptib2 );
    596    
     621
    597622    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
    599624        Q_ASSERT( ptib->tib_ptib2->tib2_ultid == 1 );
    600625        // also make sure the handler was really installed by qt_init()
     
    10031028enum {
    10041029    // some undocumented messages (they have the WM_U_ prefix for clarity)
    1005    
     1030
    10061031    // sent to hwnd that has been entered to by a mouse pointer.
    10071032    // FID_CLIENT also receives enter messages of its WC_FRAME.
     
    20642089        return;
    20652090    }
    2066    
     2091
    20672092    // find the modal's group leader
    20682093    QWidget *mgl = modal->parentWidget();
     
    25482573#endif
    25492574        if ( curWin != winId() ) {              // new current window
    2550 /// @todo (dmik)           
     2575/// @todo (dmik)
    25512576//  add CS_HITTEST to our window classes and handle WM_HITTEST,
    25522577//  otherwise disabled windows will not get mouse events?
     
    27642789//  Alt+letter shortcuts in the NLS keyboard mode together with Alt+NLS_letter
    27652790//  shortcuts  (nice feature imho). Note that Alt+NLS_letter shortcuts are
    2766 //  correctly processed in any case. 
     2791//  correctly processed in any case.
    27672792
    27682793// cache table to store Qt::Key_... values for 256 hardware scancodes
  • trunk/src/kernel/qfont_pm.cpp

    r8 r174  
    5858{
    5959    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:
    7382            // the family to be used when no StyleHint is set (in accordance
    7483            // with the font matching algorithm stated in QFont docs)
    75             return QString::fromLatin1("Helvetica");
     84            return QString::fromLatin1( "Helvetica" );
    7685    }
    7786//@@TODO (dmik): should we also add default font substitutions to
     
    7988}
    8089
    81 //@@TODO (dmik): remove
    82 //extern HDC   shared_dc;               // common dc for all fonts
    83 
    84 //@@TODO (dmik): remove?
    85 //// ### maybe move to qapplication_win
    86 //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 //      else
    103 //          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 
    15790/*****************************************************************************
    15891  QFont member functions
     
    16598    if ( QFontCache::instance )
    16699        return;
    167 //@@TODO (dmik): remove
    168 //    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 //#endif
    173100    new QFontCache();
    174101
     
    180107{
    181108    delete QFontCache::instance;
    182 //@@TODO (dmik): remove
    183 //    DeleteDC( shared_dc );
    184 //    shared_dc = 0;
    185109}
    186110
     
    194118    // sanity checks
    195119    if (!QFontCache::instance)
    196         qWarning("Must construct a QApplication before a QFont");
     120        qWarning("Must construct a QApplication before a QFont");
    197121    Q_ASSERT( script >= 0 && script < QFont::LastPrivateScript );
    198122#endif // QT_CHECK_STATE
     
    204128    } else {
    205129        DevQueryCaps( GpiQueryDevice( qt_display_ps() ),
    206             CAPS_VERTICAL_FONT_RES, 1, (PLONG) &dpi );
     130                      CAPS_VERTICAL_FONT_RES, 1, (PLONG) &dpi );
    207131    }
    208132    if (req.pointSize != -1)
     
    212136
    213137    if ( ! engineData ) {
    214         QFontCache::Key key( req, QFont::NoScript, (int)paintdevice );
    215 
    216         // look for the requested font in the engine data cache
    217         engineData = QFontCache::instance->findEngineData( key );
    218 
    219         if ( ! engineData) {
    220             // create a new one
    221             engineData = new QFontEngineData;
    222             QFontCache::instance->insertEngineData( key, engineData );
    223         } else {
    224             engineData->ref();
    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        }
    226150    }
    227151
     
    239163
    240164    if (!req.family.isEmpty()) {
    241         family_list = QStringList::split( ',', req.family );
    242 
    243         // append the substitute list for each family in family_list
    244         QStringList subs_list;
    245         QStringList::ConstIterator it = family_list.begin(), end = family_list.end();
    246         for ( ; it != end; ++it )
    247             subs_list += QFont::substitutes( *it );
    248         family_list += subs_list;
     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;
    249173
    250174//@@TODO (dmik): need something here?
    251         // append the default fallback font for the specified script
    252         // family_list << ... ; ###########
     175        // append the default fallback font for the specified script
     176        // family_list << ... ; ###########
    253177
    254178        // add the family corresponding to font's styleHint
    255179        QString hintFamily = qt_pm_default_family( request.styleHint );
    256         if ( ! family_list.contains( hintFamily ) )
     180        if ( ! family_list.contains( hintFamily ) )
    257181            family_list << hintFamily;
    258182
     
    262186//  below added to the list.
    263187
    264         // add the default family
    265         QString defaultFamily = QApplication::font().family();
    266         if ( ! family_list.contains( defaultFamily ) )
    267             family_list << defaultFamily;
    268 
    269         // add QFont::defaultFamily() to the list, for compatibility with
    270         // previous versions
    271         family_list << QApplication::font().defaultFamily();
     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();
    272196    }
    273197
     
    277201    QStringList::ConstIterator it = family_list.begin(), end = family_list.end();
    278202    for ( ; ! engine && it != end; ++it ) {
    279         req.family = *it;
    280 
    281         engine = QFontDatabase::findFont( script, this, req );
    282         if ( engine ) {
    283             if ( engine->type() != QFontEngine::Box )
    284                 break;
    285 
    286             if ( ! req.family.isEmpty() )
    287                 engine = 0;
    288 
    289             continue;
    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        }
    291215    }
    292216
     
    343267QString QFont::lastResortFont() const
    344268{
    345     return QString::fromLatin1("System Proportional");
     269    return QString::fromLatin1( "System Proportional" );
    346270}
    347271
     
    351275  QFontMetrics member functions
    352276 *****************************************************************************/
    353 
    354 //@@TODO (dmik): remove
    355 //#define IS_TRUETYPE (QT_WA_INLINE( engine->tm.w.tmPitchAndFamily, engine->tm.a.tmPitchAndFamily ) & TMPF_TRUETYPE)
    356 //#define TMX engine->tm.w
    357 //#define TMW engine->tm.w
    358 //#define TMA engine->tm.a
    359277
    360278//@@TODO (dmik): do we need a separate (other than in qfont.cpp)
  • trunk/src/styles/qstylefactory.cpp

    r2 r174  
    5252#include "qwindowsxpstyle.h"
    5353#endif
     54#ifndef QT_NO_STYLE_WARP4
     55#include "qwarp4style.h"
     56#endif
    5457#ifndef QT_NO_STYLE_AQUA
    5558#include "qaquastyle.h"
     
    109112    including "windows", "motif", "cde", "motifplus", "platinum",
    110113    "sgi" and "compact". Depending on the platform, "windowsxp",
    111     "aqua" or "macintosh" may be available.
     114    "warp4", "aqua" or "macintosh" may be available.
    112115*/
    113116
     
    132135    else
    133136#endif
     137#ifndef QT_NO_STYLE_WARP4
     138    if ( style == "warp4" )
     139        ret = new QWarp4Style;
     140    else
     141#endif
    134142#ifndef QT_NO_STYLE_MOTIF
    135143    if ( style == "motif" )
     
    165173    if ( style == "aqua" )
    166174        ret = new QAquaStyle;
     175    else
    167176#endif
    168177#ifndef QT_NO_STYLE_POCKETPC
    169178    if ( style == "pocketpc" )
    170         ret = new QPocketPCStyle;
     179        ret = new QPocketPCStyle;
     180    else
    171181#endif
    172182#if !defined( QT_NO_STYLE_MAC ) && defined( Q_WS_MAC )
    173183    if( style.left(9) == "macintosh" )
    174         ret = new QMacStyle;
     184        ret = new QMacStyle;
     185    else
    175186#endif
    176187    { } // Keep these here - they make the #ifdefery above work
     
    216227    if ( !list.contains( "WindowsXP" ) && QWindowsXPStyle::resolveSymbols() )
    217228        list << "WindowsXP";
     229#endif
     230#ifndef QT_NO_STYLE_WARP4
     231    if ( !list.contains( "Warp4" ) )
     232        list << "Warp4";
    218233#endif
    219234#ifndef QT_NO_STYLE_MOTIF
  • trunk/src/styles/qt_styles.pri

    r2 r174  
    1212
    1313        contains( styles, all ) {
    14                 styles += mac cde motifplus sgi platinum compact interlace windows motif
     14                styles += mac cde motifplus sgi platinum compact interlace windows warp4 motif
    1515        }
    1616
     
    1919                HEADERS +=$$STYLES_H/qmacstyle_mac.h
    2020                SOURCES +=$$STYLES_CPP/qmacstyle_mac.cpp
    21                 HEADERS *= $$STYLES_CPP/qaquastyle_p.h 
    22                 SOURCES *= $$STYLES_CPP/qaquastyle_p.cpp 
     21                HEADERS *= $$STYLES_CPP/qaquastyle_p.h
     22                SOURCES *= $$STYLES_CPP/qaquastyle_p.cpp
    2323
    2424                !contains( styles, windows ) {
     
    3131        #embedded|!macx-*:styles -= aqua
    3232        contains( styles, aqua ) {
    33                 HEADERS += $$STYLES_H/qaquastyle.h 
    34                 SOURCES += $$STYLES_CPP/qaquastyle.cpp 
    35                 HEADERS *= $$STYLES_CPP/qaquastyle_p.h 
    36                 SOURCES *= $$STYLES_CPP/qaquastyle_p.cpp 
     33                HEADERS += $$STYLES_H/qaquastyle.h
     34                SOURCES += $$STYLES_CPP/qaquastyle.cpp
     35                HEADERS *= $$STYLES_CPP/qaquastyle_p.h
     36                SOURCES *= $$STYLES_CPP/qaquastyle_p.cpp
    3737
    3838                !contains( styles, windows ) {
     
    124124                }
    125125        }
    126         else:DEFINES += QT_NO_STYLE_POCKETPC
    127        
     126        else:DEFINES += QT_NO_STYLE_POCKETPC
     127
    128128        contains( styles, windows ) {
    129129                HEADERS +=$$STYLES_H/qwindowsstyle.h
     
    131131        }
    132132        else:DEFINES += QT_NO_STYLE_WINDOWS
     133
     134        contains( styles, warp4 ) {
     135                HEADERS +=$$STYLES_H/qwarp4style.h
     136                SOURCES +=$$STYLES_CPP/qwarp4style.cpp
     137        }
     138        else:DEFINES += QT_NO_STYLE_WARP4
    133139
    134140        contains( styles, motif ) {
  • trunk/src/widgets/qcombobox.cpp

    r2 r174  
    13391339    arrowRect.setHeight( QMAX(  height() - (2 * arrowRect.y()), arrowRect.height() ) );
    13401340
    1341     if ( count() && ( !editable() || arrowRect.contains( e->pos() ) ) ) {
     1341    bool dropDown;
     1342    int gs = style().styleHint(QStyle::SH_GUIStyle);
     1343    if ( gs == QStyle::PMStyle )
     1344        dropDown = count() && arrowRect.contains( e->pos() );
     1345    else
     1346        dropDown = count() && ( !editable() || arrowRect.contains( e->pos() ) );
     1347
     1348    if ( dropDown ) {
    13421349        d->arrowPressed = FALSE;
    13431350
     
    13581365        QTimer::singleShot( 200, this, SLOT(internalClickTimeout()));
    13591366        d->shortClick = TRUE;
     1367    }
     1368    else if ( gs == QStyle::PMStyle ) {
     1369        setFocus();
    13601370    }
    13611371}
  • trunk/src/widgets/qdatetimeedit.cpp

    r2 r174  
    10811081    QFontMetrics fm( font() );
    10821082    int fw = style().pixelMetric( QStyle::PM_DefaultFrameWidth, this );
    1083     int h = QMAX( fm.lineSpacing(), 14 ) + 2;
     1083    int h = QMAX( fm.lineSpacing(), 14 );
     1084    if ( style().styleHint( QStyle::SH_GUIStyle ) != QStyle::PMStyle )
     1085        h += 2;
    10841086    int w = 2 + fm.width( '9' ) * 8 + fm.width( d->ed->separator() ) * 2 + d->controls->upRect().width() + fw * 4;
    10851087
    1086     return QSize( w, QMAX(h + fw * 2,20) ).expandedTo( QApplication::globalStrut() );
     1088    return QSize( w, QMAX(h + fw * 2, 20) ).expandedTo( QApplication::globalStrut() );
    10871089}
    10881090
     
    25262528    QFontMetrics fm( font() );
    25272529    int fw = style().pixelMetric( QStyle::PM_DefaultFrameWidth, this );
    2528     int h = fm.lineSpacing() + 2;
     2530    int h = fm.lineSpacing();
     2531    if ( style().styleHint( QStyle::SH_GUIStyle ) != QStyle::PMStyle )
     2532        h += 2;
    25292533    int w = 2 + fm.width( '9' ) * 6 + fm.width( d->ed->separator() ) * 2 +
    25302534        d->controls->upRect().width() + fw * 4;
     
    25362540    }
    25372541
    2538     return QSize( w, QMAX(h + fw * 2,20) ).expandedTo( QApplication::globalStrut() );
     2542    return QSize( w, QMAX(h + fw * 2, 20) ).expandedTo( QApplication::globalStrut() );
    25392543}
    25402544
  • trunk/src/widgets/qdial.cpp

    r2 r174  
    261261    p.begin( this );
    262262
     263    // note: drawing dial controls is NOT AT ALL using the QStyle drawing
     264    // concept, so we have to draw the Warp4 dial here explicitly in
     265    // the widget code!
     266    if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) {
     267        QRect rr(rect());
     268
     269        // erase the background
     270        QBrush br( paletteBackgroundColor() );
     271        p.setPen( QPen::NoPen );
     272        p.fillRect( rr, br );
     273
     274        // centered quadratic rectangle
     275        if ( rr.width() > rr.height() ) {
     276            rr.setWidth( rr.height() );
     277            rr.moveBy( (width() - rr.width()) / 2, 0 );
     278        } else {
     279            rr.setHeight( rr.width() );
     280            rr.moveBy( 0, (height() - rr.height()) / 2 );
     281        }
     282
     283        // draw the ticks ("notches")
     284        if ( d->showNotches ) {
     285            calcLines();
     286            p.setPen( colorGroup().foreground() );
     287            p.drawLineSegments( d->lines );
     288        }
     289
     290        // draw dial (circle with shadow)
     291        int bigLineSize = calcBigLineSize();
     292        int dist = 6;
     293        rr.setLeft( rr.left() + bigLineSize + dist );
     294        rr.setTop( rr.top() + bigLineSize + dist );
     295        rr.setRight( rr.right() - bigLineSize - dist );
     296        rr.setBottom( rr.bottom() - bigLineSize - dist );
     297        p.setPen( QPen( colorGroup().shadow(), 2) );
     298        p.drawEllipse( rr );
     299        rr.setLeft( rr.left() + 2 );
     300        rr.setTop( rr.top() + 2 );
     301        rr.setRight( rr.right() - 2 );
     302        rr.setBottom( rr.bottom() - 2 );
     303        QPointArray pa;
     304        pa.putPoints( 0, 3,
     305                      rr.left() - 2, rr.top() - 2,
     306                      rr.right() + 2, rr.top() - 2,
     307                      rr.left() - 2, rr.bottom() + 2 );
     308        p.setClipRegion( QRegion( pa ) );
     309        p.setPen( QPen( colorGroup().light(), 2 ) );
     310        p.drawEllipse( rr );
     311        pa.resize( 0 );
     312        pa.putPoints( 0, 3,
     313                      rr.right() + 2, rr.top() - 2,
     314                      rr.right() + 2, rr.bottom() + 2,
     315                      rr.left() - 2, rr.bottom() + 2 );
     316        p.setClipRegion( QRegion( pa ) );
     317        p.setPen( QPen( colorGroup().dark(), 2 ) );
     318        p.drawEllipse( rr );
     319        p.setClipping( false );
     320
     321        // draw pointer (triangle)
     322        double a;
     323        calcArrow( a );
     324        double s = sin( a ),
     325               c = cos( a );
     326        int r = rr.width() / 2 - 9;
     327        double xtr = ((double)rr.left() + rr.right()) * .5 + r * c,
     328               ytr = ((double)rr.top() + rr.bottom()) * .5 - r * s;
     329        QPointArray ar;
     330        ar.putPoints( 0, 3,
     331                      (int)(xtr + 3.5 * c), (int)(ytr - 3.5 * s),
     332                      (int)(xtr + 4 * cos(a - 2.0944)), (int)(ytr - 4 * sin(a - 2.0944)),
     333                      (int)(xtr + 4 * cos(a + 2.0944)), (int)(ytr - 4 * sin(a + 2.0944)) );
     334        p.setBrush( colorGroup().foreground() );
     335        p.setPen( QPen::NoPen );
     336        p.drawPolygon( ar );
     337
     338        if( hasFocus() )
     339            style().drawPrimitive( QStyle::PE_FocusRect, &p, rect(), colorGroup() );
     340    }
     341
     342    // all non-PM styles
     343    else
     344    {
    263345    bool resetClipping = FALSE;
    264346
     
    385467        style().drawPrimitive( QStyle::PE_FocusRect, &p, br, colorGroup());
    386468    }
     469    }
     470
    387471    p.end();
    388472}
  • trunk/src/widgets/qlistview.cpp

    r2 r174  
    15741574        for ( uint i = 0; i < lv->d->column.size(); ++i ) {
    15751575            if ( pixmap( i ) )
     1576            {
     1577                if ( lv->style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle )
     1578                    ph = QMAX( ph, pixmap( i )->height() + 4 );
     1579                else
    15761580                ph = QMAX( ph, pixmap( i )->height() );
     1581        }
    15771582        }
    15781583
     
    25962601    d->vci = 0;
    25972602    d->timer = new QTimer( this );
     2603    if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle )
     2604        d->levelWidth = 24;
     2605    else
    25982606    d->levelWidth = 20;
    25992607    d->r = 0;
     
    26132621    d->sortcolumn = 0;
    26142622    d->ascending = TRUE;
     2623    if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle )
     2624        d->allColumnsShowFocus = TRUE;
     2625    else
    26152626    d->allColumnsShowFocus = FALSE;
    26162627    d->fontMetricsHeight = fontMetrics().height();
     
    80778088    if ( d->h->iconSet( col ) )
    80788089        w += d->h->iconSet( col )->pixmap().width();
     8090    if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle )
     8091        w = QMAX( w, 24 );
     8092    else
    80798093    w = QMAX( w, 20 );
    80808094    QFontMetrics fm( fontMetrics() );
  • trunk/src/widgets/qmenubar.cpp

    r2 r174  
    295295    int h = 2*motifBarVMargin + fm.height() + motifItemVMargin + 2*frameWidth() + 2*motifItemFrame;
    296296
     297    if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle )
     298        h++;
     299
    297300    setGeometry( 0, 0, width(), h );
    298301
     
    483486void QMenuBar::languageChange()
    484487{
    485     menuContentsChanged(); 
     488    menuContentsChanged();
    486489}
    487490
     
    729732    bool reverse = QApplication::reverseLayout();
    730733    const int yoffset = 1; //(style().styleHint( QStyle::SH_GUIStyle ) == QStyle::WindowsStyle) ? 4 : 1; ### this breaks designer mainwindow editing
    731     QPoint pos = r.bottomLeft() + QPoint(0,yoffset);
     734    // Warp4style: popup menus are displaced by 4
     735    const int xoffset = ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) ? -4 : 0;
     736    QPoint pos = r.bottomLeft() + QPoint( xoffset, yoffset );
    732737    if( reverse ) {
    733         pos = r.bottomRight() + QPoint(0,yoffset);
     738        pos = r.bottomRight() + QPoint( -xoffset, yoffset );
    734739        pos.rx() -= popup->sizeHint().width();
    735740    }
     
    913918        x += 2;
    914919        y += 2;
     920    } else if ( gs == PMStyle ) {
     921        x += 4;
    915922    }
    916923    if ( reverse )
     
    976983                    x += motifBarHMargin;
    977984                    y += motifBarVMargin;
     985                } else if ( gs == PMStyle ) {
     986                    x += 5;
    978987                }
    979988                if ( reverse )
  • trunk/src/widgets/qscrollbar.cpp

    r2 r174  
    941941        flags |= QStyle::Style_Horizontal;
    942942
     943    // For the Warp4 style we need to always check also the "add line" and "sub line"
     944    // buttons (they could be activated/deactivated!), so we include them here
     945    // for every drawing operation
     946    if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle )
     947        controls = controls |
     948                   QStyle::SC_ScrollBarSubLine |
     949                   QStyle::SC_ScrollBarAddLine;
     950
    943951    style().drawComplexControl(QStyle::CC_ScrollBar, p, this, rect(), colorGroup(),
    944952                               flags, (QStyle::SubControl) controls,
  • trunk/src/widgets/qslider.cpp

    r2 r174  
    183183    ticks = NoMarks;
    184184    tickInt = 0;
     185
     186    if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle )
     187        setFocusPolicy( StrongFocus );
     188    else
    185189    setFocusPolicy( TabFocus  );
    186190    initTicks();
  • trunk/src/widgets/qspinwidget.cpp

    r2 r174  
    136136
    137137    uint oldButtonDown = d->buttonDown;
    138 
     138    d->buttonDown = 0;
     139
     140    // With Warp, the up and down buttons are diagonally separated,
     141    // so we are disabling the down button entirely and have to find
     142    // out the position of the click within the up button in order
     143    // to find out what the user wants!
     144    int guiStyle = style().styleHint( QStyle::SH_GUIStyle );
     145    if ( guiStyle == QStyle::PMStyle ) {
     146        if ( d->up.contains( e->pos() ) ) {
     147            QPoint rp = e->pos() - d->up.topLeft();
     148            if ( d->up.width() > (rp.x() + rp.y()) ) {
     149                if ( d->upEnabled )
     150                    d->buttonDown = 2;
     151            } else {
     152                if ( d->downEnabled )
     153                    d->buttonDown = 1;
     154            }
     155        }
     156    } else {
    139157    if ( d->down.contains( e->pos() ) && d->downEnabled )
    140158        d->buttonDown = 1;
    141159    else if ( d->up.contains( e->pos() ) && d->upEnabled )
    142160        d->buttonDown = 2;
    143     else
    144         d->buttonDown = 0;
     161    }
    145162
    146163    d->theButton = d->buttonDown;
     
    149166            repaint( d->down.unite( d->up ), FALSE );
    150167        } else if ( d->buttonDown & 1 ) {
     168            // do all with the "up" button in PM style - see note above
     169            if ( guiStyle == QStyle::PMStyle )
     170                repaint( d->up, FALSE );
     171            else
    151172            repaint( d->down, FALSE );
    152173            stepDown();
     174            if ( guiStyle == QStyle::PMStyle )
     175                d->startTimer( TRUE, 300 );
     176            else
    153177            d->startTimer( FALSE, 300 );
    154178        } else if ( d->buttonDown & 2 ) {
     
    245269    d->theButton = 0;
    246270    if ( oldButtonDown != d->theButton ) {
    247         if ( oldButtonDown & 1 )
     271        // do all with the "up" button in PM style -
     272        // see note in mousePressEvent
     273        int guiStyle = style().styleHint( QStyle::SH_GUIStyle );
     274        if ( guiStyle == QStyle::PMStyle )
     275            repaint( d->up, FALSE );
     276        else if ( oldButtonDown & 1 )
    248277            repaint( d->down, FALSE );
    249278        else if ( oldButtonDown & 2 )
     
    264293        return;
    265294
     295    // do all with the "up" button in PM style -
     296    // see note in mousePressEvent
     297    int guiStyle = style().styleHint( QStyle::SH_GUIStyle );
     298    uint clickButton = 0;
     299    if ( guiStyle == QStyle::PMStyle ) {
     300        if( d->up.contains( e->pos() ) ) {
     301            QPoint rp = e->pos() - d->up.topLeft();
     302            if ( d->up.width() > (rp.x() + rp.y()) )
     303                clickButton = 2;
     304            else
     305                clickButton = 1;
     306        }
     307    } else {
     308        if ( d->down.contains(e->pos()) )
     309            clickButton = 1;
     310        else if ( d->up.contains(e->pos()) )
     311            clickButton = 2;
     312    }
     313
    266314    uint oldButtonDown = d->theButton;
    267     if ( oldButtonDown & 1 && !d->down.contains( e->pos() ) ) {
     315    if ( (oldButtonDown & 1) && !(clickButton & 1) ) {
     316    //if ( oldButtonDown & 1 && !d->down.contains( e->pos() ) ) {
    268317        d->stopTimer();
    269318        d->theButton = 0;
     319        if ( guiStyle == QStyle::PMStyle )
     320            repaint( d->up, FALSE );
     321        else
    270322        repaint( d->down, FALSE );
    271     } else if ( oldButtonDown & 2 && !d->up.contains( e->pos() ) ) {
     323    } else if( (oldButtonDown & 2) && !(clickButton & 2) ) {
     324    //} else if ( oldButtonDown & 2 && !d->up.contains( e->pos() ) ) {
    272325        d->stopTimer();
    273326        d->theButton = 0;
    274327        repaint( d->up, FALSE );
    275     } else if ( !oldButtonDown && d->up.contains( e->pos() ) && d->buttonDown & 2 ) {
     328    } else if ( !oldButtonDown && (clickButton & 2) && (d->buttonDown & 2) ) {
     329    //} else if ( !oldButtonDown && d->up.contains( e->pos() ) && d->buttonDown & 2 ) {
    276330        d->startTimer( 500 );
    277331        d->theButton = 2;
    278332        repaint( d->up, FALSE );
    279     } else if ( !oldButtonDown && d->down.contains( e->pos() ) && d->buttonDown & 1 ) {
     333    } else if(!oldButtonDown && (clickButton & 1) && (d->buttonDown & 1)) {
     334    //} else if ( !oldButtonDown && d->down.contains( e->pos() ) && d->buttonDown & 1 ) {
    280335        d->startTimer( 500 );
    281336        d->theButton = 1;
     337        if ( guiStyle == QStyle::PMStyle )
     338            repaint( d->up, FALSE );
     339        else
    282340        repaint( d->down, FALSE );
    283341    }
Note: See TracChangeset for help on using the changeset viewer.