~s-cecilio/lenmus/v5.1.x

« back to all changes in this revision

Viewing changes to src/app/ScoreView.cpp

  • Committer: cecilios
  • Date: 2008-09-22 16:39:15 UTC
  • Revision ID: svn-v4:2587a929-2f0e-0410-ae78-fe6f687d5efe:trunk:389

Show diffs side-by-side

added added

removed removed

Lines of Context:
483
483
 
484
484
        m_pDraggedGMO = (lmGMObject*)NULL;          //object being dragged
485
485
        m_pMouseOverGMO = (lmGMObject*)NULL;    //object on which mouse was flying over
486
 
    wxLogMessage(_T("[lmScoreView::OnNewGraphicalModel]"));
 
486
    //wxLogMessage(_T("[lmScoreView::OnNewGraphicalModel]"));
487
487
}
488
488
 
489
489
void lmScoreView::OnUpdate(wxView* sender, wxObject* hint)
515
515
    {
516
516
        //hide caret if there are objects selected. Otherwise, show it
517
517
        int nSel = ((lmBoxScore*)pScore->GetGraphicObject())->GetNumObjectsSelected();
518
 
        wxLogMessage(_T("[lmScoreView::OnUpdate] NumSelected = %d"), nSel);
 
518
        //wxLogMessage(_T("[lmScoreView::OnUpdate] NumSelected = %d"), nSel);
519
519
        m_pCaret->SetInvisible(((lmBoxScore*)pScore->GetGraphicObject())->GetNumObjectsSelected() > 0);
520
520
        UpdateCaret();
521
521
        ShowCaret();
533
533
        m_vEndDrag = lmDPoint(0, 0);
534
534
        m_vStartDrag.x = 0;
535
535
        m_vStartDrag.y = 0;
536
 
 
537
536
}
538
537
 
539
538
bool lmScoreView::OnClose(bool deleteWindow)
1059
1058
        }
1060
1059
 
1061
1060
 
1062
 
    //check for mouse moving over objects
 
1061
    //check for mouse moving over selectable objects
1063
1062
    if (nEventType==wxEVT_MOTION && !fDragging)
