1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 16:10:06 +02:00

Move status bar message texts out of class ToolsToolBar

This commit is contained in:
Paul Licameli 2017-07-17 11:39:32 -04:00
parent 14450d6d9f
commit ed4300fed1
7 changed files with 27 additions and 55 deletions

View File

@ -85,31 +85,6 @@ ToolsToolBar::ToolsToolBar()
wxASSERT( drawTool == drawTool - firstTool );
wxASSERT( multiTool == multiTool - firstTool );
mMessageOfTool[selectTool] = _("Click and drag to select audio");
// TODO: this message isn't appropriate for time track
mMessageOfTool[envelopeTool] = _("Click and drag to edit the amplitude envelope");
// TODO: message should also mention the brush. Describing the modifier key
// (alt, or other) varies with operating system.
mMessageOfTool[drawTool] = _("Click and drag to edit the samples");
// TODO: Why not mention middle click to zoom normal on Windows too?
#if defined( __WXMAC__ )
mMessageOfTool[zoomTool] = _("Click to Zoom In, Shift-Click to Zoom Out");
#elif defined( __WXMSW__ )
mMessageOfTool[zoomTool] = _("Drag to Zoom Into Region, Right-Click to Zoom Out");
#elif defined( __WXGTK__ )
mMessageOfTool[zoomTool] = _("Left=Zoom In, Right=Zoom Out, Middle=Normal");
#endif
// TODO: Should it say "track or clip" ? Non-wave tracks can move, or clips in a wave track.
// TODO: mention effects of shift (move all clips of selected wave track) and ctrl (move vertically only) ?
// -- but not all of that is available in multi tool.
mMessageOfTool[slideTool] = _("Click and drag to move a track in time");
mMessageOfTool[multiTool] = wxT(""); // multi-mode tool
bool multiToolActive = false;
gPrefs->Read(wxT("/GUI/ToolBars/Tools/MultiToolActive"), &multiToolActive);
@ -270,19 +245,6 @@ int ToolsToolBar::GetDownTool()
return firstTool; // Should never happen
}
wxString ToolsToolBar::GetMessageForTool( int ToolNumber ) const
{
wxASSERT( ToolNumber >= 0 );
wxASSERT( ToolNumber < numTools );
auto tip = ::GetActiveProject()->GetScrubber().StatusMessageForWave();
if( tip.IsEmpty() )
return mMessageOfTool[ToolNumber];
else
return tip;
}
void ToolsToolBar::OnTool(wxCommandEvent & evt)
{
mCurrentTool = evt.GetId() - firstTool;

View File

@ -62,8 +62,6 @@ class ToolsToolBar final : public ToolBar {
bool IsDown(int tool) const;
int GetDownTool();
wxString GetMessageForTool( int ToolNumber ) const;
void Populate();
void Repaint(wxDC * WXUNUSED(dc)) override {};
void EnableDisableButtons() override {};
@ -78,8 +76,6 @@ class ToolsToolBar final : public ToolBar {
wxGridSizer *mToolSizer;
int mCurrentTool;
const wxChar *mMessageOfTool[numTools];
public:
DECLARE_CLASS(ToolsToolBar)

View File

@ -21,7 +21,6 @@ Paul Licameli split from TrackPanel.cpp
#include "../../../../prefs/WaveformSettings.h"
#include "../../../../Project.h"
#include "../../../../RefreshCode.h"
#include "../../../../toolbars/ToolsToolBar.h"
#include "../../../../TrackArtist.h"
#include "../../../../TrackPanelMouseEvent.h"
#include "../../../../UndoManager.h"
@ -56,8 +55,13 @@ HitTestPreview SampleHandle::HitPreview
static auto pencilCursor =
::MakeCursor(wxCURSOR_PENCIL, DrawCursorXpm, 12, 22);
const ToolsToolBar *const ttb = pProject->GetToolsToolBar();
// TODO: message should also mention the brush. Describing the modifier key
// (alt, or other) varies with operating system.
auto message = _("Click and drag to edit the samples");
return {
ttb->GetMessageForTool(drawTool),
message,
(unsafe
? &*disabledCursor
: (state.AltDown()

View File

@ -19,7 +19,6 @@ Paul Licameli split from TrackPanel.cpp
#include "../../prefs/WaveformSettings.h"
#include "../../Project.h"
#include "../../RefreshCode.h"
#include "../../toolbars/ToolsToolBar.h"
#include "../../TimeTrack.h"
#include "../../TrackArtist.h"
#include "../../TrackPanelMouseEvent.h"
@ -49,9 +48,11 @@ HitTestPreview EnvelopeHandle::HitPreview
::MakeCursor(wxCURSOR_NO_ENTRY, DisabledCursorXpm, 16, 16);
static auto envelopeCursor =
::MakeCursor(wxCURSOR_ARROW, EnvCursorXpm, 16, 16);
const ToolsToolBar *const ttb = pProject->GetToolsToolBar();
// TODO: this message isn't appropriate for time track
auto message = _("Click and drag to edit the amplitude envelope");
return {
ttb->GetMessageForTool(envelopeTool),
message,
(unsafe
? &*disabledCursor
: &*envelopeCursor)

View File

@ -968,9 +968,7 @@ HitTestPreview SelectHandle::Preview
MaySetOnDemandTip(pTrack.get(), tip);
}
if (tip == "") {
const auto ttb = pProject->GetToolsToolBar();
if (ttb)
tip = ttb->GetMessageForTool(selectTool);
tip = _("Click and drag to select audio");
}
if (HasEscape() && mUseSnap) {
tip += wxT(" ") +

View File

@ -44,9 +44,13 @@ HitTestPreview TimeShiftHandle::HitPreview
::MakeCursor(wxCURSOR_NO_ENTRY, DisabledCursorXpm, 16, 16);
static auto slideCursor =
MakeCursor(wxCURSOR_SIZEWE, TimeCursorXpm, 16, 16);
const ToolsToolBar *const ttb = pProject->GetToolsToolBar();
// TODO: Should it say "track or clip" ? Non-wave tracks can move, or clips in a wave track.
// TODO: mention effects of shift (move all clips of selected wave track) and ctrl (move vertically only) ?
// -- but not all of that is available in multi tool.
auto message = _("Click and drag to move a track in time");
return {
ttb->GetMessageForTool(slideTool),
message,
(unsafe
? &*disabledCursor
: &*slideCursor)

View File

@ -22,7 +22,6 @@ Paul Licameli split from TrackPanel.cpp
#include "../../Project.h"
#include "../../RefreshCode.h"
#include "../../TrackPanelMouseEvent.h"
#include "../../toolbars/ToolsToolBar.h"
#include "../../ViewInfo.h"
#include "../../../images/Cursors.h"
@ -47,9 +46,17 @@ HitTestPreview ZoomHandle::HitPreview
::MakeCursor(wxCURSOR_MAGNIFIER, ZoomInCursorXpm, 19, 15);
static auto zoomOutCursor =
::MakeCursor(wxCURSOR_MAGNIFIER, ZoomOutCursorXpm, 19, 15);
const ToolsToolBar *const ttb = pProject->GetToolsToolBar();
wxString message;
// TODO: Why not mention middle click to zoom normal on Windows too?
#if defined( __WXMAC__ )
message = _("Click to Zoom In, Shift-Click to Zoom Out");
#elif defined( __WXMSW__ )
message = _("Drag to Zoom Into Region, Right-Click to Zoom Out");
#elif defined( __WXGTK__ )
message = _("Left=Zoom In, Right=Zoom Out, Middle=Normal");
#endif
return {
ttb->GetMessageForTool(zoomTool),
message,
(state.ShiftDown() ? &*zoomOutCursor : &*zoomInCursor)
};
}