Changeset 1338

Show
Ignore:
Timestamp:
01/02/08 21:04:43 (8 months ago)
Author:
calvin
Message:

use WTLs CMessageFilter everywhere instead of the custom addAccelerator-stuff, do not process accelerators in plugins' windows (pvst shortcuts work), removed old preferences completely

Location:
trunk/src
Files:
1 removed
17 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/buze/main.cpp

    r1332 r1338  
    99#include "../buzelib/MainFrm.h" 
    1010#include "../buzelib/buze.h" 
    11 #include "../buzelib/Preferences/PreferencesDialog.h" 
    1211#include "../libzzub/tools.h" 
    1312#ifndef _USE_OLD_IOSTREAMS 
  • trunk/src/buzelib/FileBrowserView.cpp

    r1331 r1338  
    118118} 
    119119 
    120  
    121 LRESULT CFileBrowserView::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { 
    122         // denne fixet crash når vi lukker hele clienten 
    123         mainFrame->removeAccelerator(m_hWnd); 
    124         mainFrame->closeClientWindow(const_cast<ClientView*>(mainFrame->get(m_hWnd))); 
    125         return 0; 
    126 } 
    127  
    128 LRESULT CFileBrowserView::OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { 
    129         WORD cx = LOWORD( lParam); 
    130         WORD cy = HIWORD( lParam); 
    131  
    132         int toolbarHeight=getToolbarHeight(); 
    133         fileList.MoveWindow(0, getToolbarHeight(), cx, cy-getToolbarHeight()); 
    134  
    135         return 0; 
    136 } 
    137  
    138120LRESULT CFileBrowserView::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { 
    139121        // http://groups.google.no/group/microsoft.public.vc.atl/browse_thread/thread/afb91a02192bd05b/d67319f5d6b58936?lnk=st&q=CListViewCtrl+additem&rnum=1&hl=no#d67319f5d6b58936 
     
    154136        insertToolbarBand(shortcutDropdown, "", 100); 
    155137 
    156  
    157138        hWndButtonToolBar=mainFrame->CreateSimpleToolBarCtrl(m_hWnd, IDR_FILEBROWSER, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); 
    158139        SIZE size; 
    159140        SendMessage(hWndButtonToolBar, TB_GETMAXSIZE, 0, (LPARAM)&size); 
    160141        insertToolbarBand(hWndButtonToolBar, "", size.cx); 
    161          
    162         mainFrame->addAccelerator(m_hWnd, AtlLoadAccelerators(IDR_FILEBROWSER)); 
     142 
     143        hAccel = AtlLoadAccelerators(IDR_FILEBROWSER); 
     144 
     145        CMessageLoop* pLoop = _Module.GetMessageLoop(); 
     146        ATLASSERT(pLoop != NULL); 
     147        pLoop->AddMessageFilter(this); 
    163148 
    164149        CBrowseHistory bh; 
     
    167152 
    168153        return  0; 
     154} 
     155 
     156BOOL CFileBrowserView::PreTranslateMessage(MSG* pMsg) { 
     157        if (GetFocus() == *this || GetFocus() == fileList) 
     158                if (::TranslateAccelerator(m_hWnd, hAccel, pMsg)) 
     159                        return TRUE; 
     160        return FALSE; 
     161} 
     162 
     163LRESULT CFileBrowserView::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { 
     164        CMessageLoop* pLoop = _Module.GetMessageLoop(); 
     165        ATLASSERT(pLoop != NULL); 
     166        pLoop->RemoveMessageFilter(this); 
     167 
     168        // denne fixet crash når vi lukker hele clienten 
     169        mainFrame->closeClientWindow(const_cast<ClientView*>(mainFrame->get(m_hWnd))); 
     170        return 0; 
     171} 
     172 
     173LRESULT CFileBrowserView::OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { 
     174        WORD cx = LOWORD( lParam); 
     175        WORD cy = HIWORD( lParam); 
     176 
     177        int toolbarHeight=getToolbarHeight(); 
     178        fileList.MoveWindow(0, getToolbarHeight(), cx, cy-getToolbarHeight()); 
     179 
     180        return 0; 
    169181} 
    170182 
  • trunk/src/buzelib/FileBrowserView.h

    r1331 r1338  
    2626}; 
    2727 
    28 class CFileBrowserView  : public CToolbarWindow<CFileBrowserView> { 
     28class CFileBrowserView   
     29        : public CToolbarWindow<CFileBrowserView> 
     30        , public CMessageFilter 
     31{ 
    2932        ClientViewListener* clientViewListener; 
    3033 
     
    5154        bool isCtrlDown(); 
    5255        bool isShiftDown(); 
     56        HACCEL hAccel; 
    5357 
    5458public: 
     
    101105 
    102106        LRESULT OnToolbarChildSize(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); 
     107        virtual BOOL PreTranslateMessage(MSG* pMsg); 
    103108 
    104109        std::vector<CFileInfo*> getSelectedFiles(); 
  • trunk/src/buzelib/HelpView.cpp

    r1331 r1338  
    2323        helpText.SetReadOnly(); 
    2424        helpText.SetFont(helpFont); 
    25         mainFrame->addAccelerator(m_hWnd, AtlLoadAccelerators(IDR_SEQUENCER)); 
     25 
     26        hAccel = AtlLoadAccelerators(IDR_HELPVIEW); 
     27 
     28        CMessageLoop* pLoop = _Module.GetMessageLoop(); 
     29        ATLASSERT(pLoop != NULL); 
     30        pLoop->AddMessageFilter(this); 
    2631 
    2732        mainFrame->addTabableView(m_hWnd); 
    2833    return 0; 
     34} 
     35 
     36BOOL CHelpView::PreTranslateMessage(MSG* pMsg) { 
     37        if (GetFocus() == *this || GetFocus() == helpText) 
     38                if (::TranslateAccelerator(m_hWnd, hAccel, pMsg)) 
     39                        return TRUE; 
     40        return FALSE; 
    2941} 
    3042 
     
    3749 
    3850LRESULT CHelpView::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { 
     51        CMessageLoop* pLoop = _Module.GetMessageLoop(); 
     52        ATLASSERT(pLoop != NULL); 
     53        pLoop->RemoveMessageFilter(this); 
     54 
    3955        mainFrame->closeClientWindow(const_cast<ClientView*>(mainFrame->get(m_hWnd))); 
    40         mainFrame->removeAccelerator(m_hWnd); 
     56 
    4157        return 0; 
    4258} 
  • trunk/src/buzelib/HelpView.h

    r1218 r1338  
    55 
    66class CHelpView  
    7         : public CWindowImpl<CHelpView> { 
     7        : public CWindowImpl<CHelpView> 
     8        , public CMessageFilter 
     9{ 
    810public: 
    911        ClientViewListener* clientViewListener; 
     
    1113    CFont helpFont; 
    1214        CEdit helpText; 
     15        HACCEL hAccel; 
    1316 
    1417        DECLARE_WND_CLASS("HelpView") 
     
    2932        LRESULT OnFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 
    3033        LRESULT OnHelp(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); 
     34        virtual BOOL PreTranslateMessage(MSG* pMsg); 
    3135}; 
  • trunk/src/buzelib/MachineParameterView.cpp

    r1331 r1338  
    7878 
    7979        machine->addEventHandler(this); 
    80         mainFrame->addAccelerator(m_hWnd, AtlLoadAccelerators(IDR_PARAMETERVIEW)); 
    81         mainFrame->addDisabledAcceleratorComboBox(presetDropDown); 
     80 
     81        hAccel = AtlLoadAccelerators(IDR_PARAMETERVIEW); 
     82 
     83        CMessageLoop* pLoop = _Module.GetMessageLoop(); 
     84        ATLASSERT(pLoop != NULL); 
     85        pLoop->AddMessageFilter(this); 
    8286 
    8387        std::string uri = machine->loader->plugin_info->uri; 
     
    111115 
    112116 
     117BOOL CMachineParameterView::PreTranslateMessage(MSG* pMsg) { 
     118        if (GetFocus() == *this || (selectedSlider < sliderView.sliders.size() && GetFocus() == sliderView.sliders[selectedSlider]->trackBar.m_slider)) 
     119                if (::TranslateAccelerator(m_hWnd, hAccel, pMsg)) 
     120                        return TRUE; 
     121        return FALSE; 
     122} 
     123 
    113124LRESULT CMachineParameterView::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { 
    114125 
    115126        document->removeView(this); 
    116         mainFrame->removeAccelerator(m_hWnd); 
    117         mainFrame->removeDisabledAcceleratorComboBox(presetDropDown); 
    118127 
    119128        machine->removeEventHandler(this); 
    120129        this->machine = 0;  // in case machine is deleted and window updated before window is fully destroyed 
     130 
     131        CMessageLoop* pLoop = _Module.GetMessageLoop(); 
     132        ATLASSERT(pLoop != NULL); 
     133        pLoop->RemoveMessageFilter(this); 
    121134 
    122135        mainFrame->closeClientWindow(const_cast<ClientView*>(mainFrame->get(m_hWnd))); 
     
    208221 
    209222void CMachineParameterView::bindPresets() { 
    210         while (presetDropDown.GetCount() > 0) 
    211                 presetDropDown.DeleteString(0); 
     223        presetDropDown.ResetContent(); 
     224        presetDropDown.SetRedraw(FALSE); 
    212225 
    213226        // create and add default settings  
     
    235248                presetDropDown.SetItemData(i+1, (DWORD_PTR)pi); 
    236249        } 
     250        presetDropDown.SetRedraw(TRUE); 
    237251} 
    238252 
     
    671685 
    672686        for (size_t i=0; i<sliders.size(); i++) { 
    673                 int labelWidth=80; 
    674                 int valueWidth=80; 
    675                 int sliderWidth=width-labelWidth-valueWidth; 
    676  
    677687                sliders[i]->MoveWindow(0, i*CParameterSliderCtrl::sliderHeight, width, CParameterSliderCtrl::sliderHeight); 
    678688        } 
  • trunk/src/buzelib/MachineParameterView.h

    r1331 r1338  
    5050        : public CViewImpl<CMainFrame, CDocument, CMachineParameterView> 
    5151        , public CToolbarWindow<CMachineParameterView> 
    52         , public zzub::event_handler { 
     52        , public zzub::event_handler 
     53        , public CMessageFilter 
     54{ 
    5355protected: 
    5456        zzub_event_id tickEvent, parameterChangedEvent; 
     
    6365        HWND hWndButtonToolBar; 
    6466        int selectedSlider; 
    65         virtual bool invoke(zzub_event_data_t& data); 
     67        HACCEL hAccel; 
    6668public: 
    6769        DECLARE_WND_CLASS("CMachineParameterView") 
     
    140142        LRESULT OnToolbarChildSize(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); 
    141143 
     144        virtual BOOL PreTranslateMessage(MSG* pMsg); 
    142145        void OnUpdate(CView* pSender, LPARAM lHint, LPVOID pHint); 
     146        virtual bool invoke(zzub_event_data_t& data); 
    143147 
    144148        zzub::metaplugin* getMachine() { return machine; } 
  • trunk/src/buzelib/MachineView.cpp

    r1331 r1338  
    155155        mainFrame->addTabableView(m_hWnd); 
    156156 
    157         mainFrame->addAccelerator(m_hWnd, AtlLoadAccelerators(IDR_MACHINEVIEW)); 
     157        hAccel = AtlLoadAccelerators(IDR_MACHINEVIEW); 
     158 
     159        CMessageLoop* pLoop = _Module.GetMessageLoop(); 
     160        ATLASSERT(pLoop != NULL); 
     161        pLoop->AddMessageFilter(this); 
    158162 
    159163        document->selectMachine(document->player->master); 
     
    162166} 
    163167 
     168BOOL CMachineView::PreTranslateMessage(MSG* pMsg) { 
     169        if (GetFocus() == *this) 
     170                if (::TranslateAccelerator(m_hWnd, hAccel, pMsg)) 
     171                        return TRUE; 
     172        return FALSE; 
     173} 
     174 
    164175LRESULT CMachineView::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { 
     176        CMessageLoop* pLoop = _Module.GetMessageLoop(); 
     177        ATLASSERT(pLoop != NULL); 
     178        pLoop->RemoveMessageFilter(this); 
     179 
    165180    document->removeView(this); 
    166181 
    167182    // denne fixet crash når vi lukker hele clienten 
    168183        mainFrame->closeClientWindow(const_cast<ClientView*>(mainFrame->get(m_hWnd))); 
    169         mainFrame->removeAccelerator(m_hWnd); 
    170184 
    171185        return 0; 
  • trunk/src/buzelib/MachineView.h

    r1307 r1338  
    2323        : public CViewImpl<CMainFrame, CDocument, CMachineView> 
    2424        , public CMachineDropTargetWindow 
    25         , public CWindowImpl<CMachineView> { 
     25        , public CWindowImpl<CMachineView> 
     26        , public CMessageFilter 
     27{ 
    2628 
    2729protected: 
     
    7173 
    7274        std::map<zzub::metaplugin*, bool> ledStates; 
     75        HACCEL hAccel; 
    7376 
    7477public: 
     
    146149        LRESULT OnMachineParameters(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 
    147150        void OnUpdate(CView* pSender, LPARAM lHint, LPVOID pHint); 
     151        virtual BOOL PreTranslateMessage(MSG* pMsg); 
    148152 
    149153        bool OnDragOver(const POINTL& pt, FORMATETC* pFmtEtc, STGMEDIUM& medium,DWORD *pdwEffect); 
  • trunk/src/buzelib/MainFrm.cpp

    r1336 r1338  
    1919#include "WaveTableView.h" 
    2020#include "FileBrowserView.h" 
    21 #include "Preferences/PreferencesDialog.h" 
    2221#include "EditorActions.h" 
    2322#include "WaitWindow.h" 
     
    347346} 
    348347 
    349 void CMainFrame::addAccelerator(HWND hWnd, HACCEL accel) { 
    350         acceleratorHandlers.insert(pair<HWND, HACCEL>(hWnd, accel)); 
    351 } 
    352  
    353 void CMainFrame::removeAccelerator(HWND hWnd) { 
    354         map<HWND, HACCEL>::iterator i = acceleratorHandlers.find(hWnd); 
    355         if (i != acceleratorHandlers.end()) 
    356                 acceleratorHandlers.erase(i); 
    357 } 
    358  
    359 // dont process accelerators when these controls have focus 
    360 void CMainFrame::addDisabledAcceleratorControl(HWND hWnd) { 
    361         disabledAcceleratorControls.push_back(hWnd); 
    362 } 
    363  
    364 void CMainFrame::addDisabledAcceleratorComboBox(CComboBox& combo) { 
    365         COMBOBOXINFO cbi; 
    366         cbi.cbSize = sizeof(COMBOBOXINFO); 
    367         combo.GetComboBoxInfo(&cbi); 
    368  
    369         addDisabledAcceleratorControl(cbi.hwndItem); 
    370 } 
    371  
    372 void CMainFrame::removeDisabledAcceleratorComboBox(CComboBox& combo) { 
    373         COMBOBOXINFO cbi; 
    374         cbi.cbSize = sizeof(COMBOBOXINFO); 
    375         combo.GetComboBoxInfo(&cbi); 
    376  
    377         removeDisabledAcceleratorControl(cbi.hwndItem); 
    378 } 
    379  
    380 void CMainFrame::removeDisabledAcceleratorControl(HWND hWnd) { 
    381         std::vector<HWND>::iterator i = find(disabledAcceleratorControls.begin(), disabledAcceleratorControls.end(), hWnd); 
    382         if (i == disabledAcceleratorControls.end()) return ; 
    383         disabledAcceleratorControls.erase(i); 
    384 } 
    385  
    386 bool CMainFrame::isDisabledAcceleratorControl(HWND hWnd) { 
    387         std::vector<HWND>::iterator i = find(disabledAcceleratorControls.begin(), disabledAcceleratorControls.end(), hWnd); 
    388         if (i == disabledAcceleratorControls.end()) return false; 
    389         return true; 
    390 } 
    391  
    392348//!     \brief For tracking the ctrl in ctrl-tabbing 
    393349BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) { 
     
    404360        }  
    405361 
    406         if (CFrameWindowImpl<CMainFrame>::PreTranslateMessage(pMsg)) 
    407                 return TRUE; 
    408  
    409         HWND clientView = frame.focusedClientView(); 
    410  
    411         if (isDisabledAcceleratorControl(GetFocus())) return FALSE; 
    412  
    413         map<HWND, HACCEL>::iterator itacc = acceleratorHandlers.find(clientView); 
    414         if (itacc == acceleratorHandlers.end()) return FALSE; 
    415         if (::TranslateAccelerator(clientView, itacc->second, pMsg)) 
    416                 return TRUE; 
    417  
     362        if (::GetWindowLong(pMsg->hwnd, GWL_HINSTANCE) == (DWORD)_Module.m_hInst) 
     363                if (CFrameWindowImpl<CMainFrame>::PreTranslateMessage(pMsg)) 
     364                        return TRUE; 
    418365        return FALSE; 
    419366} 
     
    584531LRESULT CMainFrame::OnShowPreferences(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { 
    585532        showPreferencesView(); 
    586  
    587         //CPreferencesDialog prefs(this); 
    588         //prefs.DoModal(); 
    589533        return 0; 
    590534} 
  • trunk/src/buzelib/MainFrm.h

    r1326 r1338  
    142142 
    143143        std::vector<CTimerHandler*> timerHandlers; 
    144         std::map<HWND, HACCEL> acceleratorHandlers; 
    145144 
    146145public: 
     
    191190        std::vector<std::string> recents; 
    192191 
    193         std::vector<HWND> disabledAcceleratorControls; 
    194192        CMenu themeMenu; 
    195193        CMenu recentMenu; 
     
    506504        void removeTimerHandler(CTimerHandler* handler); 
    507505 
    508         void addAccelerator(HWND hWnd, HACCEL accel); 
    509         void removeAccelerator(HWND hWnd); 
    510         void addDisabledAcceleratorControl(HWND hWnd);  // dont process accelerators when these controls have focus 
    511         void addDisabledAcceleratorComboBox(CComboBox& combo);  // dont process accelerators when these controls have focus 
    512         void removeDisabledAcceleratorControl(HWND hWnd); 
    513         void removeDisabledAcceleratorComboBox(CComboBox& combo);       // dont process accelerators when these controls have focus 
    514         bool isDisabledAcceleratorControl(HWND hWnd); 
    515  
    516506        CPatternView* showPatternEditor(zzub::pattern* p, zzub::metaplugin* machine);   // need to pass zzub_metaplugin_t in case Pattern in null, so we can create one. optimally parameters should be machine, patternindex 
    517507        void showMachineParameters(zzub::metaplugin* m); 
  • trunk/src/buzelib/PropertyListView.cpp

    r1322 r1338  
    3939        document->addView(this); 
    4040 
    41         mainFrame->addAccelerator(m_hWnd, AtlLoadAccelerators(IDR_PROPERTYVIEW)); 
     41        hAccel = AtlLoadAccelerators(IDR_PROPERTYVIEW); 
     42 
     43        CMessageLoop* messageLoop = _Module.GetMessageLoop(); 
     44        messageLoop->AddMessageFilter(this); 
     45 
    4246        return DefWindowProc();; 
    4347} 
    4448 
     49BOOL CPropertyListView::PreTranslateMessage(MSG* pMsg) { 
     50        if (GetFocus() == *this || GetFocus() == propertyList || GetFocus() == propertyList.m_hwndInplace) 
     51                if (::TranslateAccelerator(m_hWnd, hAccel, pMsg)) 
     52                        return TRUE; 
     53        return FALSE; 
     54} 
     55 
    4556LRESULT CPropertyListView::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { 
     57        CMessageLoop* messageLoop = _Module.GetMessageLoop(); 
     58        messageLoop->RemoveMessageFilter(this); 
     59 
    4660        document->removeView(this); 
    4761        mainFrame->closeClientWindow(const_cast<ClientView*>(mainFrame->get(m_hWnd))); 
    48         mainFrame->removeAccelerator(m_hWnd); 
     62 
    4963        return 0; 
    5064} 
  • trunk/src/buzelib/PropertyListView.h

    r1300 r1338  
    1212class CPropertyListView  
    1313        : public CViewImpl<CMainFrame, CDocument, CPropertyListView> 
    14         , public CToolbarWindow<CPropertyListView> { 
     14        , public CToolbarWindow<CPropertyListView> 
     15        , public CMessageFilter 
     16{ 
    1517        ClientViewListener* clientViewListener; 
    1618public: 
     
    2123        CPropertyProvider* provider; 
    2224        HWND hReturnView; 
     25        HACCEL hAccel; 
    2326 
    2427        DECLARE_WND_CLASS("PropertyListView") 
     
    5154        LRESULT OnReturnToView(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 
    5255        void OnUpdate(CView* pSender, LPARAM lHint, LPVOID pHint); 
     56        virtual BOOL PreTranslateMessage(MSG* pMsg); 
    5357 
    5458        void updateFromProvider(CPropertyProvider* provider); 
  • trunk/src/buzelib/SequenceView.cpp

    r1331 r1338  
    101101        document->addView(this); 
    102102 
     103        hAccel = AtlLoadAccelerators(IDR_SEQUENCER); 
     104 
    103105        CMessageLoop* messageLoop = _Module.GetMessageLoop(); 
    104106        messageLoop->AddIdleHandler(this); 
     107        messageLoop->AddMessageFilter(this); 
    105108 
    106109        mainFrame->addTabableView(m_hWnd); 
    107110 
    108         mainFrame->addAccelerator(m_hWnd, AtlLoadAccelerators(IDR_SEQUENCER)); 
    109         mainFrame->addDisabledAcceleratorComboBox(scaleDropDown); 
    110         mainFrame->addDisabledAcceleratorComboBox(stepDropDown); 
    111  
    112         return 0; 
     111        return 0; 
     112} 
     113 
     114 
     115BOOL CSequenceView::PreTranslateMessage(MSG* pMsg) { 
     116        if (GetFocus() == *this || GetFocus() == editor || GetFocus() == patternList) 
     117                if (::TranslateAccelerator(m_hWnd, hAccel, pMsg)) 
     118                        return TRUE; 
     119        return FALSE; 
    113120} 
    114121 
     
    117124        CMessageLoop* messageLoop = _Module.GetMessageLoop(); 
    118125        messageLoop->RemoveIdleHandler(this); 
     126        messageLoop->RemoveMessageFilter(this); 
    119127 
    120128        document->removeView(this); 
    121         mainFrame->removeAccelerator(m_hWnd); 
    122         mainFrame->removeDisabledAcceleratorComboBox(scaleDropDown); 
    123         mainFrame->removeDisabledAcceleratorComboBox(stepDropDown); 
    124129        mainFrame->closeClientWindow(const_cast<ClientView*>(mainFrame->get(m_hWnd))); 
    125130        return 0; 
  • trunk/src/buzelib/SequenceView.h

    r1331 r1338  
    1818        : public CViewImpl<CMainFrame, CDocument, CSequenceView> 
    1919        , public CToolbarWindow<CSequenceView> 
     20        , public CMessageFilter 
    2021        , public CIdleHandler 
    2122{ 
     
    3334        CStatusBarCtrl statusBar; 
    3435        bool editScale; 
     36        HACCEL hAccel; 
    3537 
    3638        DECLARE_WND_SUPERCLASS("SequenceView", CToolbarWindow<CSequenceView>::GetWndClassName()) 
     
    118120        CSequenceView(CMainFrame* mainFrm, ClientViewListener* cl); 
    119121        ~CSequenceView(void); 
     122 
     123        virtual BOOL PreTranslateMessage(MSG* pMsg); 
    120124 
    121125        LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 
  • trunk/src/buzelib/WaveTableView.cpp

    r1335 r1338  
    377377        document->addView(this); 
    378378 
     379        hAccel = AtlLoadAccelerators(IDR_WAVETABLE); 
     380 
     381        CMessageLoop* pLoop = _Module.GetMessageLoop(); 
     382        ATLASSERT(pLoop != NULL); 
     383        pLoop->AddIdleHandler(this); 
     384        pLoop->AddMessageFilter(this); 
     385 
    379386        mainFrame->addTabableView(m_hWnd); 
    380         mainFrame->addAccelerator(m_hWnd, AtlLoadAccelerators(IDR_WAVETABLE)); 
    381  
    382         return 0; 
    383 } 
     387 
     388        return 0; 
     389} 
     390 
     391BOOL CWaveTableView::PreTranslateMessage(MSG* pMsg) { 
     392        if (GetFocus() == *this || GetFocus() == waveTableList || GetFocus() == waveEntryList || GetFocus() == waveEditorCtrl) 
     393                if (::TranslateAccelerator(m_hWnd, hAccel, pMsg)) 
     394                        return TRUE; 
     395        return FALSE; 
     396} 
     397 
    384398 
    385399LRESULT CWaveTableView::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { 
    386         // denne fixet crash når vi lukker hele clienten 
     400 
     401        CMessageLoop* pLoop = _Module.GetMessageLoop();