~ubuntu-branches/ubuntu/maverick/wxwidgets2.8/maverick-proposed

« back to all changes in this revision

Viewing changes to src/mac/carbon/app.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Devid Filoni
  • Date: 2007-11-06 18:25:13 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20071106182513-809agqds6igh7mqo
Tags: 2.8.6.1-0ubuntu1
* New upstream version, based on the upstream tarball
  wxPython-src-2.8.6.1.tar.bz2, renamed debian to debian-upstream.
* Provide a get-orig-source target to do the repackaging.
* Fix "substvar-source-version-is-deprecated" lintian warnings.
* Remove duplicate Description field in debian/control.
* Add "\" at the end of line 8 in debian/python-wxtools.menu to fix
  "bad-test-in-menu-item" lintian error.
* Provide .xpm icons to fix "menu-icon-not-in-xpm-format" lintian errors,
  changed Icon field in debian/python-wxtools.menu.
* Fix "wrong-name-for-upstream-changelog" lintian warnings.
* Remove "Application;" from Categories field in debian/pycrust.desktop,
  debian/pyshell.desktop, debian/xrced.desktop.
* Switch "Apps" to "Applications" in debian/python-wxtools.menu to fix
  "menu-item-uses-apps-section" lintian warnings.
* Drop the icon extension from debian/pycrust.desktop,
  debian/pyshell.desktop, debian/xrced.desktop.
* Add dpatch support.
* Add "WX_CONFIG" patch.
* debian/rules:
  - added .xpm icons to install-gtk-py-tools target
  - added "docs/changes.txt" to dh_installchangelogs in binary-common target
  - added "\" at the end of "install-examples install-msw-dev
    install-msw-dbg install-headers-msw" line in .PHONY

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
// Author:      Stefan Csomor
5
5
// Modified by:
6
6
// Created:     1998-01-01
7
 
// RCS-ID:      $Id: app.cpp,v 1.228.4.2 2007/04/21 23:17:26 KO Exp $
 
7
// RCS-ID:      $Id: app.cpp 48940 2007-09-25 23:14:44Z RD $
8
8
// Copyright:   (c) Stefan Csomor
9
9
// Licence:     wxWindows licence
10
10
/////////////////////////////////////////////////////////////////////////////
435
435
wxMenu* wxFindMenuFromMacCommand( const HICommand &command , wxMenuItem* &item )
436
436
{
437
437
    wxMenu* itemMenu = NULL ;
 
438
#ifndef __WXUNIVERSAL__
438
439
    int id = 0 ;
439
440
 
440
441
    // for 'standard' commands which don't have a wx-menu
477
478
                item = (wxMenuItem*) refCon ;
478
479
        }
479
480
    }
480
 
 
 
481
#endif
481
482
    return itemMenu ;
482
483
}
483
484
 
513
514
{
514
515
    wxMacCarbonEvent cEvent( event ) ;
515
516
    MenuRef menuRef = cEvent.GetParameter<MenuRef>(kEventParamDirectObject) ;
 
517
#ifndef __WXUNIVERSAL__
516
518
    wxMenu* menu = wxFindMenuFromMacMenu( menuRef ) ;
517
519
 
518
520
    if ( menu )
558
560
                }
559
561
            }
560
562
    }
561
 
 
 
563
#endif
562
564
    return eventNotHandledErr;
563
565
}
564
566
 
900
902
                               sQuitHandler , 0 , FALSE ) ;
901
903
    }
902
904
 
 
905
    if ( !wxMacInitCocoa() )
 
906
        return false;
 
907
 
903
908
    return true ;
904
909
}
905
910
 
1101
1106
    // either events to the threads other than main or events posted with
1102
1107
    // wxPostEvent() functions
1103
1108
    wxMacProcessNotifierAndPendingEvents();
1104
 
 
 
1109
#ifndef __WXUNIVERSAL__
1105
1110
  if (!wxMenuBar::MacGetInstalledMenuBar() && wxMenuBar::MacGetCommonMenuBar())
1106
1111
    wxMenuBar::MacGetCommonMenuBar()->MacInstallMenuBar();
 
1112
#endif
1107
1113
}
1108
1114
 
1109
1115
void wxApp::WakeUpIdle()
1155
1161
        return false;
1156
1162
    }
1157
1163
 
 
1164
#if wxUSE_THREADS
 
1165
    // Yielding from a non-gui thread needs to bail out, otherwise we end up
 
1166
    // possibly sending events in the thread too.
 
1167
    if ( !wxThread::IsMain() )
 
1168
    {
 
1169
        return true;
 
1170
    }
 
1171
#endif // wxUSE_THREADS
 
1172
 
1158
1173
    s_inYield = true;
1159
1174
 
