Exemple #1
0
// ----------------------------------------------------------------------------
void JumpTracker::OnMenuJumpNext(wxCommandEvent &event)
// ----------------------------------------------------------------------------
{
    #if defined(LOGGING)
    //LOGIT( _T("JT [%s]"), _T("OnMenuJumpNext"));
    #endif

    m_bJumpInProgress = true;
    do {
        int count = m_ArrayOfJumpData.GetCount();
        if (not count) break;

        if ( count > 1 )
            m_Cursor += 1;
        if (m_Cursor > (int)count-1)
            m_Cursor = 0;

        EditorManager* edmgr = Manager::Get()->GetEditorManager();
        int cursor = m_Cursor;
        wxString edFilename;
        long edPosn;
        bool found = false;
        for (int i = 0; i<count; ++i, ++cursor)
        {
            if (cursor > count-1) cursor = 0;
            JumpData& jumpNext = m_ArrayOfJumpData.Item(cursor);
            edFilename = jumpNext.GetFilename();
            edPosn = jumpNext.GetPosition();
            if (not edmgr->IsOpen(edFilename))
                continue;
            found = true;
            break;
        }
        if (not found) break;

        m_Cursor = cursor;

        #if defined(LOGGING)
        LOGIT( _T("JT OnMenuJumpNext [%s][%ld]curs[%d]"), edFilename.c_str(), edPosn, m_Cursor);
        #endif
        // activate editor
        EditorBase* eb = edmgr->GetEditor(edFilename);
        if (not eb) break;

        edmgr->SetActiveEditor(eb);
        // position to editor line
        cbEditor* cbed = edmgr->GetBuiltinEditor(eb);
        if (not cbed) break;

        cbed->GotoLine(cbed->GetControl()->LineFromPosition(edPosn)); //center on scrn
        cbed->GetControl()->GotoPos(edPosn);
    }while(0);

    m_bJumpInProgress = false;
    return;
}