File tree Expand file tree Collapse file tree
include/Kaixo/SpectralRotator/Gui
source/Kaixo/SpectralRotator/Gui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,6 +51,10 @@ namespace Kaixo::Gui {
5151
5252 // ------------------------------------------------
5353
54+ bool keyPressed (const juce::KeyPress& event);
55+
56+ // ------------------------------------------------
57+
5458 void onIdle () override ;
5559
5660 // ------------------------------------------------
Original file line number Diff line number Diff line change @@ -59,10 +59,6 @@ namespace Kaixo::Gui {
5959
6060 // ------------------------------------------------
6161
62- bool keyPressed (const juce::KeyPress& event) override ;
63-
64- // ------------------------------------------------
65-
6662 void reGenerateImage (bool withAnalyze);
6763 void fileWillProbablyChangeSoon () { m_FileWillProbablyChange = true ; };
6864 void fileDidNotChange () { m_FileWillProbablyChange = false ; };
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ namespace Kaixo::Gui {
2222 SpectralFileViewer::SpectralFileViewer (Context c, Settings s)
2323 : View(c), settings(std::move(s))
2424 {
25+ // ------------------------------------------------
26+
27+ setWantsKeyboardFocus (true );
2528
2629 // ------------------------------------------------
2730
@@ -132,7 +135,18 @@ namespace Kaixo::Gui {
132135 }
133136
134137 // ------------------------------------------------
135-
138+
139+ bool SpectralFileViewer::keyPressed (const juce::KeyPress& event) {
140+ if (event.getKeyCode () == event.spaceKey ) {
141+ settings.file ->playPause ();
142+ return true ;
143+ }
144+
145+ return false ;
146+ }
147+
148+ // ------------------------------------------------
149+
136150 void SpectralFileViewer::onIdle () {
137151 View::onIdle ();
138152 if (m_RotateFuture.valid () && m_RotateFuture.wait_for (std::chrono::milliseconds (0 )) == std::future_status::ready) {
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ namespace Kaixo::Gui {
1616 SpectralViewer::SpectralViewer (Context c, Settings s)
1717 : View(c), settings(std::move(s))
1818 {
19- setWantsKeyboardFocus (true );
2019 wantsIdle (true );
2120
2221 reGenerateImage (true );
@@ -135,17 +134,6 @@ namespace Kaixo::Gui {
135134
136135 // ------------------------------------------------
137136
138- bool SpectralViewer::keyPressed (const juce::KeyPress& event) {
139- if (event.getKeyCode () == event.spaceKey ) {
140- settings.file ->playPause ();
141- return true ;
142- }
143-
144- return false ;
145- }
146-
147- // ------------------------------------------------
148-
149137 void SpectralViewer::reGenerateImage (bool withAnalyze) {
150138 m_CausedByResize = m_DidResize;
151139 if (withAnalyze) m_ShouldAnalyze = true ;
You can’t perform that action at this time.
0 commit comments