1160
1175
    // by definition yield should handle all non-processed events
1194
1209
 
1195
1210
void wxApp::MacDoOneEvent()
1196
1211
{
 
1212
    wxMacAutoreleasePool autoreleasepool;
1197
1213
    EventRef theEvent;
1198
1214
 
1199
1215
    s_inReceiveEvent = true ;
1626
1642
    {
1627
1643
        // control interferes with some built-in keys like pgdown, return etc. therefore we remove the controlKey modifier
1628
1644
        // and look at the character after
 
1645
#ifdef __LP64__
 
1646
                // TODO new implementation using TextInputSources
 
1647
#else
1629
1648
        UInt32 state = 0;
1630
1649
        UInt32 keyInfo = KeyTranslate((Ptr)GetScriptManagerVariable(smKCHRCache), ( modifiers & (~(controlKey | shiftKey | optionKey))) | keycode, &state);
1631
1650
        keychar = short(keyInfo & charCodeMask);
 
1651
#endif
1632
1652
    }
1633
1653
 
1634
1654
    long keyval = wxMacTranslateKey(keychar, keycode) ;
1635
1655
    if ( keyval == keychar && ( event.GetEventType() == wxEVT_KEY_UP || event.GetEventType() == wxEVT_KEY_DOWN ) )
1636
1656
        keyval = wxToupper( keyval ) ;
1637
1657
 
1638
 
    // Check for NUMPAD keys
1639
 
    if (keyval >= '0' && keyval <= '9' && keycode >= 82 && keycode <= 92)
1640
 
    {
1641
 
        keyval = (keyval - '0') + WXK_NUMPAD0;
1642
 
    }
1643
 
    else if (keycode >= 67 && keycode <= 81)
1644
 
    {
1645
 
        switch (keycode)
1646
 
        {
1647
 
        case 76 :
1648
 
            keyval = WXK_NUMPAD_ENTER;
1649
 
            break;
1650
 
 
1651
 
        case 81:
1652
 
            keyval = WXK_NUMPAD_EQUAL;
1653
 
            break;
1654
 
 
1655
 
        case 67:
1656
 
            keyval = WXK_NUMPAD_MULTIPLY;
1657
 
            break;
1658
 
 
1659
 
        case 75:
1660
 
            keyval = WXK_NUMPAD_DIVIDE;
1661
 
            break;
1662
 
 
1663
 
        case 78:
1664
 
            keyval = WXK_NUMPAD_SUBTRACT;
1665
 
            break;
1666
 
 
1667
 
        case 69:
1668
 
            keyval = WXK_NUMPAD_ADD;
1669
 
            break;
1670
 
 
1671
 
        case 65:
1672
 
            keyval = WXK_NUMPAD_DECIMAL;
1673
 
            break;
1674
 
 
1675
 
        default:
1676
 
            break;
1677
 
        } // end switch
 
1658
    // Check for NUMPAD keys.  For KEY_UP/DOWN events we need to use the
 
1659
    // WXK_NUMPAD constants, but for the CHAR event we want to use the
 
1660
    // standard ascii values
 
1661
    if ( event.GetEventType() != wxEVT_CHAR )
 
1662
    {
 
1663
        if ( keyval >= '0' && keyval <= '9' && keycode >= 82 && keycode <= 92 )
 
1664
        {
 
1665
            keyval = (keyval - '0') + WXK_NUMPAD0;
 
1666
        }
 
1667
        else if (keycode >= 65 && keycode <= 81) 
 
1668
        {
 
1669
            switch (keycode)
 
1670
            {
 
1671
            case 76 :
 
1672
                keyval = WXK_NUMPAD_ENTER;
 
1673
                break;
 
1674
                
 
1675
            case 81:
 
1676
                keyval = WXK_NUMPAD_EQUAL;
 
1677
                break;
 
1678
                
 
1679
            case 67:
 
1680
                keyval = WXK_NUMPAD_MULTIPLY;
 
1681
                break;
 
1682
                
 
1683
            case 75:
 
1684
                keyval = WXK_NUMPAD_DIVIDE;
 
1685
                break;
 
1686
                
 
1687
            case 78:
 
1688
                keyval = WXK_NUMPAD_SUBTRACT;
 
1689
                break;
 
1690
                
 
1691
            case 69:
 
1692
                keyval = WXK_NUMPAD_ADD;
 
1693
                break;
 
1694
                
 
1695
            case 65:
 
1696
                keyval = WXK_NUMPAD_DECIMAL;
 
1697
                break;
 
1698
            default:
 
1699
                break;
 
1700
            }
 
1701
        }
1678
1702
    }
1679
1703
 
1680
1704
    event.m_shiftDown = modifiers & shiftKey;