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

📄 matrixview.cpp

📁 LINUX下的混音软件
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    QObject::connect    (getCanvasView(),     SIGNAL(mouseReleased(timeT, int, QMouseEvent*)),     this,     SLOT(slotMouseReleased(timeT, int, QMouseEvent*)));    QObject::connect    (getCanvasView(), SIGNAL(hoveredOverNoteChanged(int, bool, timeT)),     this, SLOT(slotHoveredOverNoteChanged(int, bool, timeT)));    QObject::connect    (m_pitchRuler, SIGNAL(hoveredOverKeyChanged(unsigned int)),     this, SLOT (slotHoveredOverKeyChanged(unsigned int)));    QObject::connect    (m_pitchRuler, SIGNAL(keyPressed(unsigned int, bool)),     this, SLOT (slotKeyPressed(unsigned int, bool)));    QObject::connect    (m_pitchRuler, SIGNAL(keySelected(unsigned int, bool)),     this, SLOT (slotKeySelected(unsigned int, bool)));    QObject::connect    (m_pitchRuler, SIGNAL(keyReleased(unsigned int, bool)),     this, SLOT (slotKeyReleased(unsigned int, bool)));    QObject::connect    (getCanvasView(), SIGNAL(hoveredOverAbsoluteTimeChanged(unsigned int)),     this, SLOT (slotHoveredOverAbsoluteTimeChanged(unsigned int)));    QObject::connect    (doc, SIGNAL(pointerPositionChanged(timeT)),     this, SLOT(slotSetPointerPosition(timeT)));    MATRIX_DEBUG << "MatrixView : applying layout\n";    bool layoutApplied = applyLayout();    if (!layoutApplied)        KMessageBox::sorry(0, i18n("Couldn't apply piano roll layout"));    else {        MATRIX_DEBUG << "MatrixView : rendering elements\n";        for (unsigned int i = 0; i < m_staffs.size(); ++i) {            m_staffs[i]->positionAllElements();            m_staffs[i]->getSegment().getRefreshStatus            (m_segmentsRefreshStatusIds[i]).setNeedsRefresh(false);        }    }    StandardRuler *topStandardRuler = new StandardRuler(getDocument(),                                &m_hlayout, int(xorigin), 25,                                false, getCentralWidget());    topStandardRuler->setSnapGrid(m_snapGrid);    setTopStandardRuler(topStandardRuler);    StandardRuler *bottomStandardRuler = new StandardRuler(getDocument(),                                   &m_hlayout, 0, 25,                                   true, getBottomWidget());    bottomStandardRuler->setSnapGrid(m_snapGrid);    setBottomStandardRuler(bottomStandardRuler);    topStandardRuler->connectRulerToDocPointer(doc);    bottomStandardRuler->connectRulerToDocPointer(doc);    // Disconnect the default connections for this signal from the    // top ruler, and connect our own instead    QObject::disconnect    (topStandardRuler->getLoopRuler(),     SIGNAL(setPointerPosition(timeT)), 0, 0);    QObject::connect    (topStandardRuler->getLoopRuler(),     SIGNAL(setPointerPosition(timeT)),     this, SLOT(slotSetInsertCursorPosition(timeT)));    QObject::connect    (topStandardRuler,     SIGNAL(dragPointerToPosition(timeT)),     this, SLOT(slotSetInsertCursorPosition(timeT)));    topStandardRuler->getLoopRuler()->setBackgroundColor    (GUIPalette::getColour(GUIPalette::InsertCursorRuler));    connect(topStandardRuler->getLoopRuler(), SIGNAL(startMouseMove(int)),            m_canvasView, SLOT(startAutoScroll(int)));    connect(topStandardRuler->getLoopRuler(), SIGNAL(stopMouseMove()),            m_canvasView, SLOT(stopAutoScroll()));    connect(bottomStandardRuler->getLoopRuler(), SIGNAL(startMouseMove(int)),            m_canvasView, SLOT(startAutoScroll(int)));    connect(bottomStandardRuler->getLoopRuler(), SIGNAL(stopMouseMove()),            m_canvasView, SLOT(stopAutoScroll()));    connect(m_bottomStandardRuler, SIGNAL(dragPointerToPosition(timeT)),            this, SLOT(slotSetPointerPosition(timeT)));    // Force height for the moment    //    m_pitchRuler->setFixedHeight(canvas()->height());    updateViewCaption();    // Add a velocity ruler    //    //!!!    addPropertyViewRuler(BaseProperties::VELOCITY);    m_chordNameRuler = new ChordNameRuler                       (m_referenceRuler, doc, segments, 0, 20, getCentralWidget());    m_chordNameRuler->setStudio(&getDocument()->getStudio());    addRuler(m_chordNameRuler);    m_tempoRuler = new TempoRuler                   (m_referenceRuler, doc, this, 0, 24, false, getCentralWidget());    static_cast<TempoRuler *>(m_tempoRuler)->connectSignals();    addRuler(m_tempoRuler);    stateChanged("have_selection", KXMLGUIClient::StateReverse);    slotTestClipboard();    timeT start = doc->getComposition().getLoopStart();    timeT end = doc->getComposition().getLoopEnd();    m_topStandardRuler->getLoopRuler()->slotSetLoopMarker(start, end);    m_bottomStandardRuler->getLoopRuler()->slotSetLoopMarker(start, end);    setCurrentSelection(0, false);    // Change this if the matrix view ever has its own page    // in the config dialog.    setConfigDialogPageIndex(0);    // default zoom    m_config->setGroup(MatrixViewConfigGroup);    double zoom = m_config->readDoubleNumEntry("Zoom Level",                                               m_hZoomSlider->getCurrentSize());    m_hZoomSlider->setSize(zoom);    m_referenceRuler->setHScaleFactor(zoom);        // Scroll view to centre middle-C and warp to pointer position    //    m_canvasView->scrollBy(0, m_staffs[0]->getCanvasYForHeight(60) / 2);    slotSetPointerPosition(comp.getPosition());    // All toolbars should be created before this is called    setAutoSaveSettings("MatrixView", true);    readOptions();    setOutOfCtor();    // Property and Control Rulers    //    if (getCurrentSegment()->getViewFeatures())        slotShowVelocityControlRuler();    setupControllerTabs();    setRewFFwdToAutoRepeat();    slotCompositionStateUpdate();}MatrixView::~MatrixView(){    slotSaveOptions();    delete m_chordNameRuler;    for (unsigned int i = 0; i < m_staffs.size(); ++i) {        delete m_staffs[i]; // this will erase all "notes" canvas items    }    // This looks silly but the reason is that on destruction of the    // MatrixCanvasView, setCanvas() is called (this is in    // ~QCanvasView so we can't do anything about it). This calls    // QCanvasView::updateContentsSize(), which in turn updates the    // view's scrollbars, hence calling QScrollBar::setValue(), and    // sending the QSCrollbar::valueChanged() signal. But we have a    // slot connected to that signal    // (MatrixView::slotVerticalScrollPianoKeyboard), which scrolls    // the pianoView. However at this stage the pianoView has already    // been deleted, so a likely outcome is a crash.    //    // A solution is to zero out m_pianoView here, and to check if    // it's non null in slotVerticalScrollPianoKeyboard.    //    m_pianoView = 0;    delete m_snapGrid;    if (m_localMapping)        delete m_localMapping;}void MatrixView::slotSaveOptions(){    m_config->setGroup(MatrixViewConfigGroup);    m_config->writeEntry("Show Chord Name Ruler", getToggleAction("show_chords_ruler")->isChecked());    m_config->writeEntry("Show Tempo Ruler", getToggleAction("show_tempo_ruler")->isChecked());    m_config->writeEntry("Show Parameters", m_dockVisible);    //getToggleAction("m_dockLeft->isVisible());    m_config->sync();}void MatrixView::readOptions(){    EditView::readOptions();    m_config->setGroup(MatrixViewConfigGroup);    bool opt = false;    opt = m_config->readBoolEntry("Show Chord Name Ruler", false);    getToggleAction("show_chords_ruler")->setChecked(opt);    slotToggleChordsRuler();    opt = m_config->readBoolEntry("Show Tempo Ruler", true);    getToggleAction("show_tempo_ruler")->setChecked(opt);    slotToggleTempoRuler();    opt = m_config->readBoolEntry("Show Parameters", true);    if (!opt) {        m_dockLeft->undock();        m_dockLeft->hide();        stateChanged("parametersbox_closed", KXMLGUIClient::StateNoReverse);        m_dockVisible = false;    }}void MatrixView::setupActions(){    EditViewBase::setupActions("matrix.rc");    EditView::setupActions();    //    // Edition tools (eraser, selector...)    //    KRadioAction* toolAction = 0;    QString pixmapDir = KGlobal::dirs()->findResource("appdata", "pixmaps/");    QIconSet icon(QPixmap(pixmapDir + "/toolbar/select.xpm"));    toolAction = new KRadioAction(i18n("&Select and Edit"), icon, Key_F2,                                  this, SLOT(slotSelectSelected()),                                  actionCollection(), "select");    toolAction->setExclusiveGroup("tools");    toolAction = new KRadioAction(i18n("&Draw"), "pencil", Key_F3,                                  this, SLOT(slotPaintSelected()),                                  actionCollection(), "draw");    toolAction->setExclusiveGroup("tools");    toolAction = new KRadioAction(i18n("&Erase"), "eraser", Key_F4,                                  this, SLOT(slotEraseSelected()),                                  actionCollection(), "erase");    toolAction->setExclusiveGroup("tools");    toolAction = new KRadioAction(i18n("&Move"), "move", Key_F5,                                  this, SLOT(slotMoveSelected()),                                  actionCollection(), "move");    toolAction->setExclusiveGroup("tools");    QCanvasPixmap pixmap(pixmapDir + "/toolbar/resize.xpm");    icon = QIconSet(pixmap);    toolAction = new KRadioAction(i18n("Resi&ze"), icon, Key_F6,                                  this, SLOT(slotResizeSelected()),                                  actionCollection(), "resize");    toolAction->setExclusiveGroup("tools");    icon = QIconSet(NotePixmapFactory::toQPixmap(NotePixmapFactory::makeToolbarPixmap("chord")));    (new KToggleAction(i18n("C&hord Insert Mode"), icon, Key_H,                       this, SLOT(slotUpdateInsertModeStatus()),                       actionCollection(), "chord_mode"))->    setChecked(false);    pixmap.load(pixmapDir + "/toolbar/step_by_step.xpm");    icon = QIconSet(pixmap);    new KToggleAction(i18n("Ste&p Recording"), icon, 0, this,                      SLOT(slotToggleStepByStep()), actionCollection(),                      "toggle_step_by_step");    pixmap.load(pixmapDir + "/toolbar/quantize.png");    icon = QIconSet(pixmap);    new KAction(EventQuantizeCommand::getGlobalName(), icon, Key_Equal, this,                SLOT(slotTransformsQuantize()), actionCollection(),                "quantize");    new KAction(i18n("Repeat Last Quantize"), Key_Plus, this,                SLOT(slotTransformsRepeatQuantize()), actionCollection(),                "repeat_quantize");    new KAction(CollapseNotesCommand::getGlobalName(), Key_Equal + CTRL, this,                SLOT(slotTransformsCollapseNotes()), actionCollection(),                "collapse_notes");    new KAction(i18n("&Legato"), Key_Minus, this,                SLOT(slotTransformsLegato()), actionCollection(),                "legatoize");    new KAction(ChangeVelocityCommand::getGlobalName(10), 0,                Key_Up + SHIFT, this,                SLOT(slotVelocityUp()), actionCollection(),                "velocity_up");    new KAction(ChangeVelocityCommand::getGlobalName( -10), 0,                Key_Down + SHIFT, this,                SLOT(slotVelocityDown()), actionCollection(),                "velocity_down");    new KAction(i18n("Set to Current Velocity"), 0, this,                SLOT(slotSetVelocitiesToCurrent()), actionCollection(),                "set_to_current_velocity");    new KAction(i18n("Set Event &Velocities..."), 0, this,                SLOT(slotSetVelocities()), actionCollection(),                "set_velocities");    new KAction(i18n("Trigger Se&gment..."), 0, this,                SLOT(slotTriggerSegment()), actionCollection(),                "trigger_segment");    new KAction(i18n("Remove Triggers..."), 0, this,                SLOT(slotRemoveTriggers()), actionCollection(),                "remove_trigger");    new KAction(i18n("Select &All"), Key_A + CTRL, this,                SLOT(slotSelectAll()), actionCollection(),                "select_all");    new KAction(i18n("&Delete"), Key_Delete, this,                SLOT(slotEditDelete()), actionCollection(),                "delete");    new KAction(i18n("Cursor &Back"), 0, Key_Left, this,                SLOT(slotStepBackward()), actionCollection(),                "cursor_back");    new KAction(i18n("Cursor &Forward"), 0, Key_Right, this,                SLOT(slotStepForward()), actionCollection(),                "cursor_forward");    new KAction(i18n("Cursor Ba&ck Bar"), 0, Key_Left + CTRL, this,                SLOT(slotJumpBackward()), actionCollection(),                "cursor_back_bar");    new KAction(i18n("Cursor For&ward Bar"), 0, Key_Right + CTRL, this,                SLOT(slotJumpForward()), actionCollection(),                "cursor_forward_bar");    new KAction(i18n("Cursor Back and Se&lect"), SHIFT + Key_Left, this,                SLOT(slotExtendSelectionBackward()), actionCollection(),                "extend_selection_backward");    new KAction(i18n("Cursor Forward and &Select"), SHIFT + Key_Right, this,                SLOT(slotExtendSelectionForward()), actionCollection(),                "extend_selection_forward");    new KAction(i18n("Cursor Back Bar and Select"), SHIFT + CTRL + Key_Left, this,                SLOT(slotExtendSelectionBackwardBar()), actionCollection(),                "extend_selection_backward_bar");    new KAction(i18n("Cursor Forward Bar and Select"), SHIFT + CTRL + Key_Right, this,                SLOT(slotExtendSelectionForwardBar()), actionCollection(),                "extend_selection_forward_bar");    new KAction(i18n("Cursor to St&art"), 0,                /* #1025717: conflicting meanings for ctrl+a - dupe with Select All                  Key_A + CTRL, */ this,                 SLOT(slotJumpToStart()), actionCollection(),                "cursor_start");    new KAction(i18n("Cursor to &End"), 0, Key_E + CTRL, this,                SLOT(slotJumpToEnd()), actionCollection(),                "cursor_end");    icon = QIconSet(NotePixmapFactory::toQPixmap(NotePixmapFactory::makeToolbarPixmap                    ("transport-cursor-to-pointer")));    new KAction(i18n("Cursor to &Playback Pointer"), icon, 0, this,                SLOT(slotJumpCursorToPlayback()), actionCollection(),                "cursor_to_playback_pointer");    icon = QIconSet(NotePixmapFactory::toQPixmap(NotePixmapFactory::makeToolbarPixmap                    ("transport-play")));    new KAction(i18n("&Play"), icon, Key_Enter, this,                SIGNAL(play()), actionCollection(), "play");    icon = QIconSet(NotePixmapFactory::toQPixmap(NotePixmapFactory::makeToolbarPixmap                    ("transport-stop")));    new KAction(i18n("&Stop"), icon, Key_Insert, this,                SIGNAL(stop()), actionCollection(), "stop");    icon = QIconSet(NotePixmapFactory::toQPixmap(NotePixmapFactory::makeToolbarPixmap                    ("transport-rewind")));    new KAction(i18n("Re&wind"), icon, Key_End, this,                SIGNAL(rewindPlayback()), actionCollection(),                "playback_pointer_back_bar");

⌨️ 快捷键说明

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