comparison src/Analyser.h @ 194:34797795a76c

Clearing the selection by hitting Esc now restores the selected region of the pitch track to its contents from before the selection was made (and any alternate candidate chosen). Fixes feature #885
author Chris Cannam
date Wed, 05 Mar 2014 10:38:23 +0000
parents 431a95c9d14d
children bb391844e2aa
comparison
equal deleted inserted replaced
193:abfbe8c2883b 194:34797795a76c
22 #include <map> 22 #include <map>
23 #include <vector> 23 #include <vector>
24 24
25 #include "framework/Document.h" 25 #include "framework/Document.h"
26 #include "base/Selection.h" 26 #include "base/Selection.h"
27 #include "base/Clipboard.h"
27 28
28 class WaveFileModel; 29 class WaveFileModel;
29 class Pane; 30 class Pane;
30 class PaneStack; 31 class PaneStack;
31 class Layer; 32 class Layer;
106 * visible (by default they are hidden after construction until 107 * visible (by default they are hidden after construction until
107 * the user requests them). Note that the shown/hidden state is 108 * the user requests them). Note that the shown/hidden state is
108 * independent of whether any pitch candidates actually exist -- 109 * independent of whether any pitch candidates actually exist --
109 * it's possible they might be shown but not have been created yet 110 * it's possible they might be shown but not have been created yet
110 * because creation (through reAnalyseSelection) is asynchronous. 111 * because creation (through reAnalyseSelection) is asynchronous.
112 *
113 *!!! this interface is not right
111 */ 114 */
112 bool arePitchCandidatesShown() const; 115 bool arePitchCandidatesShown() const;
113 116
114 /** 117 /**
115 * Show or hide the analysed pitch candidate layers. As in 118 * Show or hide the analysed pitch candidate layers. As in
116 * arePitchCandidatesShown, this is independent of whether the 119 * arePitchCandidatesShown, this is independent of whether the
117 * candidate layers actually exist. Call reAnalyseSelection to 120 * candidate layers actually exist. Call reAnalyseSelection to
118 * schedule creation of those layers. 121 * schedule creation of those layers.
122 *
123 *!!! this interface is not right
119 */ 124 */
120 void showPitchCandidates(bool shown); 125 void showPitchCandidates(bool shown);
121 126
122 /** 127 /**
123 * If a re-analysis has been activated, switch the selected area 128 * If a re-analysis has been activated, switch the selected area
137 * tracks up or down an octave in the selected area. 142 * tracks up or down an octave in the selected area.
138 */ 143 */
139 void shiftOctave(Selection sel, bool up); 144 void shiftOctave(Selection sel, bool up);
140 145
141 /** 146 /**
142 * Remove any re-analysis layers. 147 * Remove any re-analysis layers (equivalent to
148 * showPitchCandidates(false)) and also reset the pitch track in
149 * the given selection to its state prior to the last re-analysis,
150 * abandoning any changes made since then.
143 */ 151 */
144 void clearReAnalysis(); 152 void clearReAnalysis(Selection sel);
145 153
146 /** 154 /**
147 * Import the pitch track from the given layer into our 155 * Import the pitch track from the given layer into our
148 * pitch-track layer. 156 * pitch-track layer.
149 */ 157 */
166 PaneStack *m_paneStack; 174 PaneStack *m_paneStack;
167 Pane *m_pane; 175 Pane *m_pane;
168 176
169 mutable std::map<Component, Layer *> m_layers; 177 mutable std::map<Component, Layer *> m_layers;
170 178
179 Clipboard m_preAnalysis;
171 Selection m_reAnalysingSelection; 180 Selection m_reAnalysingSelection;
172 std::vector<Layer *> m_reAnalysisCandidates; 181 std::vector<Layer *> m_reAnalysisCandidates;
173 int m_currentCandidate; 182 int m_currentCandidate;
174 bool m_candidatesVisible; 183 bool m_candidatesVisible;
175 184