comparison framework/MainWindowBase.cpp @ 328:28c17ce7a6e9 tony_integration

Merge from tonioni branch
author Chris Cannam
date Tue, 28 Jan 2014 15:02:15 +0000
parents c837368b1faf b6358ba5ebc6
children 1e3af7f4fa86
comparison
equal deleted inserted replaced
304:c837368b1faf 328:28c17ce7a6e9
20 #include "view/Pane.h" 20 #include "view/Pane.h"
21 #include "view/PaneStack.h" 21 #include "view/PaneStack.h"
22 #include "data/model/WaveFileModel.h" 22 #include "data/model/WaveFileModel.h"
23 #include "data/model/SparseOneDimensionalModel.h" 23 #include "data/model/SparseOneDimensionalModel.h"
24 #include "data/model/NoteModel.h" 24 #include "data/model/NoteModel.h"
25 #include "data/model/FlexiNoteModel.h"
25 #include "data/model/Labeller.h" 26 #include "data/model/Labeller.h"
26 #include "data/model/TabularModel.h" 27 #include "data/model/TabularModel.h"
27 #include "view/ViewManager.h" 28 #include "view/ViewManager.h"
28 29
29 #include "layer/WaveformLayer.h" 30 #include "layer/WaveformLayer.h"
33 #include "layer/Colour3DPlotLayer.h" 34 #include "layer/Colour3DPlotLayer.h"
34 #include "layer/SliceLayer.h" 35 #include "layer/SliceLayer.h"
35 #include "layer/SliceableLayer.h" 36 #include "layer/SliceableLayer.h"
36 #include "layer/ImageLayer.h" 37 #include "layer/ImageLayer.h"
37 #include "layer/NoteLayer.h" 38 #include "layer/NoteLayer.h"
39 #include "layer/FlexiNoteLayer.h"
38 #include "layer/RegionLayer.h" 40 #include "layer/RegionLayer.h"
39 41
40 #include "widgets/ListInputDialog.h" 42 #include "widgets/ListInputDialog.h"
41 #include "widgets/CommandHistory.h" 43 #include "widgets/CommandHistory.h"
42 #include "widgets/ProgressDialog.h" 44 #include "widgets/ProgressDialog.h"
307 return ff->getOpenFileName(type, m_audioFile); 309 return ff->getOpenFileName(type, m_audioFile);
308 case FileFinder::LayerFile: 310 case FileFinder::LayerFile:
309 return ff->getOpenFileName(type, m_sessionFile); 311 return ff->getOpenFileName(type, m_sessionFile);
310 case FileFinder::LayerFileNoMidi: 312 case FileFinder::LayerFileNoMidi:
311 return ff->getOpenFileName(type, m_sessionFile); 313 return ff->getOpenFileName(type, m_sessionFile);
314 case FileFinder::LayerFileNonSV:
315 return ff->getOpenFileName(type, m_sessionFile);
316 case FileFinder::LayerFileNoMidiNonSV:
317 return ff->getOpenFileName(type, m_sessionFile);
312 case FileFinder::SessionOrAudioFile: 318 case FileFinder::SessionOrAudioFile:
313 return ff->getOpenFileName(type, m_sessionFile); 319 return ff->getOpenFileName(type, m_sessionFile);
314 case FileFinder::ImageFile: 320 case FileFinder::ImageFile:
315 return ff->getOpenFileName(type, m_sessionFile); 321 return ff->getOpenFileName(type, m_sessionFile);
316 case FileFinder::CSVFile: 322 case FileFinder::CSVFile:
338 case FileFinder::AudioFile: 344 case FileFinder::AudioFile:
339 return ff->getSaveFileName(type, m_audioFile); 345 return ff->getSaveFileName(type, m_audioFile);
340 case FileFinder::LayerFile: 346 case FileFinder::LayerFile:
341 return ff->getSaveFileName(type, m_sessionFile); 347 return ff->getSaveFileName(type, m_sessionFile);
342 case FileFinder::LayerFileNoMidi: 348 case FileFinder::LayerFileNoMidi:
349 return ff->getSaveFileName(type, m_sessionFile);
350 case FileFinder::LayerFileNonSV:
351 return ff->getSaveFileName(type, m_sessionFile);
352 case FileFinder::LayerFileNoMidiNonSV:
343 return ff->getSaveFileName(type, m_sessionFile); 353 return ff->getSaveFileName(type, m_sessionFile);
344 case FileFinder::SessionOrAudioFile: 354 case FileFinder::SessionOrAudioFile:
345 return ff->getSaveFileName(type, m_sessionFile); 355 return ff->getSaveFileName(type, m_sessionFile);
346 case FileFinder::ImageFile: 356 case FileFinder::ImageFile:
347 return ff->getSaveFileName(type, m_sessionFile); 357 return ff->getSaveFileName(type, m_sessionFile);
428 (haveCurrentLayer && 438 (haveCurrentLayer &&
429 dynamic_cast<TimeInstantLayer *>(currentLayer)); 439 dynamic_cast<TimeInstantLayer *>(currentLayer));
430 bool haveCurrentDurationLayer = 440 bool haveCurrentDurationLayer =
431 (haveCurrentLayer && 441 (haveCurrentLayer &&
432 (dynamic_cast<NoteLayer *>(currentLayer) || 442 (dynamic_cast<NoteLayer *>(currentLayer) ||
443 dynamic_cast<FlexiNoteLayer *>(currentLayer) ||
433 dynamic_cast<RegionLayer *>(currentLayer))); 444 dynamic_cast<RegionLayer *>(currentLayer)));
434 bool haveCurrentColour3DPlot = 445 bool haveCurrentColour3DPlot =
435 (haveCurrentLayer && 446 (haveCurrentLayer &&
436 dynamic_cast<Colour3DPlotLayer *>(currentLayer)); 447 dynamic_cast<Colour3DPlotLayer *>(currentLayer));
437 bool haveClipboardContents = 448 bool haveClipboardContents =
1013 1024
1014 if (c) { 1025 if (c) {
1015 CommandHistory::getInstance()->addCommand(c, false); 1026 CommandHistory::getInstance()->addCommand(c, false);
1016 return; 1027 return;
1017 } 1028 }
1029
1030 FlexiNoteModel *fnm = dynamic_cast<FlexiNoteModel *>(layer->getModel());
1031 if (fnm) {
1032 FlexiNoteModel::Point point(alignedStart,
1033 rm->getValueMinimum(),
1034 alignedDuration,
1035 1.f,
1036 "");
1037 FlexiNoteModel::EditCommand *command =
1038 new FlexiNoteModel::EditCommand(fnm, tr("Add Point"));
1039 command->addPoint(point);
1040 command->setName(name);
1041 c = command->finish();
1042 }
1043
1044 if (c) {
1045 CommandHistory::getInstance()->addCommand(c, false);
1046 return;
1047 }
1018 } 1048 }
1019 1049
1020 void 1050 void
1021 MainWindowBase::renumberInstants() 1051 MainWindowBase::renumberInstants()
1022 { 1052 {
2227 2257
2228 void 2258 void
2229 MainWindowBase::zoomDefault() 2259 MainWindowBase::zoomDefault()
2230 { 2260 {
2231 Pane *currentPane = m_paneStack->getCurrentPane(); 2261 Pane *currentPane = m_paneStack->getCurrentPane();
2232 if (currentPane) currentPane->setZoomLevel(1024); 2262 QSettings settings;
2263 settings.beginGroup("MainWindow");
2264 int zoom = settings.value("zoom-default", 1024).toInt();
2265 settings.endGroup();
2266 if (currentPane) currentPane->setZoomLevel(zoom);
2233 } 2267 }
2234 2268
2235 void 2269 void
2236 MainWindowBase::scrollLeft() 2270 MainWindowBase::scrollLeft()
2237 { 2271 {
3089 3123
3090 void 3124 void
3091 MainWindowBase::modelAdded(Model *model) 3125 MainWindowBase::modelAdded(Model *model)
3092 { 3126 {
3093 // SVDEBUG << "MainWindowBase::modelAdded(" << model << ")" << endl; 3127 // SVDEBUG << "MainWindowBase::modelAdded(" << model << ")" << endl;
3128 std::cerr << "\nAdding model " << model->getTypeName() << " to playsource " << std::endl;
3094 m_playSource->addModel(model); 3129 m_playSource->addModel(model);
3095 } 3130 }
3096 3131
3097 void 3132 void
3098 MainWindowBase::mainModelChanged(WaveFileModel *model) 3133 MainWindowBase::mainModelChanged(WaveFileModel *model)