changeset 363:6167a28d25fc sv1-v1.2pre3

* line up overview widget nicely with main pane (at least on first startup) * fix #1878396 renaming layer seems to have no visible effect * comment out some debug output
author Chris Cannam
date Wed, 06 Feb 2008 17:40:53 +0000
parents a9dfa2d6d5ac
children f1e6204c1f17
files layer/Layer.cpp layer/Layer.h view/Pane.cpp view/PaneStack.cpp view/PaneStack.h view/View.cpp view/ViewManager.cpp
diffstat 7 files changed, 33 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Layer.cpp	Wed Feb 06 16:21:29 2008 +0000
+++ b/layer/Layer.cpp	Wed Feb 06 17:40:53 2008 +0000
@@ -68,10 +68,16 @@
 	(LayerFactory::getInstance()->getLayerType(this));
 }
 
+void
+Layer::setPresentationName(QString name)
+{
+    m_presentationName = name;
+}
+
 QString
 Layer::getLayerPresentationName() const
 {
-//    QString layerName = objectName();
+    if (m_presentationName != "") return m_presentationName;
 
     LayerFactory *factory = LayerFactory::getInstance();
     QString layerName = factory->getLayerPresentationName
@@ -588,6 +594,11 @@
 {
     stream << indent;
 
+    if (m_presentationName != "") {
+        extraAttributes = QString("%1 presentationName=\"%2\"")
+            .arg(extraAttributes).arg(encodeEntities(m_presentationName));
+    }
+
     stream << QString("<layer id=\"%2\" type=\"%1\" name=\"%3\" model=\"%4\" %5")
 	.arg(encodeEntities(LayerFactory::getInstance()->getLayerTypeName
                             (LayerFactory::getInstance()->getLayerType(this))))
@@ -617,6 +628,11 @@
 {
     stream << indent;
 
+    if (m_presentationName != "") {
+        extraAttributes = QString("%1 presentationName=\"%2\"")
+            .arg(extraAttributes).arg(encodeEntities(m_presentationName));
+    }
+
     stream << QString("<layer id=\"%2\" type=\"%1\" name=\"%3\" model=\"%4\" %5/>\n")
 	.arg(encodeEntities(LayerFactory::getInstance()->getLayerTypeName
                             (LayerFactory::getInstance()->getLayerType(this))))
--- a/layer/Layer.h	Wed Feb 06 16:21:29 2008 +0000
+++ b/layer/Layer.h	Wed Feb 06 17:40:53 2008 +0000
@@ -92,9 +92,12 @@
     virtual QString getPropertyContainerIconName() const;
 
     virtual QString getPropertyContainerName() const {
-	return objectName();
+        if (m_presentationName != "") return m_presentationName;
+	else return objectName();
     }
 
+    virtual void setPresentationName(QString name);
+
     virtual QString getLayerPresentationName() const;
     virtual QPixmap getLayerPresentationPixmap(QSize) const { return QPixmap(); }
 
@@ -545,6 +548,8 @@
     void paintMeasurementRect(View *v, QPainter &paint,
                               const MeasureRect &r, bool focus) const;
 
+    QString m_presentationName;
+
 private:
     mutable QMutex m_dormancyMutex;
     mutable std::map<const void *, bool> m_dormancy;
--- a/view/Pane.cpp	Wed Feb 06 16:21:29 2008 +0000
+++ b/view/Pane.cpp	Wed Feb 06 17:40:53 2008 +0000
@@ -50,6 +50,8 @@
 
 #include "widgets/KeyReference.h" //!!! should probably split KeyReference into a data class in base and another that shows the widget
 
+//#define DEBUG_PANE
+
 using std::cerr;
 using std::endl;
 
@@ -1701,9 +1703,11 @@
         } else {
             newCentreFrame = 0;
         }
-	    
+
+#ifdef DEBUG_PANE	    
         std::cerr << "Pane::dragTopLayer: newCentreFrame = " << newCentreFrame <<
             ", models end frame = " << getModelsEndFrame() << std::endl;
+#endif
 
         if (newCentreFrame >= getModelsEndFrame()) {
             newCentreFrame = getModelsEndFrame();
--- a/view/PaneStack.cpp	Wed Feb 06 16:21:29 2008 +0000
+++ b/view/PaneStack.cpp	Wed Feb 06 17:40:53 2008 +0000
@@ -495,14 +495,7 @@
     std::cerr << "PaneStack::sizePropertyStacks: max min width " << maxMinWidth << std::endl;
 #endif
 
-//#ifdef Q_WS_MAC
-    // This is necessary to compensate for cb->setMinimumSize(10, 10)
-    // in PropertyBox in the Mac version (to avoid a mysterious crash)
-    // ... no longer necessary with qt4.2
-//    int setWidth = maxMinWidth * 3 / 2;
-//#else
     int setWidth = maxMinWidth;
-//#endif
 
     m_propertyStackStack->setMaximumWidth(setWidth + 10);
 
@@ -511,6 +504,7 @@
 	m_panes[i].propertyStack->setMinimumWidth(setWidth);
     }
 
+    emit propertyStacksResized(setWidth);
     emit propertyStacksResized();
 }
     
--- a/view/PaneStack.h	Wed Feb 06 16:21:29 2008 +0000
+++ b/view/PaneStack.h	Wed Feb 06 17:40:53 2008 +0000
@@ -74,6 +74,7 @@
     void currentPaneChanged(Pane *pane);
     void currentLayerChanged(Pane *pane, Layer *layer);
     void rightButtonMenuRequested(Pane *pane, QPoint position);
+    void propertyStacksResized(int width);
     void propertyStacksResized();
     void contextHelpChanged(const QString &);
 
--- a/view/View.cpp	Wed Feb 06 16:21:29 2008 +0000
+++ b/view/View.cpp	Wed Feb 06 17:40:53 2008 +0000
@@ -892,8 +892,10 @@
 {
     if (m_followPan) {
         size_t f = alignFromReference(rf);
+#ifdef DEBUG_VIEW_WIDGET_PAINT
         std::cerr << "View[" << this << "]::globalCentreFrameChanged(" << rf
                   << "): setting centre frame to " << f << std::endl;
+#endif
         setCentreFrame(f, false);
     }
 }
--- a/view/ViewManager.cpp	Wed Feb 06 16:21:29 2008 +0000
+++ b/view/ViewManager.cpp	Wed Feb 06 17:40:53 2008 +0000
@@ -24,7 +24,7 @@
 
 #include <iostream>
 
-#define DEBUG_VIEW_MANAGER 1
+//#define DEBUG_VIEW_MANAGER 1
 
 ViewManager::ViewManager() :
     m_playSource(0),