]> git.sesse.net Git - kdenlive/commitdiff
Treat 23.97 fps as 24 fps (don't know if it's correct but anyways better than 23fps...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 19 Jul 2009 21:34:51 +0000 (21:34 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 19 Jul 2009 21:34:51 +0000 (21:34 +0000)
svn path=/trunk/kdenlive/; revision=3739

src/customruler.cpp
src/customruler.h
src/effectstackedit.cpp
src/kdenlivedoc.cpp
src/mainwindow.cpp
src/timecode.cpp
src/trackview.cpp
src/trackview.h

index 6adb2a2eec0f384be11ef606ad23a0008bde38b2..60f34102124e0287b1daa2c974fc464d78df6603 100644 (file)
@@ -81,6 +81,14 @@ CustomRuler::CustomRuler(Timecode tc, CustomTrackView *parent) :
     setMinimumHeight(20);
 }
 
+void CustomRuler::updateProjectFps(Timecode t)
+{
+    m_timecode = t;
+    mediumMarkDistance = FRAME_SIZE * m_timecode.fps();
+    bigMarkDistance = FRAME_SIZE * m_timecode.fps() * 60;
+    update();
+}
+
 void CustomRuler::slotEditGuide()
 {
     m_view->slotEditGuide(m_clickedGuide);
index 4896e8a2ae914f66cd9025c1e656076d66f1fbba..b7ac39782f7b61913efa6d47ec278dc256708f10 100644 (file)
@@ -40,6 +40,7 @@ public:
     void setDuration(int d);
     void setZone(QPoint p);
     int offset() const;
+    void updateProjectFps(Timecode t);
 
 protected:
     virtual void paintEvent(QPaintEvent * /*e*/);
index d8db66108f5d29258de509b47694ea6d9c140210..a165a52b49da91581cde4e83decf270592b9a417 100644 (file)
@@ -177,12 +177,10 @@ void EffectStackEdit::transferParamDesc(const QDomElement& d, int in, int out)
             int max;
             if (pa.attribute("min").startsWith('%')) {
                 min = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("min"));
-            }
-           else min = pa.attribute("min").toInt();
+            } else min = pa.attribute("min").toInt();
             if (pa.attribute("max").startsWith('%')) {
                 max = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("max"));
-            }
-           else max = pa.attribute("max").toInt();
+            } else max = pa.attribute("max").toInt();
             createSliderItem(paramName, (int)(value.toDouble() + 0.5) , min, max);
             delete toFillin;
             toFillin = NULL;
index 084e79972bd991582159a790c1b4eda9593944ac..ab33a5fb86dd23f3a97c0136df5c3dadddf78c99 100644 (file)
@@ -223,7 +223,7 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup
 
     kDebug() << "Kdenlive document, init timecode: " << m_fps;
     if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(30, true);
-    else m_timecode.setFormat((int) m_fps);
+    else m_timecode.setFormat((int)(m_fps + 0.5));
 
     //kDebug() << "// SETTING SCENE LIST:\n\n" << m_document.toString();
     connect(m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(slotAutoSave()));
@@ -636,7 +636,7 @@ void KdenliveDoc::setProfilePath(QString path)
     m_height = m_profile.height;
     kDebug() << "Kdenlive document, init timecode from path: " << path << ",  " << m_fps;
     if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(30, true);
-    else m_timecode.setFormat((int) m_fps);
+    else m_timecode.setFormat((int)(m_fps + 0.5));
 }
 
 double KdenliveDoc::dar()
index 106851e4df0d7faf0604ac1040d5f57b081cd1e2..43d32f02eec08cf3c388f7e14321f0755424ea48 100644 (file)
@@ -1612,22 +1612,23 @@ void MainWindow::slotEditProjectSettings()
         if (m_activeDocument->profilePath() != profile) {
             // Profile was changed
             double dar = m_activeDocument->dar();
-           
-           // Deselect current effect / transition
-           m_effectStack->slotClipItemSelected(NULL, 0);
-           m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
-           
+
+            // Deselect current effect / transition
+            m_effectStack->slotClipItemSelected(NULL, 0);
+            m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
+
             m_activeDocument->setProfilePath(profile);
             KdenliveSettings::setCurrent_profile(profile);
             KdenliveSettings::setProject_fps(m_activeDocument->fps());
             setCaption(m_activeDocument->description(), m_activeDocument->isModified());
             m_monitorManager->resetProfiles(m_activeDocument->timecode());
-           m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeTimeline->tracksNumber());
-           m_effectStack->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode());
+            m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeTimeline->tracksNumber());
+            m_effectStack->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode());
             if (m_renderWidget) m_renderWidget->setProfile(m_activeDocument->mltProfile());
             m_timelineArea->setTabText(m_timelineArea->currentIndex(), m_activeDocument->description());
             m_activeDocument->clipManager()->resetProducersList(m_projectMonitor->render->producersList());
             if (dar != m_activeDocument->dar()) m_projectList->reloadClipThumbnails();
