changeset 225:d7ded015af32

* Make font size in panes configurable, with a smaller default * Add [ and ] to select prev/next pane
author Chris Cannam
date Tue, 11 Dec 2007 14:58:29 +0000
parents b5a2428f647b
children a2abdc72c390
files main/MainWindow.cpp main/PreferencesDialog.cpp main/PreferencesDialog.h
diffstat 3 files changed, 65 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Fri Dec 07 16:47:31 2007 +0000
+++ b/main/MainWindow.cpp	Tue Dec 11 14:58:29 2007 +0000
@@ -603,6 +603,7 @@
     menu->addAction(action);
 
     QMenu *numberingMenu = menu->addMenu(tr("Number New Instants with"));
+    numberingMenu->setTearOffEnabled(true);
     QActionGroup *numberingGroup = new QActionGroup(this);
 
     Labeller::TypeNameMap types = m_labeller->getTypeNames();
@@ -1116,6 +1117,23 @@
     }
 
     menu = m_paneMenu;
+    menu->addSeparator();
+
+    action = new QAction(tr("Switch to Previous Pane"), this);
+    action->setShortcut(tr("["));
+    action->setStatusTip(tr("Make the next pane up in the pane stack current"));
+    connect(action, SIGNAL(triggered()), this, SLOT(previousPane()));
+    connect(this, SIGNAL(canSelectPreviousPane(bool)), action, SLOT(setEnabled(bool)));
+    m_keyReference->registerShortcut(action);
+    menu->addAction(action);
+
+    action = new QAction(tr("Switch to Next Pane"), this);
+    action->setShortcut(tr("]"));
+    action->setStatusTip(tr("Make the next pane down in the pane stack current"));
+    connect(action, SIGNAL(triggered()), this, SLOT(nextPane()));
+    connect(this, SIGNAL(canSelectNextPane(bool)), action, SLOT(setEnabled(bool)));
+    m_keyReference->registerShortcut(action);
+    menu->addAction(action);
 
     menu->addSeparator();
 
@@ -1148,6 +1166,25 @@
 
     setupExistingLayersMenus();
 
+/*!!! These don't work correctly -- fix or omit
+    menu->addSeparator();
+
+    action = new QAction(tr("Switch to Previous Layer"), this);
+    action->setShortcut(tr("{"));
+    action->setStatusTip(tr("Make the previous layer in the pane current"));
+    connect(action, SIGNAL(triggered()), this, SLOT(previousLayer()));
+    connect(this, SIGNAL(canSelectPreviousLayer(bool)), action, SLOT(setEnabled(bool)));
+    m_keyReference->registerShortcut(action);
+    menu->addAction(action);
+
+    action = new QAction(tr("Switch to Next Layer"), this);
+    action->setShortcut(tr("}"));
+    action->setStatusTip(tr("Make the next layer in the pane current"));
+    connect(action, SIGNAL(triggered()), this, SLOT(nextLayer()));
+    connect(this, SIGNAL(canSelectNextLayer(bool)), action, SLOT(setEnabled(bool)));
+    m_keyReference->registerShortcut(action);
+    menu->addAction(action);
+*/
     m_rightButtonLayerMenu->addSeparator();
     menu->addSeparator();
 
--- a/main/PreferencesDialog.cpp	Fri Dec 07 16:47:31 2007 +0000
+++ b/main/PreferencesDialog.cpp	Tue Dec 11 14:58:29 2007 +0000
@@ -30,6 +30,7 @@
 #include <QLineEdit>
 #include <QFileDialog>
 #include <QMessageBox>
+#include <QSpinBox>
 
 #include "widgets/WindowTypeSelector.h"
 #include "widgets/IconLoader.h"
@@ -156,6 +157,18 @@
     connect(bgMode, SIGNAL(currentIndexChanged(int)),
             this, SLOT(backgroundModeChanged(int)));
 
+    QSpinBox *fontSize = new QSpinBox;
+    int fs = prefs->getPropertyRangeAndValue("View Font Size", &min, &max,
+                                             &deflt);
+    fontSize->setMinimum(min);
+    fontSize->setMaximum(max);
+    fontSize->setSuffix(" pt");
+    fontSize->setSingleStep(1);
+    fontSize->setValue(fs);
+
+    connect(fontSize, SIGNAL(valueChanged(int)),
+            this, SLOT(viewFontSizeChanged(int)));
+
     // General tab
 
     QFrame *frame = new QFrame;
@@ -176,6 +189,11 @@
     subgrid->addWidget(bgMode, row++, 1, 1, 2);
 
     subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
+                                                ("View Font Size"))),
+                       row, 0);
+    subgrid->addWidget(fontSize, row++, 1, 1, 2);
+
+    subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
                                                 ("Resample On Load"))),
                        row, 0);
     subgrid->addWidget(resampleOnLoad, row++, 1, 1, 1);
@@ -315,6 +333,13 @@
 }
 
 void
+PreferencesDialog::viewFontSizeChanged(int sz)
+{
+    m_viewFontSize = sz;
+    m_applyButton->setEnabled(true);
+}
+
+void
 PreferencesDialog::okClicked()
 {
     applyClicked();
@@ -335,6 +360,7 @@
     prefs->setResampleOnLoad(m_resampleOnLoad);
     prefs->setTemporaryDirectoryRoot(m_tempDirRoot);
     prefs->setBackgroundMode(Preferences::BackgroundMode(m_backgroundMode));
+    prefs->setViewFontSize(m_viewFontSize);
 
     m_applyButton->setEnabled(false);
 
--- a/main/PreferencesDialog.h	Fri Dec 07 16:47:31 2007 +0000
+++ b/main/PreferencesDialog.h	Tue Dec 11 14:58:29 2007 +0000
@@ -44,6 +44,7 @@
     void resampleOnLoadChanged(int state);
     void tempDirRootChanged(QString root);
     void backgroundModeChanged(int mode);
+    void viewFontSizeChanged(int sz);
 
     void tempDirButtonClicked();
 
@@ -65,6 +66,7 @@
     bool m_resampleOnLoad;
     QString m_tempDirRoot;
     int m_backgroundMode;
+    int m_viewFontSize;
 
     bool m_changesOnRestart;
 };