Lomse library. API documentation  0.30.0
CmdChangeAccidentals Class Reference

#include <lomse_command.h>

Inheritance diagram for CmdChangeAccidentals:
DocCmdSimple DocCommand

Detailed Description

A command for changing the accidentals of the selected notes.

See constructor for details.

Public Member Functions

 CmdChangeAccidentals (EAccidentals acc, const std::string &name="Change accidentals")
 
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

◆ CmdChangeAccidentals()

CmdChangeAccidentals::CmdChangeAccidentals ( EAccidentals  acc,
const std::string &  name = "Change accidentals" 
)

This command changes the accidentals of the selected notes.

Parameters
accThe new accidentals to put on the selected notes. It must be a value from enum #EAccidentals.
nameThe displayable name for the command. If not specified will default to "Change accidentals".

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 will not be changed.
    • the cursor will not change its position.

Example

void CommandHandler::change_note_accidentals(EAccidentals acc)
{
//change note accidentals for current selected notes
if (SpInteractor spInteractor = m_pPresenter->get_interactor(0).lock())
{
string name = gettext("Change note accidentals");
SpInteractor->exec_command( new CmdChangeAccidentals(acc, name) )
}
}

Member Function Documentation

◆ get_cursor_update_policy()

int CmdChangeAccidentals::get_cursor_update_policy ( )
inlineoverridevirtual

Returns a value from ECmdCursorPolicy that indicates the update policy followed by this command.

Implements DocCommand.

◆ get_selection_update_policy()

int CmdChangeAccidentals::get_selection_update_policy ( )
inlineoverridevirtual

Returns a value from ECmdSelectionPolicy that indicates the undo policy followed by this command.

Implements DocCommand.

◆ get_undo_policy()

int CmdChangeAccidentals::get_undo_policy ( )
inlineoverridevirtual

Returns a value from ECmdUndoPolicy that indicates the undo policy followed by this command.

Implements DocCommand.