int PlayHeadMove::jog() { int x = cpointer().scene_x(); int y = cpointer().scene_y(); if (x < 0) { x = 0; } if (x == m_newXPos && y == m_newYPos) { return 0; } if (x != m_newXPos) { m_playhead->setPos(x, 0); m_newTransportLocation = TimeRef(x * m_sv->timeref_scalefactor); if (m_resync && m_session->is_transport_rolling()) { m_session->set_transport_pos(m_newTransportLocation); } m_sv->update_shuttle_factor(); cpointer().setCursorText(timeref_to_text(m_newTransportLocation, m_sv->timeref_scalefactor)); } cpointer().setCursorPos(QPointF(x, y)); m_newXPos = x; m_newYPos = y; return 1; }
void PlayHeadMove::do_keyboard_move(TimeRef newLocation, bool centerInView) { ied().bypass_jog_until_mouse_movements_exceeded_manhattenlength(); if (newLocation < TimeRef()) { newLocation = TimeRef(); } m_newTransportLocation = newLocation; if (m_resync && m_session->is_transport_rolling()) { m_session->set_transport_pos(m_newTransportLocation); } else { m_playhead->setPos(newLocation / m_sv->timeref_scalefactor, 0); int x = m_sv->get_clips_viewport()->mapFromScene(m_playhead->scenePos()).x(); int canvasWidth = m_sv->get_clips_viewport()->width(); int nearBorderMargin = 50; if (nearBorderMargin > (canvasWidth / 4)) { nearBorderMargin = 0; } if (x < (0 + nearBorderMargin) || x > (canvasWidth - nearBorderMargin)) { m_sv->center_in_view(m_playhead, Qt::AlignHCenter); } } cpointer().setCursorText(timeref_to_text(m_newTransportLocation, m_sv->timeref_scalefactor)); cpointer().setCursorPos(QPointF(m_playhead->scenePos().x(), m_holdCursorSceneY)); }
void Traverso::create_interface( ) { themer()->load(); cpointer().add_contextitem(new TTransport()); TMainWindow* tMainWindow = TMainWindow::instance(); tMainWindow->show(); QString projectToLoad = ""; foreach(QString string, QCoreApplication::arguments ()) { if (string.contains("project.tpf")) { projectToLoad = string; break; } } // The user clicked on a project.tpf file, start extracting the // baseproject directory, and the project name from the filename. if (!projectToLoad.isEmpty()) { QFileInfo fi(projectToLoad); QDir projectdir(fi.path()); QDir baseprojectdir(fi.path()); baseprojectdir.cdUp(); QString baseprojectdirpath = baseprojectdir.path(); QString projectdirpath = projectdir.path(); QString projectname = projectdirpath.mid(baseprojectdirpath.length() + 1, projectdirpath.length()); if (!projectname.isEmpty() && ! baseprojectdirpath.isEmpty()) { pm().start(baseprojectdirpath, projectname); return; } } }
void PlayHeadMove::set_cursor_shape(int useX, int useY) { Q_UNUSED(useX); Q_UNUSED(useY); cpointer().setCursorShape(":/cursorHoldLr"); }
void Traverso::shutdown( int signal ) { PENTER; // Just in case the mouse was grabbed... cpointer().jog_finished(); QApplication::sendPostedEvents(); switch(signal) { case SIGINT: printf("\nCaught the SIGINT signal!\nShutting down Traverso!\n\n"); pm().exit(); return; break; case SIGSEGV: printf("\nCaught the SIGSEGV signal!\n"); QMessageBox::critical( TMainWindow::instance(), "Crash", "The program made an invalid operation and crashed :-(\n" "Please, report this to us!"); } printf("Stopped\n"); exit(0); }
int FadeRange::jog() { int dx = (d->origX - (cpointer().x()) ) * d->direction; m_newRange = m_origRange - ( dx * d->scalefactor); if (m_newRange < 1) { m_newRange = 1; } m_curve->set_range( m_newRange ); TimeRef location = TimeRef(m_newRange); cpointer().setCursorText(timeref_to_ms_3(location)); return 1; }
void FadeRange::set_cursor_shape(int useX, int useY) { Q_UNUSED(useX); Q_UNUSED(useY); cpointer().setCursorShape(":/cursorHoldLr"); }
void FadeStrength::set_cursor_shape(int useX, int useY) { Q_UNUSED(useX); Q_UNUSED(useY); cpointer().setCursorShape(":/cursorHoldUd"); }
int PlayHeadMove::begin_hold() { m_playhead->set_active(false); m_origXPos = m_newXPos = int(m_session->get_transport_location() / m_sv->timeref_scalefactor); m_sv->start_shuttle(true, true); m_holdCursorSceneY = cpointer().scene_y(); ClipsViewPort* port = m_sv->get_clips_viewport(); cpointer().setCursorPos(QPointF(m_playhead->scenePos().x(), cpointer().y())); int x = port->mapFromScene(m_playhead->scenePos()).x(); if (x < 0 || x > port->width()) { m_sv->center_in_view(m_playhead, Qt::AlignHCenter); } return 1; }
int FadeStrength::begin_hold() { PENTER; origY = cpointer().on_first_input_event_y(); oldValue = m_fade->get_strength_factor(); newStrength = origStrength = oldValue; m_fv->set_holding(true); return 1; }
int FadeBend::begin_hold() { PENTER; origY = cpointer().on_first_input_event_y(); oldValue = m_fade->get_bend_factor(); newBend = origBend = oldValue; m_fv->set_holding(true); return 1; }
void FadeRange::do_keyboard_move(double range) { ied().bypass_jog_until_mouse_movements_exceeded_manhattenlength(); m_newRange = range; TimeRef location = TimeRef(m_newRange); cpointer().setCursorText(timeref_to_ms_3(location)); do_action(); }
int FadeBend::jog() { int direction = (m_fade->get_fade_type() == FadeCurve::FadeIn) ? 1 : -1; float dx = (float(origY - cpointer().y()) / CURSOR_SPEED); if (m_fade->get_raster()) { float value = round_float(oldValue + dx * direction); m_fade->set_bend_factor(value); } else { m_fade->set_bend_factor(oldValue + dx * direction); } oldValue = m_fade->get_bend_factor(); newBend = oldValue; cpointer().setCursorText(QByteArray::number(newBend, 'f', 2)); origY = cpointer().y(); return 1; }
int FadeStrength::jog() { float dy = float(origY - cpointer().y()) / CURSOR_SPEED; if (m_fade->get_bend_factor() >= 0.5) { m_fade->set_strength_factor(oldValue + dy ); } else { if (m_fade->get_raster()) { float value = round_float(oldValue + dy); m_fade->set_strength_factor(value); } else { m_fade->set_strength_factor(oldValue - dy); } } oldValue = m_fade->get_strength_factor(); newStrength = oldValue; cpointer().setCursorText(QByteArray::number(newStrength, 'f', 2)); origY = cpointer().y(); return 1; }
ProjectManager::ProjectManager() : ContextItem() { PENTERCONS; m_currentProject = (Project*) 0; m_exitInProgress = false; m_watcher = new QFileSystemWatcher(0); QString path = config().get_property("Project", "directory", "").toString(); set_current_project_dir(path); cpointer().add_contextitem(this); connect(m_watcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(project_dir_rename_detected(const QString&))); }
int MoveMarker::jog() { TimeRef newpos = TimeRef(cpointer().scene_x() * d->scalefactor); if (m_doSnap) { SnapList* slist = m_marker->get_timeline()->get_sheet()->get_snap_list(); newpos = slist->get_snap_value(newpos); } if (newpos < TimeRef()) { newpos = TimeRef(); } m_newWhen = newpos; m_marker->set_when(m_newWhen); // d->view->set_position(int(m_newWhen / d->scalefactor)); d->view->get_sheetview()->update_shuttle_factor(); return 1; }
void OCDial::drawShape(QPainter& p) { if (vnew != vcur) { vnew = vnew < vmin ? vmin : vnew > vmax ? vmax : vnew; writeValue(vnew); vcur = vnew; } QRect br = boundingRect(); double w = br.width(); double h = br.height(); double xc = w / 2; double yc = h / 2; double rw = w * .45; double rh = h * .45; double ptr_w = rw * .2; double ptr_h = rh * .2; double increment = M_PI * 100 / (rw * rh); double inc = vmax > vmin ? vmax - vmin : vmin - vmax; while (inc > 0 && inc < 100) inc *= 10.; while (inc >= 1000) inc /= 10.; p.drawPixmap(br, face); p.save(); p.translate(x(), y()); QColor ctick1("#99ff99"); QColor ctick2("#99cc99"); QColor cpointer("#ffcc33"); QColor ccontour("#660000"); QPen pen(QColor("#000000"), 2, SolidLine, RoundCap, BevelJoin); double last = -1; for (int i = 0; i <= inc; i++) { double theta = i * M_PI / (18. * inc / 24.) - M_PI/6.; if (theta - last < increment) continue; last = theta; double tick_w = ptr_w; double tick_h = ptr_h; if (inc >= 10 && (i % int(inc / 10)) == 0) { pen.setColor(ctick1); } else { tick_w /= 2; tick_h /= 2; pen.setColor(ctick2); } p.setPen(pen); double s = sin(theta); double c = cos(theta); p.drawLine( int(xc + c*(rw - tick_w)), int(yc - s*(rh - tick_h)), int(xc + c*rw), int(yc - s*rh)); } if (vmax == vmin) angle = 2.e9; else angle = (M_PI*7./6.) - (vcur - vmin) * (M_PI*4./3.) / (vmax - vmin); double c, s; if (fabs(angle) < 1.e9) { s = sin(angle); c = cos(angle); } else { c = s = angle = 0; } p.translate(xc, yc); QPointArray points(5); points.setPoint(0, int(s*ptr_w/2), int(c*ptr_w/2)); points.setPoint(1, int(c*rw), int(-s*rh)); points.setPoint(2, int(-s*ptr_w/2), int(-c*ptr_h/2)); points.setPoint(3, int(-c*rw/10), int(s*rh/10)); points.setPoint(4, int(s*ptr_w/2), int(c*ptr_h/2)); p.setBrush(cpointer); p.drawPolygon(points); pen.setColor(ccontour); p.setPen(pen); p.drawPolyline(points); p.restore(); }
int FadeRange::begin_hold() { d->origX = cpointer().on_first_input_event_x(); m_newRange = m_origRange = m_curve->get_range(); return 1; }