void MainWindow::seekPlaylist(int start) { double speed = MLT.producer()? MLT.producer()->get_speed(): 0; // we bypass this->open() to prevent sending producerOpened signal to self, which causes to reload playlist if ((void*) MLT.producer()->get_producer() != (void*) m_playlistDock->model()->playlist()->get_playlist()) MLT.open(new Mlt::Producer(*(m_playlistDock->model()->playlist()))); m_player->setIn(-1); m_player->setOut(-1); // since we do not emit producerOpened, these components need updating m_player->onProducerOpened(); m_encodeDock->onProducerOpened(); updateMarkers(); if (speed == 0) m_player->pause(); else m_player->play(speed); MLT.seek(start); }
void CanvasNavigator::advancePlayhead()/*{{{*/ { if(m_editing) return; if(m_playhead) { QPoint point(calcSize(song->cpos()), 0); m_playhead->setPos(point); } if(m_start) { int mh = MIN_TRACKHEIGHT; double partHeight = (mh * 8)/100; QRectF rect(0.0, 0.0, calcSize(song->len()), partHeight); //QLineF line(0.0, 0.0, calcSize(song->len()), 0.0); m_start->setRect(rect); } updateCanvasBox(); updateLoopRange(); if(m_updateMarkers) updateMarkers(); m_updateMarkers = true; }/*}}}*/
void FileEditorWnd::onPageChanged() { updateErrorMarkers(); updateMarkers(); }
void FileEditorWnd::setFile(const std::shared_ptr<const File>& file, int line, int col, bool columnIsOffset) { if (m_file != file) { if (m_file) gWorkspace->removeFileSaveFunc(m_file->id); m_file = file; gWorkspace->setFileDirty(m_file->id, false); gWorkspace->setFileSaveFunc(m_file->id, [this](const std::shared_ptr<const File>& file) { return m_textCtrl->SaveFile(file->fullpath.widen()); }); // Find the language we want UTF8String ext = file->extension; LanguageInfo* lang = nullptr; for (auto& l : gLanguages) { if (cz::find(l.fileextensions, ext) != l.fileextensions.end()) { lang = &l; break; } } m_textCtrl->Freeze(); // Set the default shared style before StyleClearAll, because as specified in scintilla documentation, // StyleClearAll will reset all other styles to wxSTC_STYLE_DEFAULT setStyle(m_textCtrl, gSharedStyles[0]); m_textCtrl->StyleClearAll(); if (lang) m_textCtrl->SetLexer(lang->lexer); setCommonStyle(); setStyles(m_textCtrl, gSharedStyles); // Set styles specific to the language if (lang) setStyles(m_textCtrl, lang->styles); updateViewOptions(); m_textCtrl->SetReadOnly(false); m_isLoading = true; m_textCtrl->LoadFile(file->fullpath.c_str(), wxTEXT_TYPE_ANY); m_isLoading = false; m_textCtrl->Connect(wxEVT_STC_MARGINCLICK, wxStyledTextEventHandler(FileEditorWnd::OnMarginClick), NULL, this); m_textCtrl->Thaw(); m_textCtrl->SetSavePoint(); m_textCtrl->EmptyUndoBuffer(); gWorkspace->iterateBreakpoints(m_file->id, [&](const Breakpoint* brk) { syncBreakpoint(brk); }); updateErrorMarkers(); updateMarkers(); m_textCtrl->Fit(); this->Layout(); } if (line >= 1 && col >= 0) { if (columnIsOffset) { // Column is a real offset into the text (doesn't take into account tab width) int pos = m_textCtrl->PositionFromLine(TO_TXTLINE(line)); m_textCtrl->GotoPos(pos + col); } else{ // Column is a visual offset into the text (takes into account tab width) int pos = m_textCtrl->FindColumn(TO_TXTLINE(line), col); m_textCtrl->GotoPos(pos); // There seems to be a bug with GotoPos, where the Horizontal scrolling gets out of sync, so I'm // just resetting it. // Maybe this bug: http://sourceforge.net/p/scintilla/bugs/1467/ //This will of course mean that it will not scroll at all to show the desired column, // but (although the caret will still be at the desired column) m_textCtrl->SetXOffset(0); } } //m_textCtrl->VerticalCentreCaret(); }
MainWindow::MainWindow() : QMainWindow(0) , ui(new Ui::MainWindow) , m_isKKeyPressed(false) { // Create the UI. ui->setupUi(this); #ifndef Q_WS_X11 ui->mainToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); #endif setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); setDockNestingEnabled(true); // These use the icon theme on Linux, with fallbacks to the icons specified in QtDesigner for other platforms. ui->actionOpen->setIcon(QIcon::fromTheme("document-open", ui->actionOpen->icon())); ui->actionSave->setIcon(QIcon::fromTheme("document-save", ui->actionSave->icon())); ui->actionEncode->setIcon(QIcon::fromTheme("media-record", ui->actionEncode->icon())); // Connect UI signals. connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openVideo())); connect(ui->actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); // Accept drag-n-drop of files. this->setAcceptDrops(true); // Add the player widget. QLayout* layout = new QVBoxLayout(ui->playerPage); layout->setObjectName("centralWidgetLayout"); layout->setMargin(0); m_player = new Player(this); layout->addWidget(m_player); connect(this, SIGNAL(producerOpened()), m_player, SLOT(onProducerOpened())); connect(m_player, SIGNAL(showStatusMessage(QString)), this, SLOT(showStatusMessage(QString))); connect(m_player, SIGNAL(inChanged(int)), this, SLOT(onCutModified())); connect(m_player, SIGNAL(outChanged(int)), this, SLOT(onCutModified())); // Add the docks. m_propertiesDock = new QDockWidget(tr("Properties")); m_propertiesDock->hide(); m_propertiesDock->setObjectName("propertiesDock"); m_propertiesDock->setWindowIcon(QIcon((":/icons/icons/view-form.png"))); m_propertiesDock->toggleViewAction()->setIcon(QIcon::fromTheme("view-form", m_propertiesDock->windowIcon())); addDockWidget(Qt::LeftDockWidgetArea, m_propertiesDock); ui->menuView->addAction(m_propertiesDock->toggleViewAction()); ui->mainToolBar->addAction(m_propertiesDock->toggleViewAction()); connect(m_propertiesDock->toggleViewAction(), SIGNAL(triggered(bool)), this, SLOT(onPropertiesDockTriggered(bool))); m_recentDock = new RecentDock(this); m_recentDock->hide(); addDockWidget(Qt::LeftDockWidgetArea, m_recentDock); ui->menuView->addAction(m_recentDock->toggleViewAction()); ui->mainToolBar->addAction(m_recentDock->toggleViewAction()); connect(m_recentDock, SIGNAL(itemActivated(QString)), this, SLOT(open(QString))); connect(m_recentDock->toggleViewAction(), SIGNAL(triggered(bool)), this, SLOT(onRecentDockTriggered(bool))); m_playlistDock = new PlaylistDock(this); m_playlistDock->hide(); addDockWidget(Qt::LeftDockWidgetArea, m_playlistDock); ui->menuView->addAction(m_playlistDock->toggleViewAction()); ui->mainToolBar->addAction(m_playlistDock->toggleViewAction()); connect(m_playlistDock->toggleViewAction(), SIGNAL(triggered(bool)), this, SLOT(onPlaylistDockTriggered(bool))); connect(m_playlistDock, SIGNAL(clipOpened(void*,int,int)), this, SLOT(openCut(void*, int, int))); connect(m_playlistDock, SIGNAL(itemActivated(int)), this, SLOT(seekPlaylist(int))); connect(m_playlistDock, SIGNAL(showStatusMessage(QString)), this, SLOT(showStatusMessage(QString))); connect(m_playlistDock->model(), SIGNAL(created()), this, SLOT(onPlaylistCreated())); connect(m_playlistDock->model(), SIGNAL(cleared()), this, SLOT(onPlaylistCleared())); connect(m_playlistDock->model(), SIGNAL(closed()), this, SLOT(onPlaylistClosed())); connect(m_playlistDock->model(), SIGNAL(modified()), this, SLOT(onPlaylistModified())); connect(m_playlistDock->model(), SIGNAL(loaded()), this, SLOT(updateMarkers())); connect(m_playlistDock->model(), SIGNAL(modified()), this, SLOT(updateMarkers())); tabifyDockWidget(m_recentDock, m_propertiesDock); tabifyDockWidget(m_propertiesDock, m_playlistDock); m_recentDock->raise(); m_encodeDock = new EncodeDock(this); m_encodeDock->hide(); addDockWidget(Qt::RightDockWidgetArea, m_encodeDock); ui->menuView->addAction(m_encodeDock->toggleViewAction()); ui->mainToolBar->addAction(ui->actionEncode); connect(this, SIGNAL(producerOpened()), m_encodeDock, SLOT(onProducerOpened())); connect(m_encodeDock, SIGNAL(visibilityChanged(bool)), ui->actionEncode, SLOT(setChecked(bool))); connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), m_player, SLOT(onCaptureStateChanged(bool))); connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), m_propertiesDock, SLOT(setDisabled(bool))); connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), m_recentDock, SLOT(setDisabled(bool))); connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), ui->actionOpen, SLOT(setDisabled(bool))); connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), ui->actionOpenOther, SLOT(setDisabled(bool))); connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), ui->actionExit, SLOT(setDisabled(bool))); connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), this, SLOT(onCaptureStateChanged(bool))); m_jobsDock = new JobsDock(this); m_jobsDock->hide(); addDockWidget(Qt::RightDockWidgetArea, m_jobsDock); tabifyDockWidget(m_encodeDock, m_jobsDock); ui->menuView->addAction(m_jobsDock->toggleViewAction()); connect(&JOBS, SIGNAL(jobAdded()), m_jobsDock, SLOT(show())); connect(&JOBS, SIGNAL(jobAdded()), m_jobsDock, SLOT(raise())); connect(m_jobsDock, SIGNAL(visibilityChanged(bool)), this, SLOT(onJobsVisibilityChanged(bool))); // Connect signals. connect(this, SIGNAL(producerOpened()), this, SLOT(onProducerOpened())); // connect video widget signals #if defined(Q_WS_MAC) || defined(Q_WS_WIN) Mlt::GLWidget* videoWidget = (Mlt::GLWidget*) &(MLT); connect(videoWidget, SIGNAL(dragStarted()), m_playlistDock, SLOT(onPlayerDragStarted())); connect(videoWidget, SIGNAL(seekTo(int)), m_player, SLOT(seek(int))); #else if (m_settings.value("player/opengl", true).toBool()) { Mlt::GLWidget* videoWidget = (Mlt::GLWidget*) &(MLT); connect(videoWidget, SIGNAL(dragStarted()), m_playlistDock, SLOT(onPlayerDragStarted())); connect(videoWidget, SIGNAL(seekTo(int)), m_player, SLOT(seek(int))); } else { Mlt::SDLWidget* videoWidget = (Mlt::SDLWidget*) &(MLT); connect(videoWidget, SIGNAL(dragStarted()), m_playlistDock, SLOT(onPlayerDragStarted())); connect(videoWidget, SIGNAL(seekTo(int)), m_player, SLOT(seek(int))); } #endif readSettings(); setFocus(); setCurrentFile(""); }
void InteractiveMarkerDisplay::updateCb( visualization_msgs::InteractiveMarkerUpdateConstPtr msg ) { updateMarkers( msg->server_id, msg->markers ); updatePoses( msg->server_id, msg->poses ); eraseMarkers( msg->server_id, msg->erases ); }
void InteractiveMarkerDisplay::initCb( visualization_msgs::InteractiveMarkerInitConstPtr msg ) { resetCb( msg->server_id ); updateMarkers( msg->server_id, msg->markers ); }