// qDebug("CanvasNavigator::updateSelections"); foreach(PartItem* p, m_parts) { Part* part = p->part(); if(part) { int i = part->colorIndex(); QColor partWaveColor(config.partWaveColors[i]); QColor partColor(config.partColors[i]); //partWaveColor.setAlpha(150); partColor.setAlpha(150); p->setBrush(part->selected() ? partWaveColor : partColor); p->setPen(part->selected() ? partColor : partWaveColor); } }
//public void RGBElement::stateMaschine() { switch(m_state) { case 0: //OFF { m_Rnext = 0; m_Gnext = 0; m_Bnext = 0; m_brightness = 1; m_fade = false; m_sync = false; break; } case 1: //OFF_FADE_DOWN ==> STATE 0 { m_Rnext = 0; m_Gnext = 0; m_Bnext = 0; m_brightness = 1; m_fade = true; m_sync = true; if(isReady()) { m_state = 0; m_out->pDln(); m_out->pDS("_%E"); m_out->pD(m_id); m_out->pDS("_%M"); m_out->pD(m_state); //PROFILE/MODE m_out->pDln(); } break; } case 2: //ON_WHITE { m_Rnext = 255; m_Gnext = 255; m_Bnext = 255; m_brightness = 1; m_fade = false; m_sync = false; break; } case 3: //ON_WHITE_FADE_UP ==> STATE 2 { m_Rnext = 255; m_Gnext = 255; m_Bnext = 255; m_brightness = 1; m_fade = true; m_uTime = 5; m_sync = true; if(isReady()) { m_state = 2; m_out->pDln(); m_out->pDS("_%E"); m_out->pD(m_id); m_out->pDS("_%M"); m_out->pD(m_state); //PROFILE/MODE m_out->pDln(); } break; } case 4: //SELECTED_COLOR { break; } case 5: //NEXT_COLOR { if(m_autoNext && (m_sync || isReady())) { nextColor(); m_out->pDS("_%E"); m_out->pD(m_id); m_out->pDS("_%R"); m_out->pD(m_Rnext); //RED m_out->pDS("_%G"); m_out->pD(m_Gnext); //GREEN m_out->pDS("_%B"); m_out->pD(m_Bnext); //BLUE m_out->pDln(); } break; } case 6: //SHUFFLE_COLOR { if(m_autoNext && (m_sync || isReady())) { shuffleColor(); m_out->pDS("_%E"); m_out->pD(m_id); m_out->pDS("_%R"); m_out->pD(m_Rnext); //RED m_out->pDS("_%G"); m_out->pD(m_Gnext); //GREEN m_out->pDS("_%B"); m_out->pD(m_Bnext); //BLUE m_out->pDln(); } break; } case 7: //PART_COLORS { if(m_autoNext && (m_sync || isReady())) { partColor(); m_out->pDS("_%E"); m_out->pD(m_id); m_out->pDS("_%R"); m_out->pD(m_Rnext); //RED m_out->pDS("_%G"); m_out->pD(m_Gnext); //GREEN m_out->pDS("_%B"); m_out->pD(m_Bnext); //BLUE m_out->pDln(); } break; } case 8: //RAND_COLOR { if(m_autoNext && (m_sync || isReady())) { randColor(); m_out->pDS("_%E"); m_out->pD(m_id); m_out->pDS("_%R"); m_out->pD(m_Rnext); //RED m_out->pDS("_%G"); m_out->pD(m_Gnext); //GREEN m_out->pDS("_%B"); m_out->pD(m_Bnext); //BLUE m_out->pDln(); } break; } default: //SWTICH_OFF { m_state = 0; } } }
void CanvasNavigator::updateParts()/*{{{*/ { m_editing = true; m_playhead = 0; m_start = 0; m_canvasBox = 0; m_punchIn = 0; m_punchOut = 0; m_parts.clear(); m_markers.clear(); m_scene->clear(); /*foreach(PartItem* i, m_parts) m_scene->removeItem(i); while(m_parts.size()) delete m_parts.takeFirst();*/ m_heightList.clear(); m_scene->setSceneRect(QRectF()); int index = 1; //QList<QGraphicsItem*> group; MidiTrackList* tl = song->visibletracks(); ciMidiTrack ci = tl->begin(); for(; ci != tl->end(); ci++) { m_heightList.append((*ci)->height()); } ci = tl->begin(); if(ci != tl->end()) { int mh = (*ci)->height(); double partHeight = (mh * 8)/100; m_start = m_scene->addRect(0.0, 0.0, calcSize(song->len()), partHeight); m_start->setBrush(QColor(63, 63, 63)); m_start->setPen(QPen(QColor(63, 63, 63))); m_start->setZValue(-50); ci++;//Special case for master } for(; ci != tl->end(); ci++) { MidiTrack* track = *ci; if(track) { QList<int> list = m_heightList.mid(0, index); int ypos = 0; foreach(int i, list) ypos += i; ypos = (ypos * 8)/100; int ih = m_heightList.at(index); double partHeight = (ih * 8)/100; //qDebug("CanvasNavigator::updateParts: partHeight: %2f, ypos: %d", partHeight, ypos); PartList* parts = track->parts(); if(parts && !parts->empty()) { for(iPart p = parts->begin(); p != parts->end(); p++) { Part *part = p->second; int tick, len; if(part) { tick = part->tick(); len = part->lenTick(); } double w = calcSize(len); double pos = calcSize(tick); PartItem* item = new PartItem(pos, ypos, w, partHeight); item->setPart(part); m_parts.append(item); //group.append((QGraphicsItem*)item); int i = part->colorIndex(); QColor partWaveColor(config.partWaveColors[i]); QColor partColor(config.partColors[i]); //partWaveColor.setAlpha(150); partColor.setAlpha(150); item->setBrush(part->selected() ? partWaveColor : partColor); item->setPen(part->selected() ? partColor : partWaveColor); m_scene->addItem(item); } } ++index; } } QColor colTimeLine = QColor(0, 186, 255); int kpos = 0; foreach(int i, m_heightList) kpos += i; //kpos = ((kpos + 400) * 8)/100; kpos = ((kpos + 400) * 8)/100; m_playhead = new QGraphicsRectItem(0, 0, 1, kpos); m_playhead->setBrush(colTimeLine); m_playhead->setPen(Qt::NoPen); m_playhead->setZValue(124001.0f); m_playhead->setFlags(QGraphicsItem::ItemIgnoresTransformations); m_scene->addItem(m_playhead); QColor loopColor(139, 225, 69); QColor markerColor(243,191,124); MarkerList* markers = song->marker(); for (iMarker m = markers->begin(); m != markers->end(); ++m) { //double xp = calcSize(m->second.tick()); QGraphicsRectItem *marker = m_scene->addRect(0, 0, 1, kpos); marker->setData(Qt::UserRole, m->second.id()); m_markers[m->second.id()] = marker; marker->setPen(Qt::NoPen); marker->setBrush(markerColor); marker->setZValue(124002.0f); marker->setFlags(QGraphicsItem::ItemIgnoresTransformations); m_updateMarkers = true; } m_punchIn = new QGraphicsRectItem(0, 0, 1, kpos); m_punchIn->setBrush(loopColor); m_punchIn->setPen(Qt::NoPen); m_punchIn->setZValue(124003.0f); m_punchIn->setFlags(QGraphicsItem::ItemIgnoresTransformations); m_scene->addItem(m_punchIn); m_punchIn->setVisible(song->loop() || song->punchin()); m_punchOut = new QGraphicsRectItem(0, 0, 1, kpos); m_punchOut->setBrush(loopColor); m_punchOut->setPen(Qt::NoPen); m_punchOut->setZValue(124003.0f); m_punchOut->setFlags(QGraphicsItem::ItemIgnoresTransformations); m_scene->addItem(m_punchOut); m_punchOut->setVisible(song->loop() || song->punchout()); createCanvasBox(); //group.append((QGraphicsItem*)m_start); //group.append((QGraphicsItem*)m_playhead); //if(group.size()) //{ // m_partGroup = m_scene->createItemGroup(group); //} //else m_partGroup = 0; updateSpacing(); m_editing = false; }/*}}}*/