void ToolsToolBar::OnTool(wxCommandEvent & evt) { mCurrentTool = evt.GetId() - firstTool; for (int i = 0; i < numTools; i++) if (i == mCurrentTool) mTool[i]->PushDown(); else mTool[i]->PopUp(); #ifdef EXPERIMENTAL_SCRUBBING_BASIC if (0 != mCurrentTool) { AudacityProject *p = GetActiveProject(); if (p) { TrackPanel *tp = p->GetTrackPanel(); if (tp) { tp->StopScrubbing(); } } } #endif RedrawAllProjects(); gPrefs->Write(wxT("/GUI/ToolBars/Tools/MultiToolActive"), IsDown(multiTool)); gPrefs->Flush(); }
/// Sets the currently active tool /// @param tool - The index of the tool to be used. /// @param show - should we update the button display? void ToolsToolBar::SetCurrentTool(int tool, bool show) { //In multi-mode the current tool is shown by the //cursor icon. The buttons are not updated. #ifdef EXPERIMENTAL_SCRUBBING_BASIC if (tool != selectTool) { AudacityProject *p = GetActiveProject(); if (p) { TrackPanel *tp = p->GetTrackPanel(); if (tp) { tp->StopScrubbing(); } } } #endif bool leavingMulticlipMode = IsDown(multiTool) && show && tool != multiTool; if (leavingMulticlipMode) mTool[multiTool]->PopUp(); if (tool != mCurrentTool || leavingMulticlipMode) { if (show) mTool[mCurrentTool]->PopUp(); mCurrentTool=tool; if (show) mTool[mCurrentTool]->PushDown(); } //JKC: ANSWER-ME: Why is this RedrawAllProjects() line required? //msmeyer: I think it isn't, we leave it out for 1.3.1 (beta), and // we'll see if anyone complains. // RedrawAllProjects(); //msmeyer: But we instruct the projects to handle the cursor shape again if (show) { RefreshCursorForAllProjects(); gPrefs->Write(wxT("/GUI/ToolBars/Tools/MultiToolActive"), IsDown(multiTool)); gPrefs->Flush(); } }