# HG changeset patch # User Chris Cannam # Date 1173290449 0 # Node ID 8089a394829a7aa178a2f9f2baafd1d799390a5d # Parent 99d65ba33c880f40f42167cc8e3598755e99ec77 * Add display of selection extents in status bar when dragging a selection * Some build fixes after that i18n update diff -r 99d65ba33c88 -r 8089a394829a document/Document.cpp --- a/document/Document.cpp Wed Mar 07 17:07:02 2007 +0000 +++ b/document/Document.cpp Wed Mar 07 18:00:49 2007 +0000 @@ -26,6 +26,7 @@ #include "base/PlayParameterRepository.h" #include "base/PlayParameters.h" #include "transform/TransformFactory.h" +#include #include //!!! still need to handle command history, documentRestored/documentModified @@ -643,7 +644,7 @@ m_d(d), m_view(view), m_layer(layer), - m_name(qApp->translate("Add %1 Layer").arg(layer->objectName())), + m_name(qApp->translate("AddLayerCommand", "Add %1 Layer").arg(layer->objectName())), m_added(false) { } @@ -691,7 +692,7 @@ m_d(d), m_view(view), m_layer(layer), - m_name(qApp->translate("Delete %1 Layer").arg(layer->objectName())), + m_name(qApp->translate("RemoveLayerCommand", "Delete %1 Layer").arg(layer->objectName())), m_added(true) { } diff -r 99d65ba33c88 -r 8089a394829a main/MainWindow.cpp --- a/main/MainWindow.cpp Wed Mar 07 17:07:02 2007 +0000 +++ b/main/MainWindow.cpp Wed Mar 07 18:00:49 2007 +0000 @@ -147,6 +147,8 @@ m_viewManager = new ViewManager(); connect(m_viewManager, SIGNAL(selectionChanged()), this, SLOT(updateMenuStates())); + connect(m_viewManager, SIGNAL(inProgressSelectionChanged()), + this, SLOT(inProgressSelectionChanged())); m_descriptionLabel = new QLabel; @@ -1571,12 +1573,17 @@ void MainWindow::updateMenuStates() { + Pane *currentPane = 0; + Layer *currentLayer = 0; + + if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); + if (currentPane) currentLayer = currentPane->getSelectedLayer(); + bool haveCurrentPane = - (m_paneStack && - (m_paneStack->getCurrentPane() != 0)); + (currentPane != 0); bool haveCurrentLayer = - (haveCurrentPane && - (m_paneStack->getCurrentPane()->getSelectedLayer())); + (haveCurrentPane && + (currentLayer != 0)); bool haveMainModel = (getMainModel() != 0); bool havePlayTarget = @@ -1586,20 +1593,16 @@ !m_viewManager->getSelections().empty()); bool haveCurrentEditableLayer = (haveCurrentLayer && - m_paneStack->getCurrentPane()->getSelectedLayer()-> - isLayerEditable()); + currentLayer->isLayerEditable()); bool haveCurrentTimeInstantsLayer = (haveCurrentLayer && - dynamic_cast - (m_paneStack->getCurrentPane()->getSelectedLayer())); + dynamic_cast(currentLayer)); bool haveCurrentTimeValueLayer = (haveCurrentLayer && - dynamic_cast - (m_paneStack->getCurrentPane()->getSelectedLayer())); + dynamic_cast(currentLayer)); bool haveCurrentColour3DPlot = (haveCurrentLayer && - dynamic_cast - (m_paneStack->getCurrentPane()->getSelectedLayer())); + dynamic_cast(currentLayer)); bool haveClipboardContents = (m_viewManager && !m_viewManager->getClipboard().empty()); @@ -3709,11 +3712,31 @@ return; } + bool haveSelection = false; + size_t startFrame = 0, endFrame = 0; + + if (m_viewManager && m_viewManager->haveInProgressSelection()) { + + bool exclusive = false; + Selection s = m_viewManager->getInProgressSelection(exclusive); + + if (!s.isEmpty()) { + haveSelection = true; + startFrame = s.getStartFrame(); + endFrame = s.getEndFrame(); + } + } + + if (!haveSelection) { + startFrame = p->getFirstVisibleFrame(); + endFrame = p->getLastVisibleFrame(); + } + RealTime start = RealTime::frame2RealTime - (p->getFirstVisibleFrame(), getMainModel()->getSampleRate()); + (startFrame, getMainModel()->getSampleRate()); RealTime end = RealTime::frame2RealTime - (p->getLastVisibleFrame(), getMainModel()->getSampleRate()); + (endFrame, getMainModel()->getSampleRate()); RealTime duration = end - start; @@ -3722,8 +3745,13 @@ endStr = end.toText(true).c_str(); durationStr = duration.toText(true).c_str(); - m_myStatusMessage = tr("Visible: %1 to %2 (duration %3)") - .arg(startStr).arg(endStr).arg(durationStr); + if (haveSelection) { + m_myStatusMessage = tr("Selection: %1 to %2 (duration %3)") + .arg(startStr).arg(endStr).arg(durationStr); + } else { + m_myStatusMessage = tr("Visible: %1 to %2 (duration %3)") + .arg(startStr).arg(endStr).arg(durationStr); + } statusBar()->showMessage(m_myStatusMessage); } @@ -4444,6 +4472,14 @@ } void +MainWindow::inProgressSelectionChanged() +{ + Pane *currentPane = 0; + if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); + if (currentPane) updateVisibleRangeDisplay(currentPane); +} + +void MainWindow::contextHelpChanged(const QString &s) { if (s == "" && m_myStatusMessage != "") { diff -r 99d65ba33c88 -r 8089a394829a main/MainWindow.h --- a/main/MainWindow.h Wed Mar 07 17:07:02 2007 +0000 +++ b/main/MainWindow.h Wed Mar 07 18:00:49 2007 +0000 @@ -227,6 +227,7 @@ void mouseEnteredWidget(); void mouseLeftWidget(); void contextHelpChanged(const QString &); + void inProgressSelectionChanged(); void website(); void help();