comparison view/PaneStack.cpp @ 495:92b89764eb3b

* a few more midi bits, attempt to fix vertical-black-bar-misplacement-on-mac
author Chris Cannam
date Mon, 23 Feb 2009 14:40:17 +0000
parents 6167a28d25fc
children 5e6991aefdc5
comparison
equal deleted inserted replaced
494:b3140e9e0665 495:92b89764eb3b
1
2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
3 2
4 /* 3 /*
5 Sonic Visualiser 4 Sonic Visualiser
6 An audio file viewer and annotation editor. 5 An audio file viewer and annotation editor.
61 60
62 Pane * 61 Pane *
63 PaneStack::addPane(bool suppressPropertyBox) 62 PaneStack::addPane(bool suppressPropertyBox)
64 { 63 {
65 QFrame *frame = new QFrame; 64 QFrame *frame = new QFrame;
66 QHBoxLayout *layout = new QHBoxLayout; 65
66 QGridLayout *layout = new QGridLayout;
67 layout->setMargin(0); 67 layout->setMargin(0);
68 layout->setSpacing(2); 68 layout->setSpacing(2);
69 69
70 QVBoxLayout *vlayout = new QVBoxLayout; 70 // QHBoxLayout *layout = new QHBoxLayout;
71 layout->addLayout(vlayout); 71
72 layout->setStretchFactor(vlayout, 0); 72 // QVBoxLayout *vlayout = new QVBoxLayout;
73 // layout->addLayout(vlayout);
74 // layout->setStretchFactor(vlayout, 0);
73 75
74 QPushButton *xButton = new QPushButton(frame); 76 QPushButton *xButton = new QPushButton(frame);
75 xButton->setIcon(IconLoader().load("cross")); 77 xButton->setIcon(IconLoader().load("cross"));
76 xButton->setFixedSize(QSize(16, 16)); 78 xButton->setFixedSize(QSize(16, 16));
77 vlayout->addWidget(xButton); 79 layout->addWidget(xButton, 0, 0);
78 vlayout->setStretchFactor(xButton, 0); 80 // vlayout->setStretchFactor(xButton, 0);
79 connect(xButton, SIGNAL(clicked()), this, SLOT(paneDeleteButtonClicked())); 81 connect(xButton, SIGNAL(clicked()), this, SLOT(paneDeleteButtonClicked()));
80 82
81 QLabel *currentIndicator = new QLabel(frame); 83 QLabel *currentIndicator = new QLabel(frame);
82 // currentIndicator->setFixedWidth(QPainter(this).fontMetrics().width("x")); 84 // currentIndicator->setFixedWidth(QPainter(this).fontMetrics().width("x"));
83 vlayout->addWidget(currentIndicator); 85 layout->addWidget(currentIndicator, 1, 0);
84 vlayout->setStretchFactor(currentIndicator, 10); 86 layout->setRowStretch(1, 20);
85 currentIndicator->setScaledContents(true); 87 currentIndicator->setScaledContents(true);
86 88
87 Pane *pane = new Pane(frame); 89 Pane *pane = new Pane(frame);
88 pane->setViewManager(m_viewManager); 90 pane->setViewManager(m_viewManager);
89 layout->addWidget(pane); 91 layout->addWidget(pane, 0, 1, 2, 1);
90 layout->setStretchFactor(pane, 10); 92 layout->setColumnStretch(1, 20);
91 93
92 m_xButtonMap[xButton] = pane; 94 m_xButtonMap[xButton] = pane;
93 95
94 QWidget *properties = 0; 96 QWidget *properties = 0;
95 if (suppressPropertyBox) { 97 if (suppressPropertyBox) {
102 this, SLOT(viewSelected(View *))); 104 this, SLOT(viewSelected(View *)));
103 connect(properties, SIGNAL(contextHelpChanged(const QString &)), 105 connect(properties, SIGNAL(contextHelpChanged(const QString &)),
104 this, SIGNAL(contextHelpChanged(const QString &))); 106 this, SIGNAL(contextHelpChanged(const QString &)));
105 } 107 }
106 if (m_layoutStyle == PropertyStackPerPaneLayout) { 108 if (m_layoutStyle == PropertyStackPerPaneLayout) {
107 layout->addWidget(properties); 109 layout->addWidget(properties, 0, 2, 2, 1);
108 } else { 110 } else {
109 properties->setParent(m_propertyStackStack); 111 properties->setParent(m_propertyStackStack);
110 m_propertyStackStack->addWidget(properties); 112 m_propertyStackStack->addWidget(properties);
111 } 113 }
112 layout->setStretchFactor(properties, 1); 114 layout->setColumnStretch(2, 1);
113 115
114 PaneRec rec; 116 PaneRec rec;
115 rec.pane = pane; 117 rec.pane = pane;
116 rec.propertyStack = properties; 118 rec.propertyStack = properties;
117 rec.currentIndicator = currentIndicator; 119 rec.currentIndicator = currentIndicator;
179 case PropertyStackPerPaneLayout: 181 case PropertyStackPerPaneLayout:
180 182
181 for (i = m_panes.begin(); i != m_panes.end(); ++i) { 183 for (i = m_panes.begin(); i != m_panes.end(); ++i) {
182 m_propertyStackStack->removeWidget(i->propertyStack); 184 m_propertyStackStack->removeWidget(i->propertyStack);
183 i->propertyStack->setParent(i->frame); 185 i->propertyStack->setParent(i->frame);
184 i->layout->addWidget(i->propertyStack); 186 i->layout->addWidget(i->propertyStack, 0, 2, 2, 1);
185 i->propertyStack->show(); 187 i->propertyStack->show();
186 } 188 }
187 m_propertyStackStack->hide(); 189 m_propertyStackStack->hide();
188 break; 190 break;
189 } 191 }