diff main/MainWindow.cpp @ 72:34dc23246f46

* Press X to toggle the property boxes
author Chris Cannam
date Tue, 14 Nov 2006 16:06:00 +0000
parents e269ae6ed008
children e200055fe80b
line wrap: on
line diff
--- a/main/MainWindow.cpp	Mon Nov 13 14:48:57 2006 +0000
+++ b/main/MainWindow.cpp	Tue Nov 14 16:06:00 2006 +0000
@@ -595,6 +595,8 @@
     connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool)));
     menu->addAction(action);
         
+    menu->addSeparator();
+
     action = new QAction(tr("Show &Zoom Wheels"), this);
     action->setShortcut(tr("Z"));
     action->setStatusTip(tr("Show thumbwheels for zooming horizontally and vertically"));
@@ -602,6 +604,14 @@
     action->setCheckable(true);
     action->setChecked(m_viewManager->getZoomWheelsEnabled());
     menu->addAction(action);
+        
+    action = new QAction(tr("Show Property Bo&xes"), this);
+    action->setShortcut(tr("X"));
+    action->setStatusTip(tr("Show the layer property boxes at the side of the main window"));
+    connect(action, SIGNAL(triggered()), this, SLOT(togglePropertyBoxes()));
+    action->setCheckable(true);
+    action->setChecked(true);
+    menu->addAction(action);
 
 /*!!! This one doesn't work properly yet
  */
@@ -2785,6 +2795,36 @@
 }
 
 void
+MainWindow::togglePropertyBoxes()
+{
+    if (m_paneStack->getLayoutStyle() == PaneStack::NoPropertyStacks) {
+        if (Preferences::getInstance()->getPropertyBoxLayout() ==
+            Preferences::VerticallyStacked) {
+            m_paneStack->setLayoutStyle(PaneStack::PropertyStackPerPaneLayout);
+        } else {
+            m_paneStack->setLayoutStyle(PaneStack::SinglePropertyStackLayout);
+        }
+    } else {
+        m_paneStack->setLayoutStyle(PaneStack::NoPropertyStacks);
+    }
+}
+
+void
+MainWindow::preferenceChanged(PropertyContainer::PropertyName name)
+{
+    if (name == "Property Box Layout") {
+        if (m_paneStack->getLayoutStyle() != PaneStack::NoPropertyStacks) {
+            if (Preferences::getInstance()->getPropertyBoxLayout() ==
+                Preferences::VerticallyStacked) {
+                m_paneStack->setLayoutStyle(PaneStack::PropertyStackPerPaneLayout);
+            } else {
+                m_paneStack->setLayoutStyle(PaneStack::SinglePropertyStackLayout);
+            }
+        }
+    }
+}
+
+void
 MainWindow::play()
 {
     if (m_playSource->isPlaying()) {
@@ -3707,6 +3747,10 @@
                 }                    
             } else if (property == "zoomwheels") {
                 m_viewManager->setZoomWheelsEnabled(value > 0.5);
+            } else if (property == "propertyboxes") {
+                bool toggle = ((value < 0.5) !=
+                               (m_paneStack->getLayoutStyle() == PaneStack::NoPropertyStacks));
+                if (toggle) togglePropertyBoxes();
             }
                 
         } else {
@@ -3861,19 +3905,6 @@
 }
 
 void
-MainWindow::preferenceChanged(PropertyContainer::PropertyName name)
-{
-    if (name == "Property Box Layout") {
-        if (Preferences::getInstance()->getPropertyBoxLayout() ==
-            Preferences::VerticallyStacked) {
-            m_paneStack->setLayoutStyle(PaneStack::PropertyStackPerPaneLayout);
-        } else {
-            m_paneStack->setLayoutStyle(PaneStack::SinglePropertyStackLayout);
-        }
-    }
-}
-
-void
 MainWindow::preferences()
 {
     if (!m_preferencesDialog.isNull()) {