Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 123:74dd55646f52
* A bit more work on the data editor
author | Chris Cannam |
---|---|
date | Wed, 11 Jun 2008 12:54:18 +0000 |
parents | 087662afe778 |
children | bfa6b0582acb |
comparison
equal
deleted
inserted
replaced
122:ab861544f998 | 123:74dd55646f52 |
---|---|
37 #include "widgets/ListInputDialog.h" | 37 #include "widgets/ListInputDialog.h" |
38 #include "widgets/CommandHistory.h" | 38 #include "widgets/CommandHistory.h" |
39 #include "widgets/ProgressDialog.h" | 39 #include "widgets/ProgressDialog.h" |
40 #include "widgets/MIDIFileImportDialog.h" | 40 #include "widgets/MIDIFileImportDialog.h" |
41 #include "widgets/CSVFormatDialog.h" | 41 #include "widgets/CSVFormatDialog.h" |
42 #include "widgets/ModelDataTableDialog.h" | |
42 | 43 |
43 #include "audioio/AudioCallbackPlaySource.h" | 44 #include "audioio/AudioCallbackPlaySource.h" |
44 #include "audioio/AudioCallbackPlayTarget.h" | 45 #include "audioio/AudioCallbackPlayTarget.h" |
45 #include "audioio/AudioTargetFactory.h" | 46 #include "audioio/AudioTargetFactory.h" |
46 #include "audioio/PlaySpeedRangeMapper.h" | 47 #include "audioio/PlaySpeedRangeMapper.h" |
1921 } | 1922 } |
1922 updateMenuStates(); | 1923 updateMenuStates(); |
1923 } | 1924 } |
1924 | 1925 |
1925 void | 1926 void |
1927 MainWindowBase::editCurrentLayer() | |
1928 { | |
1929 Layer *layer = 0; | |
1930 Pane *pane = m_paneStack->getCurrentPane(); | |
1931 if (pane) layer = pane->getSelectedLayer(); | |
1932 if (!layer) return; | |
1933 | |
1934 Model *model = layer->getModel(); | |
1935 if (!model) return; | |
1936 | |
1937 if (m_layerDataDialogMap.find(layer) != m_layerDataDialogMap.end()) { | |
1938 m_layerDataDialogMap[layer]->show(); | |
1939 m_layerDataDialogMap[layer]->raise(); | |
1940 return; | |
1941 } | |
1942 | |
1943 ModelDataTableDialog *dialog = new ModelDataTableDialog(model); | |
1944 // dialog->setAttribute(Qt::WA_DeleteOnClose); //!!! how to manage this? | |
1945 | |
1946 connect(m_viewManager, | |
1947 SIGNAL(globalCentreFrameChanged(unsigned long)), | |
1948 dialog, | |
1949 SLOT(scrollToFrameRequested(unsigned long))); | |
1950 /* | |
1951 connect(m_viewManager, | |
1952 SIGNAL(playbackFrameChanged(unsigned long)), | |
1953 dialog, | |
1954 SLOT(scrollToFrameRequested(unsigned long))); | |
1955 */ | |
1956 connect(dialog, | |
1957 SIGNAL(scrollToFrame(unsigned long)), | |
1958 m_viewManager, | |
1959 SLOT(setGlobalCentreFrame(unsigned long))); | |
1960 | |
1961 m_layerDataDialogMap[layer] = dialog; | |
1962 m_viewDataDialogMap[pane].insert(dialog); | |
1963 | |
1964 dialog->show(); | |
1965 } | |
1966 | |
1967 void | |
1926 MainWindowBase::previousPane() | 1968 MainWindowBase::previousPane() |
1927 { | 1969 { |
1928 if (!m_paneStack) return; | 1970 if (!m_paneStack) return; |
1929 | 1971 |
1930 Pane *currentPane = m_paneStack->getCurrentPane(); | 1972 Pane *currentPane = m_paneStack->getCurrentPane(); |
2049 if (!p->getFollowGlobalPan()) return; | 2091 if (!p->getFollowGlobalPan()) return; |
2050 updateVisibleRangeDisplay(p); | 2092 updateVisibleRangeDisplay(p); |
2051 } | 2093 } |
2052 | 2094 |
2053 void | 2095 void |
2054 MainWindowBase::viewCentreFrameChanged(View *v, unsigned long ) | 2096 MainWindowBase::viewCentreFrameChanged(View *v, unsigned long frame) |
2055 { | 2097 { |
2098 std::cerr << "MainWindowBase::viewCentreFrameChanged(" << v << "," << frame << ")" << std::endl; | |
2099 | |
2100 if (m_viewDataDialogMap.find(v) != m_viewDataDialogMap.end()) { | |
2101 for (DataDialogSet::iterator i = m_viewDataDialogMap[v].begin(); | |
2102 i != m_viewDataDialogMap[v].end(); ++i) { | |
2103 std::cerr << "found dialog" << std::endl; | |
2104 (*i)->scrollToFrameRequested(frame); | |
2105 } | |
2106 } | |
2056 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; | 2107 if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; |
2057 Pane *p = 0; | 2108 Pane *p = 0; |
2058 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; | 2109 if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; |
2059 if (v == p) updateVisibleRangeDisplay(p); | 2110 if (v == p) updateVisibleRangeDisplay(p); |
2060 } | 2111 } |
2083 } | 2134 } |
2084 | 2135 |
2085 void | 2136 void |
2086 MainWindowBase::layerAboutToBeDeleted(Layer *layer) | 2137 MainWindowBase::layerAboutToBeDeleted(Layer *layer) |
2087 { | 2138 { |
2139 if (m_layerDataDialogMap.find(layer) != m_layerDataDialogMap.end()) { | |
2140 | |
2141 ModelDataTableDialog *dialog = m_layerDataDialogMap[layer]; | |
2142 | |
2143 for (ViewDataDialogMap::iterator vi = m_viewDataDialogMap.begin(); | |
2144 vi != m_viewDataDialogMap.end(); ++vi) { | |
2145 vi->second.erase(dialog); | |
2146 } | |
2147 | |
2148 m_layerDataDialogMap.erase(layer); | |
2149 delete dialog; | |
2150 } | |
2151 | |
2088 // std::cerr << "MainWindowBase::layerAboutToBeDeleted(" << layer << ")" << std::endl; | 2152 // std::cerr << "MainWindowBase::layerAboutToBeDeleted(" << layer << ")" << std::endl; |
2089 if (m_timeRulerLayer && (layer == m_timeRulerLayer)) { | 2153 if (m_timeRulerLayer && (layer == m_timeRulerLayer)) { |
2090 // std::cerr << "(this is the time ruler layer)" << std::endl; | 2154 // std::cerr << "(this is the time ruler layer)" << std::endl; |
2091 m_timeRulerLayer = 0; | 2155 m_timeRulerLayer = 0; |
2092 } | 2156 } |