Mercurial > hg > svgui
comparison view/ViewManager.cpp @ 374:64e84e5efb76 spectrogram-cache-rejig
* Merge from trunk
author | Chris Cannam |
---|---|
date | Wed, 27 Feb 2008 11:59:42 +0000 |
parents | 4f4f38a11cd2 |
children |
comparison
equal
deleted
inserted
replaced
332:6440e280122e | 374:64e84e5efb76 |
---|---|
55 m_zoomWheelsEnabled = | 55 m_zoomWheelsEnabled = |
56 settings.value("zoom-wheels-enabled", m_zoomWheelsEnabled).toBool(); | 56 settings.value("zoom-wheels-enabled", m_zoomWheelsEnabled).toBool(); |
57 settings.endGroup(); | 57 settings.endGroup(); |
58 | 58 |
59 if (getGlobalDarkBackground()) { | 59 if (getGlobalDarkBackground()) { |
60 | 60 /* |
61 std::cerr << "dark palette:" << std::endl; | 61 std::cerr << "dark palette:" << std::endl; |
62 std::cerr << "window = " << QApplication::palette().color(QPalette::Window).name().toStdString() << std::endl; | 62 std::cerr << "window = " << QApplication::palette().color(QPalette::Window).name().toStdString() << std::endl; |
63 std::cerr << "windowtext = " << QApplication::palette().color(QPalette::WindowText).name().toStdString() << std::endl; | 63 std::cerr << "windowtext = " << QApplication::palette().color(QPalette::WindowText).name().toStdString() << std::endl; |
64 std::cerr << "base = " << QApplication::palette().color(QPalette::Base).name().toStdString() << std::endl; | 64 std::cerr << "base = " << QApplication::palette().color(QPalette::Base).name().toStdString() << std::endl; |
65 std::cerr << "alternatebase = " << QApplication::palette().color(QPalette::AlternateBase).name().toStdString() << std::endl; | 65 std::cerr << "alternatebase = " << QApplication::palette().color(QPalette::AlternateBase).name().toStdString() << std::endl; |
68 std::cerr << "buttontext = " << QApplication::palette().color(QPalette::ButtonText).name().toStdString() << std::endl; | 68 std::cerr << "buttontext = " << QApplication::palette().color(QPalette::ButtonText).name().toStdString() << std::endl; |
69 std::cerr << "brighttext = " << QApplication::palette().color(QPalette::BrightText).name().toStdString() << std::endl; | 69 std::cerr << "brighttext = " << QApplication::palette().color(QPalette::BrightText).name().toStdString() << std::endl; |
70 std::cerr << "light = " << QApplication::palette().color(QPalette::Light).name().toStdString() << std::endl; | 70 std::cerr << "light = " << QApplication::palette().color(QPalette::Light).name().toStdString() << std::endl; |
71 std::cerr << "dark = " << QApplication::palette().color(QPalette::Dark).name().toStdString() << std::endl; | 71 std::cerr << "dark = " << QApplication::palette().color(QPalette::Dark).name().toStdString() << std::endl; |
72 std::cerr << "mid = " << QApplication::palette().color(QPalette::Mid).name().toStdString() << std::endl; | 72 std::cerr << "mid = " << QApplication::palette().color(QPalette::Mid).name().toStdString() << std::endl; |
73 | 73 */ |
74 m_lightPalette = QPalette(QColor("#000000"), // WindowText | 74 m_lightPalette = QPalette(QColor("#000000"), // WindowText |
75 QColor("#dddfe4"), // Button | 75 QColor("#dddfe4"), // Button |
76 QColor("#ffffff"), // Light | 76 QColor("#ffffff"), // Light |
77 QColor("#555555"), // Dark | 77 QColor("#555555"), // Dark |
78 QColor("#c7c7c7"), // Mid | 78 QColor("#c7c7c7"), // Mid |
81 QColor("#ffffff"), // Base | 81 QColor("#ffffff"), // Base |
82 QColor("#efefef")); // Window | 82 QColor("#efefef")); // Window |
83 | 83 |
84 | 84 |
85 } else { | 85 } else { |
86 /* | |
86 std::cerr << "light palette:" << std::endl; | 87 std::cerr << "light palette:" << std::endl; |
87 std::cerr << "window = " << QApplication::palette().color(QPalette::Window).name().toStdString() << std::endl; | 88 std::cerr << "window = " << QApplication::palette().color(QPalette::Window).name().toStdString() << std::endl; |
88 std::cerr << "windowtext = " << QApplication::palette().color(QPalette::WindowText).name().toStdString() << std::endl; | 89 std::cerr << "windowtext = " << QApplication::palette().color(QPalette::WindowText).name().toStdString() << std::endl; |
89 std::cerr << "base = " << QApplication::palette().color(QPalette::Base).name().toStdString() << std::endl; | 90 std::cerr << "base = " << QApplication::palette().color(QPalette::Base).name().toStdString() << std::endl; |
90 std::cerr << "alternatebase = " << QApplication::palette().color(QPalette::AlternateBase).name().toStdString() << std::endl; | 91 std::cerr << "alternatebase = " << QApplication::palette().color(QPalette::AlternateBase).name().toStdString() << std::endl; |
93 std::cerr << "buttontext = " << QApplication::palette().color(QPalette::ButtonText).name().toStdString() << std::endl; | 94 std::cerr << "buttontext = " << QApplication::palette().color(QPalette::ButtonText).name().toStdString() << std::endl; |
94 std::cerr << "brighttext = " << QApplication::palette().color(QPalette::BrightText).name().toStdString() << std::endl; | 95 std::cerr << "brighttext = " << QApplication::palette().color(QPalette::BrightText).name().toStdString() << std::endl; |
95 std::cerr << "light = " << QApplication::palette().color(QPalette::Light).name().toStdString() << std::endl; | 96 std::cerr << "light = " << QApplication::palette().color(QPalette::Light).name().toStdString() << std::endl; |
96 std::cerr << "dark = " << QApplication::palette().color(QPalette::Dark).name().toStdString() << std::endl; | 97 std::cerr << "dark = " << QApplication::palette().color(QPalette::Dark).name().toStdString() << std::endl; |
97 std::cerr << "mid = " << QApplication::palette().color(QPalette::Mid).name().toStdString() << std::endl; | 98 std::cerr << "mid = " << QApplication::palette().color(QPalette::Mid).name().toStdString() << std::endl; |
98 | 99 */ |
99 m_darkPalette = QPalette(QColor("#ffffff"), // WindowText | 100 m_darkPalette = QPalette(QColor("#ffffff"), // WindowText |
100 QColor("#3e3e3e"), // Button | 101 QColor("#3e3e3e"), // Button |
101 QColor("#808080"), // Light | 102 QColor("#808080"), // Light |
102 QColor("#1e1e1e"), // Dark | 103 QColor("#1e1e1e"), // Dark |
103 QColor("#404040"), // Mid | 104 QColor("#404040"), // Mid |
171 ViewManager::setPlaybackModel(Model *model) | 172 ViewManager::setPlaybackModel(Model *model) |
172 { | 173 { |
173 m_playbackModel = model; | 174 m_playbackModel = model; |
174 } | 175 } |
175 | 176 |
177 size_t | |
178 ViewManager::alignPlaybackFrameToReference(size_t frame) const | |
179 { | |
180 if (!m_playbackModel) return frame; | |
181 else return m_playbackModel->alignToReference(frame); | |
182 } | |
183 | |
184 size_t | |
185 ViewManager::alignReferenceToPlaybackFrame(size_t frame) const | |
186 { | |
187 if (!m_playbackModel) return frame; | |
188 else return m_playbackModel->alignFromReference(frame); | |
189 } | |
190 | |
176 bool | 191 bool |
177 ViewManager::haveInProgressSelection() const | 192 ViewManager::haveInProgressSelection() const |
178 { | 193 { |
179 return !m_inProgressSelection.isEmpty(); | 194 return !m_inProgressSelection.isEmpty(); |
180 } | 195 } |
258 ViewManager::constrainFrameToSelection(size_t frame) const | 273 ViewManager::constrainFrameToSelection(size_t frame) const |
259 { | 274 { |
260 MultiSelection::SelectionList sl = getSelections(); | 275 MultiSelection::SelectionList sl = getSelections(); |
261 if (sl.empty()) return frame; | 276 if (sl.empty()) return frame; |
262 | 277 |
263 size_t selectionStartFrame = sl.begin()->getStartFrame(); | 278 for (MultiSelection::SelectionList::const_iterator i = sl.begin(); |
264 if (frame < selectionStartFrame) { | 279 i != sl.end(); ++i) { |
265 frame = selectionStartFrame; | 280 |
266 return frame; | 281 if (frame < i->getEndFrame()) { |
267 } | 282 if (frame < i->getStartFrame()) { |
268 | 283 return i->getStartFrame(); |
269 MultiSelection::SelectionList::iterator i = sl.end(); | 284 } else { |
270 --i; | 285 return frame; |
271 size_t selectionEndFrame = i->getEndFrame(); | 286 } |
272 if (frame > selectionEndFrame) frame = selectionEndFrame; | 287 } |
273 | 288 } |
274 return frame; | 289 |
290 return sl.begin()->getStartFrame(); | |
275 } | 291 } |
276 | 292 |
277 void | 293 void |
278 ViewManager::signalSelectionChange() | 294 ViewManager::signalSelectionChange() |
279 { | 295 { |