⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rosegardenguiview.cpp

📁 LINUX下的混音软件
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    slotAddCommandToHistory(command);}void RosegardenGUIView::slotEditSegmentNotation(Segment* p){    SetWaitCursor waitCursor;    std::vector<Segment *> segmentsToEdit;    RG_DEBUG << "\n\n\n\nRosegardenGUIView::slotEditSegmentNotation: p is " << p << endl;    // The logic here is: If we're calling for this operation to    // happen on a particular segment, then open that segment and if    // it's part of a selection open all other selected segments too.    // If we're not calling for any particular segment, then open all    // selected segments if there are any.    if (haveSelection()) {        SegmentSelection selection = getSelection();        if (!p || (selection.find(p) != selection.end())) {            for (SegmentSelection::iterator i = selection.begin();                    i != selection.end(); ++i) {                if ((*i)->getType() != Segment::Audio) {                    segmentsToEdit.push_back(*i);                }            }        } else {            if (p->getType() != Segment::Audio) {                segmentsToEdit.push_back(p);            }        }    } else if (p) {        if (p->getType() != Segment::Audio) {            segmentsToEdit.push_back(p);        }    } else {        return ;    }    if (segmentsToEdit.empty()) {        KMessageBox::sorry(this, i18n("No non-audio segments selected"));        return ;    }    slotEditSegmentsNotation(segmentsToEdit);}void RosegardenGUIView::slotEditSegmentsNotation(std::vector<Segment *> segmentsToEdit){    NotationView *view = createNotationView(segmentsToEdit);    if (view)        view->show();}NotationView *RosegardenGUIView::createNotationView(std::vector<Segment *> segmentsToEdit){    NotationView *notationView =        new NotationView(getDocument(), segmentsToEdit, this, true);    if (!notationView->isOK()) {        RG_DEBUG << "slotEditSegmentNotation : operation cancelled" << endl;        delete notationView;        return 0;    }    // For tempo changes (ugh -- it'd be nicer to make a tempo change    // command that could interpret all this stuff from the dialog)    //    connect(notationView, SIGNAL(changeTempo(timeT,                                 tempoT,                                 tempoT,                                 TempoDialog::TempoDialogAction)),            RosegardenGUIApp::self(), SLOT(slotChangeTempo(timeT,                                           tempoT,                                           tempoT,                                           TempoDialog::TempoDialogAction)));    connect(notationView, SIGNAL(windowActivated()),            this, SLOT(slotActiveMainWindowChanged()));    connect(notationView, SIGNAL(selectTrack(int)),            this, SLOT(slotSelectTrackSegments(int)));    connect(notationView, SIGNAL(play()),            RosegardenGUIApp::self(), SLOT(slotPlay()));    connect(notationView, SIGNAL(stop()),            RosegardenGUIApp::self(), SLOT(slotStop()));    connect(notationView, SIGNAL(fastForwardPlayback()),            RosegardenGUIApp::self(), SLOT(slotFastforward()));    connect(notationView, SIGNAL(rewindPlayback()),            RosegardenGUIApp::self(), SLOT(slotRewind()));    connect(notationView, SIGNAL(fastForwardPlaybackToEnd()),            RosegardenGUIApp::self(), SLOT(slotFastForwardToEnd()));    connect(notationView, SIGNAL(rewindPlaybackToBeginning()),            RosegardenGUIApp::self(), SLOT(slotRewindToBeginning()));    connect(notationView, SIGNAL(panic()),            RosegardenGUIApp::self(), SLOT(slotPanic()));    connect(notationView, SIGNAL(saveFile()),            RosegardenGUIApp::self(), SLOT(slotFileSave()));    connect(notationView, SIGNAL(jumpPlaybackTo(timeT)),            getDocument(), SLOT(slotSetPointerPosition(timeT)));    connect(notationView, SIGNAL(openInNotation(std::vector<Segment *>)),            this, SLOT(slotEditSegmentsNotation(std::vector<Segment *>)));    connect(notationView, SIGNAL(openInMatrix(std::vector<Segment *>)),            this, SLOT(slotEditSegmentsMatrix(std::vector<Segment *>)));    connect(notationView, SIGNAL(openInPercussionMatrix(std::vector<Segment *>)),            this, SLOT(slotEditSegmentsPercussionMatrix(std::vector<Segment *>)));    connect(notationView, SIGNAL(openInEventList(std::vector<Segment *>)),            this, SLOT(slotEditSegmentsEventList(std::vector<Segment *>)));/* hjj: WHAT DO DO WITH THIS ?    connect(notationView, SIGNAL(editMetadata(QString)),            this, SLOT(slotEditMetadata(QString)));*/    connect(notationView, SIGNAL(editTriggerSegment(int)),            this, SLOT(slotEditTriggerSegment(int)));    connect(notationView, SIGNAL(staffLabelChanged(TrackId, QString)),            this, SLOT(slotChangeTrackLabel(TrackId, QString)));    connect(notationView, SIGNAL(toggleSolo(bool)),            RosegardenGUIApp::self(), SLOT(slotToggleSolo(bool)));    connect(notationView, SIGNAL(editTimeSignature(timeT)),            RosegardenGUIApp::self(), SLOT(slotEditTempos(timeT)));    SequenceManager *sM = getDocument()->getSequenceManager();    connect(sM, SIGNAL(insertableNoteOnReceived(int, int)),            notationView, SLOT(slotInsertableNoteOnReceived(int, int)));    connect(sM, SIGNAL(insertableNoteOffReceived(int, int)),            notationView, SLOT(slotInsertableNoteOffReceived(int, int)));    connect(notationView, SIGNAL(stepByStepTargetRequested(QObject *)),            this, SIGNAL(stepByStepTargetRequested(QObject *)));    connect(this, SIGNAL(stepByStepTargetRequested(QObject *)),            notationView, SLOT(slotStepByStepTargetRequested(QObject *)));    connect(RosegardenGUIApp::self(), SIGNAL(compositionStateUpdate()),            notationView, SLOT(slotCompositionStateUpdate()));    connect(this, SIGNAL(compositionStateUpdate()),            notationView, SLOT(slotCompositionStateUpdate()));    // Encourage the notation view window to open to the same    // interval as the current segment view    if (m_trackEditor->getSegmentCanvas()->horizontalScrollBar()->value() > 1) { // don't scroll unless we need to        // first find the time at the center of the visible segment canvas        int centerX = (int)(m_trackEditor->getSegmentCanvas()->contentsX() +                            m_trackEditor->getSegmentCanvas()->visibleWidth() / 2);        timeT centerSegmentView = m_trackEditor->getRulerScale()->getTimeForX(centerX);        // then scroll the notation view to that time, "localized" for the current segment        notationView->scrollToTime(centerSegmentView);        notationView->updateView();    }    return notationView;}void RosegardenGUIView::slotEditSegmentMatrix(Segment* p){    SetWaitCursor waitCursor;    std::vector<Segment *> segmentsToEdit;    // unlike notation, if we're calling for this on a particular    // segment we don't open all the other selected segments as well    // (fine in notation because they're in a single window)    if (p) {        if (p->getType() != Segment::Audio) {            segmentsToEdit.push_back(p);        }    } else {        int count = 0;        SegmentSelection selection = getSelection();        for (SegmentSelection::iterator i = selection.begin();                i != selection.end(); ++i) {            if ((*i)->getType() != Segment::Audio) {                slotEditSegmentMatrix(*i);                if (++count == maxEditorsToOpen)                    break;            }        }        return ;    }    if (segmentsToEdit.empty()) {        KMessageBox::sorry(this, i18n("No non-audio segments selected"));        return ;    }    slotEditSegmentsMatrix(segmentsToEdit);}void RosegardenGUIView::slotEditSegmentPercussionMatrix(Segment* p){    SetWaitCursor waitCursor;    std::vector<Segment *> segmentsToEdit;    // unlike notation, if we're calling for this on a particular    // segment we don't open all the other selected segments as well    // (fine in notation because they're in a single window)    if (p) {        if (p->getType() != Segment::Audio) {            segmentsToEdit.push_back(p);        }    } else {        int count = 0;        SegmentSelection selection = getSelection();        for (SegmentSelection::iterator i = selection.begin();                i != selection.end(); ++i) {            if ((*i)->getType() != Segment::Audio) {                slotEditSegmentPercussionMatrix(*i);                if (++count == maxEditorsToOpen)                    break;            }        }        return ;    }    if (segmentsToEdit.empty()) {        KMessageBox::sorry(this, i18n("No non-audio segments selected"));        return ;    }    slotEditSegmentsPercussionMatrix(segmentsToEdit);}void RosegardenGUIView::slotEditSegmentsMatrix(std::vector<Segment *> segmentsToEdit){    int count = 0;    for (std::vector<Segment *>::iterator i = segmentsToEdit.begin();            i != segmentsToEdit.end(); ++i) {        std::vector<Segment *> tmpvec;        tmpvec.push_back(*i);        MatrixView *view = createMatrixView(tmpvec, false);        if (view) {            view->show();            if (++count == maxEditorsToOpen)                break;        }    }}void RosegardenGUIView::slotEditSegmentsPercussionMatrix(std::vector<Segment *> segmentsToEdit){    int count = 0;    for (std::vector<Segment *>::iterator i = segmentsToEdit.begin();            i != segmentsToEdit.end(); ++i) {        std::vector<Segment *> tmpvec;        tmpvec.push_back(*i);        MatrixView *view = createMatrixView(tmpvec, true);        if (view) {            view->show();            if (++count == maxEditorsToOpen)                break;        }    }}MatrixView *RosegardenGUIView::createMatrixView(std::vector<Segment *> segmentsToEdit, bool drumMode){    MatrixView *matrixView = new MatrixView(getDocument(),                                            segmentsToEdit,                                            this,                                            drumMode);    // For tempo changes (ugh -- it'd be nicer to make a tempo change    // command that could interpret all this stuff from the dialog)    //    connect(matrixView, SIGNAL(changeTempo(timeT,                                           tempoT,                                           tempoT,                                           TempoDialog::TempoDialogAction)),            RosegardenGUIApp::self(), SLOT(slotChangeTempo(timeT,                                           tempoT,                                           tempoT,                                           TempoDialog::TempoDialogAction)));    connect(matrixView, SIGNAL(windowActivated()),            this, SLOT(slotActiveMainWindowChanged()));    connect(matrixView, SIGNAL(selectTrack(int)),            this, SLOT(slotSelectTrackSegments(int)));    connect(matrixView, SIGNAL(play()),            RosegardenGUIApp::self(), SLOT(slotPlay()));    connect(matrixView, SIGNAL(stop()),            RosegardenGUIApp::self(), SLOT(slotStop()));    connect(matrixView, SIGNAL(fastForwardPlayback()),            RosegardenGUIApp::self(), SLOT(slotFastforward()));    connect(matrixView, SIGNAL(rewindPlayback()),            RosegardenGUIApp::self(), SLOT(slotRewind()));    connect(matrixView, SIGNAL(fastForwardPlaybackToEnd()),            RosegardenGUIApp::self(), SLOT(slotFastForwardToEnd()));    connect(matrixView, SIGNAL(rewindPlaybackToBeginning()),            RosegardenGUIApp::self(), SLOT(slotRewindToBeginning()));    connect(matrixView, SIGNAL(panic()),            RosegardenGUIApp::self(), SLOT(slotPanic()));    connect(matrixView, SIGNAL(saveFile()),            RosegardenGUIApp::self(), SLOT(slotFileSave()));    connect(matrixView, SIGNAL(jumpPlaybackTo(timeT)),            getDocument(), SLOT(slotSetPointerPosition(timeT)));    connect(matrixView, SIGNAL(openInNotation(std::vector<Segment *>)),            this, SLOT(slotEditSegmentsNotation(std::vector<Segment *>)));    connect(matrixView, SIGNAL(openInMatrix(std::vector<Segment *>)),            this, SLOT(slotEditSegmentsMatrix(std::vector<Segment *>)));    connect(matrixView, SIGNAL(openInEventList(std::vector<Segment *>)),            this, SLOT(slotEditSegmentsEventList(std::vector<Segment *>)));    connect(matrixView, SIGNAL(editTriggerSegment(int)),            this, SLOT(slotEditTriggerSegment(int)));    connect(matrixView, SIGNAL(toggleSolo(bool)),            RosegardenGUIApp::self(), SLOT(slotToggleSolo(bool)));    connect(matrixView, SIGNAL(editTimeSignature(timeT)),            RosegardenGUIApp::self(), SLOT(slotEditTempos(timeT)));    SequenceManager *sM = getDocument()->getSequenceManager();    connect(sM, SIGNAL(insertableNoteOnReceived(int, int)),            matrixView, SLOT(slotInsertableNoteOnReceived(int, int)));    connect(sM, SIGNAL(insertableNoteOffReceived(int, int)),            matrixView, SLOT(slotInsertableNoteOffReceived(int, int)));    connect(matrixView, SIGNAL(stepByStepTargetRequested(QObject *)),            this, SIGNAL(stepByStepTargetRequested(QObject *)));    connect(this, SIGNAL(stepByStepTargetRequested(QObject *)),            matrixView, SLOT(slotStepByStepTargetRequested(QObject *)));    connect(RosegardenGUIApp::self(), SIGNAL(compositionStateUpdate()),            matrixView, SLOT(slotCompositionStateUpdate()));    connect(this, SIGNAL(compositionStateUpdate()),            matrixView, SLOT(slotCompositionStateUpdate()));    connect(this,            SIGNAL(instrumentLevelsChanged(InstrumentId,                                           const LevelInfo &)),            matrixView,            SLOT(slotInstrumentLevelsChanged(InstrumentId,                                             const LevelInfo &)));    // Encourage the matrix view window to open to the same    // interval as the current segment view    if (m_trackEditor->getSegmentCanvas()->horizontalScrollBar()->value() > 1) { // don't scroll unless we need to        // first find the time at the center of the visible segment canvas        int centerX = (int)(m_trackEditor->getSegmentCanvas()->contentsX());        // Seems to work better for matrix view to scroll to left side        // + m_trackEditor->getSegmentCanvas()->visibleWidth() / 2);        timeT centerSegmentView = m_trackEditor->getRulerScale()->getTimeForX(centerX);        // then scroll the notation view to that time, "localized" for the current segment        matrixView->scrollToTime(centerSegmentView);        matrixView->updateView();    }    return matrixView;}void RosegardenGUIView::slotEditSegmentEventList(Segment *p){    SetWaitCursor waitCursor;    std::vector<Segment *> segmentsToEdit;    // unlike notation, if we're calling for this on a particular    // segment we don't open all the other selected segments as well    // (fine in notation because they're in a single window)    if (p) {        if (p->getType() != Segment::Audio) {            segmentsToEdit.push_back(p);        }    } else {        int count = 0;        SegmentSelection selection = getSelection();        for (SegmentSelection::iterator i = selection.begin();                i != selection.end(); ++i) {            if ((*i)->getType() != Segment::Audio) {                slotEditSegmentEventList(*i);                if (++count == maxEditorsToOpen)                    break;            }        }        return ;    }    if (segmentsToEdit.empty()) {        KMessageBox::sorry(this, i18n("No non-audio segments selected"));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -