1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-28 14:18:41 +02:00
audacity/src/commands/CommandType.cpp
James Crook b83b862b3f OldStyleCommandType - It's on the way out.
This renaming makes it clearer which code is still using Dan Horgan's Command system.
2018-02-24 14:20:23 -05:00

66 lines
1.5 KiB
C++

/**********************************************************************
Audacity - A Digital Audio Editor
Copyright 1999-2009 Audacity Team
License: wxwidgets
Dan Horgan
******************************************************************//**
\file CommandType.cpp
\brief Contains definitions for CommandType class
\class OldStyleCommandType
\brief Base class for containing data common to all commands of a given type.
Also acts as a factory.
*//*******************************************************************/
#include "../Audacity.h"
#include "CommandType.h"
#include "CommandMisc.h"
#include "CommandSignature.h"
#include <wx/string.h>
OldStyleCommandType::OldStyleCommandType()
: mName{}, mSignature{}
{ }
OldStyleCommandType::~OldStyleCommandType()
{
}
wxString OldStyleCommandType::GetName()
{
if (mName.empty())
mName = BuildName();
return mName;
}
CommandSignature &OldStyleCommandType::GetSignature()
{
if (!mSignature)
{
mSignature.create();
BuildSignature(*mSignature);
}
return *mSignature;
}
wxString OldStyleCommandType::Describe()
{
wxString desc = GetName() + wxT("\nParameters:");
GetSignature();
ParamValueMap::iterator iter;
ParamValueMap defaults = mSignature->GetDefaults();
for (iter = defaults.begin(); iter != defaults.end(); ++iter)
{
desc += wxT("\n") + iter->first + wxT(": ")
+ mSignature->GetValidator(iter->first).GetDescription()
+ wxT(" (default: ")
+ iter->second.MakeString() + wxT(")");
}
return desc;
}