1064
1063
    {
1065
 
                //find the object pointed with the mouse
1066
 
                lmGMObject* pGMO = m_graphMngr.FindSelectableObjectAtPagePos(m_nNumPage, uPagePos);
 
1064
                //find the object pointed with the mouse. 
 
1065
                lmGMObject* pGMO = m_graphMngr.FindObjectAtPagePos(m_nNumPage, uPagePos, true);
1067
1066
                if (pGMO)
1068
1067
        {
1069
1068
            if (m_pMouseOverGMO)
1073
1072
        }
1074
1073
        else
1075
1074
        {
1076
 
                //DBG --------------------------------------------------------------------------------
1077
 
                wxString sMsg = _T("");
1078
 
                m_pMainFrame->SetStatusBarMsg(sMsg);
1079
 
                // END DBG ---------------------------------------------------------------------------
 
1075
                ////DBG --------------------------------------------------------------------------------
 
1076
                //wxString sMsg = _T("");
 
1077
                //m_pMainFrame->SetStatusBarMsg(sMsg);
 
1078
                //// END DBG ---------------------------------------------------------------------------
1080
1079
            if (m_pMouseOverGMO)
1081
1080
            {
1082
1081
                m_pMouseOverGMO->OnMouseOut(m_pCanvas, uPagePos);
1105
1104
                        #endif
1106
1105
 
1107
1106
                        //find the object pointed with the mouse
1108
 
                        lmGMObject* pGMO = m_graphMngr.FindSelectableObjectAtPagePos(m_nNumPage, uPagePos);
 
1107
                        lmGMObject* pGMO = m_graphMngr.FindObjectAtPagePos(m_nNumPage, uPagePos, false);
1109
1108
                        if (pGMO) // Object event
1110
1109
                        {
1111
1110
                                #ifdef __WXDEBUG__
2068
2067
        int nStaff = pSS->GetNumStaff();
2069
2068
        int nMeasure = pBSV->GetNumMeasure();
2070
2069
 
2071
 
        //DBG --------------------------------------------------------------------------------
2072
 
        wxString sMsg = wxString::Format(_T("[lmScoreView::OnClickOnStaff] Click on staff %d, on measure %d"),
2073
 
                                                                         nStaff, nMeasure);
2074
 
        m_pMainFrame->SetStatusBarMsg(sMsg);
2075
 
        // END DBG ---------------------------------------------------------------------------
 
2070
        ////DBG --------------------------------------------------------------------------------
 
2071
        //wxString sMsg = wxString::Format(_T("[lmScoreView::OnClickOnStaff] Click on staff %d, on measure %d"),
 
2072
        //                                                               nStaff, nMeasure);
 
2073
        //m_pMainFrame->SetStatusBarMsg(sMsg);
 
2074
        //// END DBG ---------------------------------------------------------------------------
2076
2075
 
2077
2076
        //Move to nearest note/rest to click point
2078
2077
        MoveCaretNearTo(uPos, pVStaff, nStaff, nMeasure);
2239
2238
}
2240
2239
 
2241
2240
 
2242
 
void lmScoreView::CaretRight(bool fNextObject)
 
2241
void lmScoreView::CaretRight(bool fAlsoChordNotes)
2243
2242
{
2244
2243
        //advance to next staff obj.
2245
2244
 
2247
2246
 
2248
2247
        //advance to next staff obj.
2249
2248
    HideCaret();
2250
 
    m_pScoreCursor->MoveRight(fNextObject);
 
2249
    m_pScoreCursor->MoveRight(fAlsoChordNotes);
2251
2250
    UpdateCaret();
2252
2251
    ShowCaret();
2253
2252
}
2326
2325
        //status bar: timepos
2327
2326
        m_pMainFrame->SetStatusBarCursorRelPos( m_pScoreCursor->GetCursorTime() );
2328
2327
 
 
2328
    //DBG ------------------------------------------------------------------------------
 
2329
    wxString sType = _T("end of collection");
 
2330
    lmStaffObj* pSO = m_pScoreCursor->GetCursorSO();
 
2331
    if (pSO)
 
2332
    {
 
2333
        sType = pSO->GetName();
 
2334
        if (pSO->IsNoteRest() && ((lmNoteRest*)pSO)->IsNote())
 
2335
        {
 
2336
            lmNote* pN = (lmNote*)pSO;
 
2337
            lmFPitch fp = FPitch(pN->GetAPitch());
 
2338
            lmKeySignature* pKey = pN->GetApplicableKeySignature();
 
2339
            lmEKeySignatures nKey = (pKey ? pKey->GetKeyType() : earmDo);
 
2340
            sType += _T("-");
 
2341
            sType += FPitch_ToRelLDPName(fp, nKey);
 
2342
        }
 
2343
    }
 
2344
    m_pMainFrame->SetStatusBarMsg(wxString::Format(_T("cursor pointing to %s"), sType));
 
2345
    //END DBG --------------------------------------------------------------------------
 
2346
 
2329
2347
        //Display cursor in new position
2330
2348
    lmStaff* pStaff = m_pScoreCursor->GetCursorStaff();
2331
2349
    lmUPoint uPos = m_pScoreCursor->GetCursorPoint();
2439
2457
        lmScore* pScore = m_pDoc->GetScore();
2440
2458
    if (!pScore) return 1.0f;
2441
2459
    
2442
 
    return pScore->TenthsToLogical(1.0f);
 
2460
    return pScore->TenthsToLogical(5.0f);
2443
2461
}
2444
2462
 
2445
2463
 
2512
2530
 
2513
2531
        HideCaret();
2514
2532
        m_pCanvas->SetFocus();
2515
 
        m_pMainFrame->SetStatusBarMsg(_T("[lmScoreView::OnMouseEvent] Starting dragging"));
 
2533
        //m_pMainFrame->SetStatusBarMsg(_T("[lmScoreView::OnMouseEvent] Starting dragging"));
2516
2534
 
2517
2535
        #ifdef __WXDEBUG__
2518
2536
        g_pLogger->LogTrace(_T("lmScoreView::OnMouseEvent"), _T("OnObjectBeginDragLeft()"));
2678
2696
        WXUNUSED(vCanvasOffset);
2679
2697
    WXUNUSED(nKeys);
2680
2698
 
2681
 
        m_pMainFrame->SetStatusBarMsg(_T("[lmScoreView::OnMouseEvent] Finishing dragging"));
 
2699
        //m_pMainFrame->SetStatusBarMsg(_T("[lmScoreView::OnMouseEvent] Finishing dragging"));
2682
2700
 
2683
2701
        #ifdef __WXDEBUG__
2684
2702
        g_pLogger->LogTrace(_T("lmScoreView::OnMouseEvent"), _T("OnObjectEndDragLeft()"));
2857
2875
    if (pGMO->GetType() == eGMO_BoxSlice)
2858
2876
    {
2859
2877
        lmBoxSlice* pBSlice = (lmBoxSlice*)pGMO;
2860
 
        m_pMainFrame->SetStatusBarMsg(
2861
 
            wxString::Format( _T("BoxSlice. Double click on page %d, measure %d"),
2862
 
                m_nNumPage, pBSlice->GetNumMeasure() ));
 
2878
        //m_pMainFrame->SetStatusBarMsg(
 
2879
        //    wxString::Format( _T("BoxSlice. Double click on page %d, measure %d"),
 
2880
        //        m_nNumPage, pBSlice->GetNumMeasure() ));
2863
2881
    }
2864
2882
    else if (pGMO->GetType() == eGMO_BoxPage)
2865
2883
    {
2866
 
        m_pMainFrame->SetStatusBarMsg( wxString::Format( _T("BoxPage. Double click on page %d"), m_nNumPage ));
 
2884
        //m_pMainFrame->SetStatusBarMsg( wxString::Format( _T("BoxPage. Double click on page %d"), m_nNumPage ));
2867
2885
    }
2868
2886
 
2869
2887
        ShowCaret();