comparison framework/MainWindowBase.cpp @ 73:ef8a3028c711

* 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 716e9d2f91c7
children 864703bf64ac
comparison
equal deleted inserted replaced
72:4aa40182321f 73:ef8a3028c711
275 Pane *currentPane = 0; 275 Pane *currentPane = 0;
276 Layer *currentLayer = 0; 276 Layer *currentLayer = 0;
277 277
278 if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); 278 if (m_paneStack) currentPane = m_paneStack->getCurrentPane();
279 if (currentPane) currentLayer = currentPane->getSelectedLayer(); 279 if (currentPane) currentLayer = currentPane->getSelectedLayer();
280
281 bool havePrevPane = false, haveNextPane = false;
282 bool havePrevLayer = false, haveNextLayer = false;
283
284 if (currentPane) {
285 for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
286 if (m_paneStack->getPane(i) == currentPane) {
287 if (i > 0) havePrevPane = true;
288 if (i < m_paneStack->getPaneCount()-1) haveNextPane = true;
289 break;
290 }
291 }
292 if (currentLayer) {
293 for (int i = 0; i < currentPane->getLayerCount(); ++i) {
294 if (currentPane->getLayer(i) == currentLayer) {
295 if (i > 0) havePrevLayer = true;
296 if (i < currentPane->getLayerCount()-1) haveNextLayer = true;
297 break;
298 }
299 }
300 }
301 }
280 302
281 bool haveCurrentPane = 303 bool haveCurrentPane =
282 (currentPane != 0); 304 (currentPane != 0);
283 bool haveCurrentLayer = 305 bool haveCurrentLayer =
284 (haveCurrentPane && 306 (haveCurrentPane &&
328 emit canRenumberInstants(haveCurrentTimeInstantsLayer && haveSelection); 350 emit canRenumberInstants(haveCurrentTimeInstantsLayer && haveSelection);
329 emit canPlaySelection(haveMainModel && havePlayTarget && haveSelection); 351 emit canPlaySelection(haveMainModel && havePlayTarget && haveSelection);
330 emit canClearSelection(haveSelection); 352 emit canClearSelection(haveSelection);
331 emit canEditSelection(haveSelection && haveCurrentEditableLayer); 353 emit canEditSelection(haveSelection && haveCurrentEditableLayer);
332 emit canSave(m_sessionFile != "" && m_documentModified); 354 emit canSave(m_sessionFile != "" && m_documentModified);
355 emit canSelectPreviousPane(havePrevPane);
356 emit canSelectNextPane(haveNextPane);
357 emit canSelectPreviousLayer(havePrevLayer);
358 emit canSelectNextLayer(haveNextLayer);
333 } 359 }
334 360
335 void 361 void
336 MainWindowBase::documentModified() 362 MainWindowBase::documentModified()
337 { 363 {
1807 if (layer) { 1833 if (layer) {
1808 m_document->removeLayerFromView(pane, layer); 1834 m_document->removeLayerFromView(pane, layer);
1809 } 1835 }
1810 } 1836 }
1811 updateMenuStates(); 1837 updateMenuStates();
1838 }
1839
1840 void
1841 MainWindowBase::previousPane()
1842 {
1843 if (!m_paneStack) return;
1844
1845 Pane *currentPane = m_paneStack->getCurrentPane();
1846 if (!currentPane) return;
1847
1848 for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
1849 if (m_paneStack->getPane(i) == currentPane) {
1850 if (i == 0) return;
1851 m_paneStack->setCurrentPane(m_paneStack->getPane(i-1));
1852 updateMenuStates();
1853 return;
1854 }
1855 }
1856 }
1857
1858 void
1859 MainWindowBase::nextPane()
1860 {
1861 if (!m_paneStack) return;
1862
1863 Pane *currentPane = m_paneStack->getCurrentPane();
1864 if (!currentPane) return;
1865
1866 for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
1867 if (m_paneStack->getPane(i) == currentPane) {
1868 if (i == m_paneStack->getPaneCount()-1) return;
1869 m_paneStack->setCurrentPane(m_paneStack->getPane(i+1));
1870 updateMenuStates();
1871 return;
1872 }
1873 }
1874 }
1875
1876 void
1877 MainWindowBase::previousLayer()
1878 {
1879 //!!! Not right -- pane lists layers in stacking order
1880
1881 if (!m_paneStack) return;
1882
1883 Pane *currentPane = m_paneStack->getCurrentPane();
1884 if (!currentPane) return;
1885
1886 Layer *currentLayer = currentPane->getSelectedLayer();
1887 if (!currentLayer) return;
1888
1889 for (int i = 0; i < currentPane->getLayerCount(); ++i) {
1890 if (currentPane->getLayer(i) == currentLayer) {
1891 if (i == 0) return;
1892 m_paneStack->setCurrentLayer(currentPane,
1893 currentPane->getLayer(i-1));
1894 updateMenuStates();
1895 return;
1896 }
1897 }
1898 }
1899
1900 void
1901 MainWindowBase::nextLayer()
1902 {
1903 //!!! Not right -- pane lists layers in stacking order
1904
1905 if (!m_paneStack) return;
1906
1907 Pane *currentPane = m_paneStack->getCurrentPane();
1908 if (!currentPane) return;
1909
1910 Layer *currentLayer = currentPane->getSelectedLayer();
1911 if (!currentLayer) return;
1912
1913 for (int i = 0; i < currentPane->getLayerCount(); ++i) {
1914 if (currentPane->getLayer(i) == currentLayer) {
1915 if (i == currentPane->getLayerCount()-1) return;
1916 m_paneStack->setCurrentLayer(currentPane,
1917 currentPane->getLayer(i+1));
1918 updateMenuStates();
1919 return;
1920 }
1921 }
1812 } 1922 }
1813 1923
1814 void 1924 void
1815 MainWindowBase::playbackFrameChanged(unsigned long frame) 1925 MainWindowBase::playbackFrameChanged(unsigned long frame)
1816 { 1926 {