Lomse library. API documentation  0.30.0
CmdTransposeDiatonically Class Reference

#include <lomse_command.h>

Inheritance diagram for CmdTransposeDiatonically:
CmdTranspose DocCmdSimple DocCommand

Detailed Description

A command for applying a diatonic transposition to the score or to a selection.

See constructor for details.

Public Member Functions

 CmdTransposeDiatonically (int steps, bool fUp=true, const std::string &name="")
 
- Public Member Functions inherited from CmdTranspose
int get_cursor_update_policy () override
 
int get_undo_policy () override
 
int get_selection_update_policy () override
 
- Public Member Functions inherited from DocCmdSimple
virtual ~DocCmdSimple ()
 
bool is_composite () override
 
- Public Member Functions inherited from DocCommand
virtual ~DocCommand ()
 
std::string get_name ()
 
bool is_reversible ()
 
bool is_recordable ()
 
std::string get_error ()
 

Additional Inherited Members

- Public Types inherited from DocCommand
enum  ECmdCursorPolicy
 
enum  ECmdUndoPolicy
 
enum  ECmdSelectionPolicy
 

Constructor & Destructor Documentation

◆ CmdTransposeDiatonically()

CmdTransposeDiatonically::CmdTransposeDiatonically ( int  steps,
bool  fUp = true,
const std::string &  name = "" 
)

This command shifts diatonically every pitch, up or down, by the number of steps you specify. Only note steps changed and displayed accidentals are maintained. The command applies only to the notes in the current selection set.

This kind of transposition has nothing to do with the key signature which remains unchanged.

Parameters
stepsThe interval by which you want the selected music transposed.
fUpBoolean for choosing the direction of the transposition: value true means 'up', value false means 'down'.
nameThe displayable name for the command. If not specified or empty will be replaced by "Diatonic transposition".

Remarks

  • If the selection is empty or does not contain notes, the command will not be executed and will return a failure code.
  • After executing the command:
    • the selection set will be unmodified.
    • the cursor will not change its position.

Example

void CommandHandler::transpose(int steps, bool fUp=true)
{
if (SpInteractor spInteractor = m_pPresenter->get_interactor(0).lock())
{
string name = gettext("Diatonic transposition");
SpInteractor->exec_command(
new CmdTransposeDiatonically(steps, fUp, name) );
}
}