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

📄 eventview.cpp

📁 LINUX下的混音软件
💻 CPP
📖 第 1 页 / 共 4 页
字号:
    while ((listItem = it.current()) != 0) {        item = dynamic_cast<EventViewItem*>((*it));        if (itemIndex == -1)            itemIndex = m_eventList->itemIndex(*it);        if (item) {            if (cutSelection == 0)                cutSelection =                    new EventSelection(*(item->getSegment()));            cutSelection->addEvent(item->getEvent());        }        ++it;    }    if (cutSelection) {        if (itemIndex >= 0) {            m_listSelection.clear();            m_listSelection.push_back(itemIndex);        }        addCommandToHistory(new CutCommand(*cutSelection,                                           getDocument()->getClipboard()));    }}voidEventView::slotEditCopy(){    QPtrList<QListViewItem> selection = m_eventList->selectedItems();    if (selection.count() == 0)        return ;    RG_DEBUG << "EventView::slotEditCopy - copying "    << selection.count() << " items" << endl;    QPtrListIterator<QListViewItem> it(selection);    QListViewItem *listItem;    EventViewItem *item;    EventSelection *copySelection = 0;    // clear the selection for post modification updating    //    m_listSelection.clear();    while ((listItem = it.current()) != 0) {        item = dynamic_cast<EventViewItem*>((*it));        m_listSelection.push_back(m_eventList->itemIndex(*it));        if (item) {            if (copySelection == 0)                copySelection =                    new EventSelection(*(item->getSegment()));            copySelection->addEvent(item->getEvent());        }        ++it;    }    if (copySelection) {        addCommandToHistory(new CopyCommand(*copySelection,                                            getDocument()->getClipboard()));    }}voidEventView::slotEditPaste(){    if (getDocument()->getClipboard()->isEmpty()) {        slotStatusHelpMsg(i18n("Clipboard is empty"));        return ;    }    KTmpStatusMsg msg(i18n("Inserting clipboard contents..."), this);    timeT insertionTime = 0;    QPtrList<QListViewItem> selection = m_eventList->selectedItems();    if (selection.count()) {        EventViewItem *item = dynamic_cast<EventViewItem*>(selection.at(0));        if (item)            insertionTime = item->getEvent()->getAbsoluteTime();        // remember the selection        //        m_listSelection.clear();        QPtrListIterator<QListViewItem> it(selection);        QListViewItem *listItem;        while ((listItem = it.current()) != 0) {            m_listSelection.push_back(m_eventList->itemIndex(*it));            ++it;        }    }    PasteEventsCommand *command = new PasteEventsCommand                                  (*m_segments[0], getDocument()->getClipboard(),                                   insertionTime, PasteEventsCommand::MatrixOverlay);    if (!command->isPossible()) {        slotStatusHelpMsg(i18n("Couldn't paste at this point"));    } else        addCommandToHistory(command);    RG_DEBUG << "EventView::slotEditPaste - pasting "    << selection.count() << " items" << endl;}voidEventView::slotEditDelete(){    QPtrList<QListViewItem> selection = m_eventList->selectedItems();    if (selection.count() == 0)        return ;    RG_DEBUG << "EventView::slotEditDelete - deleting "    << selection.count() << " items" << endl;    QPtrListIterator<QListViewItem> it(selection);    QListViewItem *listItem;    EventViewItem *item;    EventSelection *deleteSelection = 0;    int itemIndex = -1;    while ((listItem = it.current()) != 0) {        item = dynamic_cast<EventViewItem*>((*it));        if (itemIndex == -1)            itemIndex = m_eventList->itemIndex(*it);        if (item) {            if (m_deletedEvents.find(item->getEvent()) != m_deletedEvents.end()) {                ++it;                continue;            }            if (deleteSelection == 0)                deleteSelection =                    new EventSelection(*m_segments[0]);            deleteSelection->addEvent(item->getEvent());        }        ++it;    }    if (deleteSelection) {        if (itemIndex >= 0) {            m_listSelection.clear();            m_listSelection.push_back(itemIndex);        }        addCommandToHistory(new EraseCommand(*deleteSelection));    }}voidEventView::slotEditInsert(){    RG_DEBUG << "EventView::slotEditInsert" << endl;    timeT insertTime = m_segments[0]->getStartTime();    timeT insertDuration = 960;    QPtrList<QListViewItem> selection = m_eventList->selectedItems();    if (selection.count() > 0) {        EventViewItem *item =            dynamic_cast<EventViewItem*>(selection.getFirst());        if (item) {            insertTime = item->getEvent()->getAbsoluteTime();            insertDuration = item->getEvent()->getDuration();        }    }    // Create default event    //    Event *event =        new Event(Note::EventType,                  insertTime,                  insertDuration);    event->set    <Int>(BaseProperties::PITCH, 70);    event->set    <Int>(BaseProperties::VELOCITY, 100);    SimpleEventEditDialog dialog(this, getDocument(), *event, true);    if (dialog.exec() == QDialog::Accepted) {        EventInsertionCommand *command =            new EventInsertionCommand(*m_segments[0],                                      new Event(dialog.getEvent()));        addCommandToHistory(command);    }}voidEventView::slotEditEvent(){    RG_DEBUG << "EventView::slotEditEvent" << endl;    QPtrList<QListViewItem> selection = m_eventList->selectedItems();    if (selection.count() > 0) {        EventViewItem *item =            dynamic_cast<EventViewItem*>(selection.getFirst());        if (item) {            Event *event = item->getEvent();            SimpleEventEditDialog dialog(this, getDocument(), *event, false);            if (dialog.exec() == QDialog::Accepted && dialog.isModified()) {                EventEditCommand *command =                    new EventEditCommand(*(item->getSegment()),                                         event,                                         dialog.getEvent());                addCommandToHistory(command);            }        }    }}voidEventView::slotEditEventAdvanced(){    RG_DEBUG << "EventView::slotEditEventAdvanced" << endl;    QPtrList<QListViewItem> selection = m_eventList->selectedItems();    if (selection.count() > 0) {        EventViewItem *item =            dynamic_cast<EventViewItem*>(selection.getFirst());        if (item) {            Event *event = item->getEvent();            EventEditDialog dialog(this, *event);            if (dialog.exec() == QDialog::Accepted && dialog.isModified()) {                EventEditCommand *command =                    new EventEditCommand(*(item->getSegment()),                                         event,                                         dialog.getEvent());                addCommandToHistory(command);            }        }    }}voidEventView::slotSelectAll(){    m_listSelection.clear();    for (int i = 0; m_eventList->itemAtIndex(i); ++i) {        m_listSelection.push_back(i);        m_eventList->setSelected(m_eventList->itemAtIndex(i), true);    }}voidEventView::slotClearSelection(){    m_listSelection.clear();    for (int i = 0; m_eventList->itemAtIndex(i); ++i) {        m_eventList->setSelected(m_eventList->itemAtIndex(i), false);    }}voidEventView::slotFilterSelection(){    m_listSelection.clear();    QPtrList<QListViewItem> selection = m_eventList->selectedItems();    if (selection.count() == 0)        return ;    EventFilterDialog dialog(this);    if (dialog.exec() == QDialog::Accepted) {        QPtrListIterator<QListViewItem> it(selection);        QListViewItem *listItem;        while ((listItem = it.current()) != 0) {            EventViewItem * item = dynamic_cast<EventViewItem*>(*it);            if (!item) {                ++it;                continue;            }            if (!dialog.keepEvent(item->getEvent())) {                m_listSelection.push_back(m_eventList->itemIndex(*it));                m_eventList->setSelected(item, false);            }            ++it;        }    }}voidEventView::setupActions(){    EditViewBase::setupActions("eventlist.rc");    QString pixmapDir = KGlobal::dirs()->findResource("appdata", "pixmaps/");    QIconSet icon(QPixmap(pixmapDir + "/toolbar/event-insert.png"));    new KAction(i18n("&Insert Event"), icon, Key_I, this,                SLOT(slotEditInsert()), actionCollection(),                "insert");    QCanvasPixmap pixmap(pixmapDir + "/toolbar/event-delete.png");    icon = QIconSet(pixmap);    new KAction(i18n("&Delete Event"), icon, Key_Delete, this,                SLOT(slotEditDelete()), actionCollection(),                "delete");    pixmap.load(pixmapDir + "/toolbar/event-edit.png");    icon = QIconSet(pixmap);    new KAction(i18n("&Edit Event"), icon, Key_E, this,                SLOT(slotEditEvent()), actionCollection(),                "edit_simple");    pixmap.load(pixmapDir + "/toolbar/event-edit-advanced.png");    icon = QIconSet(pixmap);    new KAction(i18n("&Advanced Event Editor"), icon, Key_A, this,                SLOT(slotEditEventAdvanced()), actionCollection(),                "edit_advanced");    //    icon = QIconSet(QCanvasPixmap(pixmapDir + "/toolbar/eventfilter.xpm"));    new KAction(i18n("&Filter Selection"), "filter", Key_F, this,                SLOT(slotFilterSelection()), actionCollection(),                "filter_selection");    new KAction(i18n("Select &All"), Key_A + CTRL, this,                SLOT(slotSelectAll()), actionCollection(),                "select_all");    new KAction(i18n("Clear Selection"), Key_Escape, this,                SLOT(slotClearSelection()), actionCollection(),                "clear_selection");    m_config->setGroup(EventViewConfigGroup);    int timeMode = m_config->readNumEntry("timemode", 0);    KRadioAction *action;    pixmap.load(pixmapDir + "/toolbar/time-musical.png");    icon = QIconSet(pixmap);    action = new KRadioAction(i18n("&Musical Times"), icon, 0, this,                              SLOT(slotMusicalTime()),                              actionCollection(), "time_musical");    action->setExclusiveGroup("timeMode");    if (timeMode == 0)        action->setChecked(true);    pixmap.load(pixmapDir + "/toolbar/time-real.png");    icon = QIconSet(pixmap);    action = new KRadioAction(i18n("&Real Times"), icon, 0, this,                              SLOT(slotRealTime()),                              actionCollection(), "time_real");    action->setExclusiveGroup("timeMode");    if (timeMode == 1)        action->setChecked(true);    pixmap.load(pixmapDir + "/toolbar/time-raw.png");    icon = QIconSet(pixmap);    action = new KRadioAction(i18n("Ra&w Times"), icon, 0, this,                              SLOT(slotRawTime()),                              actionCollection(), "time_raw");    action->setExclusiveGroup("timeMode");    if (timeMode == 2)        action->setChecked(true);    if (m_isTriggerSegment) {        KAction *action = actionCollection()->action("open_in_matrix");        if (action)            delete action;        action = actionCollection()->action("open_in_notation");        if (action)            delete action;    }    createGUI(getRCFileName());}

⌨️ 快捷键说明

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