mirror of
https://github.com/cookiengineer/audacity
synced 2026-02-06 19:52:19 +01:00
Locate and position the current Audacity source code, and clear a variety of old junk out of the way into junk-branches
This commit is contained in:
92
src/commands/PreferenceCommands.cpp
Normal file
92
src/commands/PreferenceCommands.cpp
Normal file
@@ -0,0 +1,92 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity - A Digital Audio Editor
|
||||
Copyright 1999-2009 Audacity Team
|
||||
File License: wxWidgets
|
||||
|
||||
Dan Horgan
|
||||
|
||||
******************************************************************//**
|
||||
|
||||
\file PreferenceCommands.cpp
|
||||
\brief Contains definitions for the GetPreferenceCommand and
|
||||
SetPreferenceCommand classes
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "PreferenceCommands.h"
|
||||
#include "../Prefs.h"
|
||||
|
||||
// GetPreference
|
||||
|
||||
wxString GetPreferenceCommandType::BuildName()
|
||||
{
|
||||
return wxT("GetPreference");
|
||||
}
|
||||
|
||||
void GetPreferenceCommandType::BuildSignature(CommandSignature &signature)
|
||||
{
|
||||
Validator *prefNameValidator(new Validator());
|
||||
signature.AddParameter(wxT("PrefName"), wxT(""), prefNameValidator);
|
||||
}
|
||||
|
||||
Command *GetPreferenceCommandType::Create(CommandOutputTarget *target)
|
||||
{
|
||||
return new GetPreferenceCommand(*this, target);
|
||||
}
|
||||
|
||||
bool GetPreferenceCommand::Apply(CommandExecutionContext context)
|
||||
{
|
||||
wxString prefName = GetString(wxT("PrefName"));
|
||||
wxString prefValue;
|
||||
if (!gPrefs->Read(prefName, &prefValue))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Status(prefValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
GetPreferenceCommand::~GetPreferenceCommand()
|
||||
{ }
|
||||
|
||||
// SetPreference
|
||||
|
||||
wxString SetPreferenceCommandType::BuildName()
|
||||
{
|
||||
return wxT("SetPreference");
|
||||
}
|
||||
|
||||
void SetPreferenceCommandType::BuildSignature(CommandSignature &signature)
|
||||
{
|
||||
Validator *prefNameValidator(new Validator());
|
||||
signature.AddParameter(wxT("PrefName"), wxT(""), prefNameValidator);
|
||||
Validator *prefValueValidator(new Validator());
|
||||
signature.AddParameter(wxT("PrefValue"), wxT(""), prefValueValidator);
|
||||
}
|
||||
|
||||
Command *SetPreferenceCommandType::Create(CommandOutputTarget *target)
|
||||
{
|
||||
return new SetPreferenceCommand(*this, target);
|
||||
}
|
||||
|
||||
bool SetPreferenceCommand::Apply(CommandExecutionContext context)
|
||||
{
|
||||
wxString prefName = GetString(wxT("PrefName"));
|
||||
wxString prefValue = GetString(wxT("PrefValue"));
|
||||
return gPrefs->Write(prefName, prefValue);
|
||||
}
|
||||
|
||||
SetPreferenceCommand::~SetPreferenceCommand()
|
||||
{ }
|
||||
|
||||
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
|
||||
// version control system. Please do not modify past this point.
|
||||
//
|
||||
// Local Variables:
|
||||
// c-basic-offset: 3
|
||||
// indent-tabs-mode: nil
|
||||
// End:
|
||||
//
|
||||
// vim: et sts=3 sw=3
|
||||
// arch-tag: TBD
|
||||
Reference in New Issue
Block a user