+            m_activeTimeline->updateProjectFps();
             // We need to desactivate & reactivate monitors to get a refresh
             m_monitorManager->switchMonitors();
         }
@@ -1834,6 +1835,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
     setCaption(doc->description(), doc->isModified());
     m_saveAction->setEnabled(doc->isModified());
     m_activeDocument = doc;
+    m_activeTimeline->updateProjectFps();
     if (KdenliveSettings::dropbframes()) slotUpdatePreviewSettings();
 
     // set tool to select tool
index 118e2354c3861433930f26a9624b86af9dc4d729..244079a0790c834e7fa874d31babcad447da8b27 100644 (file)
@@ -22,7 +22,7 @@
 Timecode::Timecode(Formats format, int framesPerSecond, bool dropFrame) :
         m_format(format),
         m_dropFrame(dropFrame),
-        m_displayedFramesPerSecond(framesPerSecond)
+        m_displayedFramesPerSecond(framesPerSecond + 0.5)
 {
 }
 
@@ -167,7 +167,7 @@ QString Timecode::getTimecodeHH_MM_SS_FF(const GenTime & time, double fps) const
     if (m_dropFrame)
         return getTimecodeDropFrame(time, fps);
 
-    return getTimecodeHH_MM_SS_FF((int)time.frames(fps));
+    return getTimecodeHH_MM_SS_FF((int)(time.frames(fps) + 0.5));
 }
 
 QString Timecode::getTimecodeHH_MM_SS_FF(int frames) const
index d8a45938e85d27efd2c187c62dc4cd197365a673..10ba42cb84036e6a94a66941b0a4d0b090aefbde 100644 (file)
@@ -324,13 +324,12 @@ void TrackView::parseDocument(QDomDocument doc)
                             QDomElement e = params.item(i).toElement();
                             if (!e.isNull() && e.attribute("tag") == paramName) {
                                 if (e.attribute("type") == "double") {
-                                   QString factor = e.attribute("factor", "1");
+                                    QString factor = e.attribute("factor", "1");
                                     if (factor != "1") {
-                                       double fact;
-                                       if (factor.startsWith('%')) {
-                                           fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
-                                       }
-                                       else fact = factor.toDouble();
+                                        double fact;
+                                        if (factor.startsWith('%')) {
+                                            fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
+                                        } else fact = factor.toDouble();
                                         double val = paramValue.toDouble() * fact;
                                         paramValue = QString::number(val);
                                     }
@@ -624,7 +623,7 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool locked)
                                 double fact;
                                 if (factor.isEmpty()) fact = 1;
                                 else if (factor.startsWith('%')) {
-                                   fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
+                                    fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
                                 } else fact = factor.toDouble();
                                 for (QDomNode n3 = effect.firstChild(); !n3.isNull(); n3 = n3.nextSibling()) {
                                     // parse effect parameters
@@ -700,7 +699,7 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool locked)
                                             QString factor = e.attribute("factor", "1");
                                             double fact;
                                             if (factor.startsWith('%')) {
-                                               fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
+                                                fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
                                             } else fact = factor.toDouble();
                                             e.setAttribute("value", paramvalue.toDouble() * fact);
                                         } else e.setAttribute("value", paramvalue);
@@ -820,4 +819,9 @@ void TrackView::slotVerticalZoomUp()
     adjustTrackHeaders();
 }
 
+void TrackView::updateProjectFps()
+{
+    m_ruler->updateProjectFps(m_doc->timecode());
+}
+
 #include "trackview.moc"
index 16a3975d39ec88da37c48ac02def6c9782e85025..7002e10f72d28cb05f8f5eef96793dfdbe98ab79 100644 (file)
@@ -55,6 +55,7 @@ public:
     int tracksNumber() const;
     KdenliveDoc *document();
     void refresh() ;
+    void updateProjectFps();
     int outPoint() const;
     int inPoint() const;
     int fitZoom() const;