Lomse library. API documentation  0.30.0
CmdAddTie Class Reference

#include <lomse_command.h>

Inheritance diagram for CmdAddTie:
DocCmdSimple DocCommand

Detailed Description

A command for adding a tie to the two selected notes.

See constructor for details.

Public Member Functions

 CmdAddTie (const std::string &name="Add tie")
 
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

◆ CmdAddTie()

CmdAddTie::CmdAddTie ( const std::string &  name = "Add tie")

This command adds a tie to the two selected notes.

Parameters
nameThe displayable name for the command. If not specified will default to "Add tie".

Remarks

  • The two notes to tie must be selected and must have the same pitch.
  • Before executing the command Lomse will check that the selection is valid for adding a tie. Otherwise 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::add_tie()
{
//Tie the selected notes
if (SpInteractor spInteractor = m_pPresenter->get_interactor(0).lock())
{
string name = gettext("Add tie");
SpInteractor->exec_command( new CmdAddTie(name) );
}
}

Member Function Documentation

◆ get_cursor_update_policy()

int CmdAddTie::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 CmdAddTie::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 CmdAddTie::get_undo_policy ( )
inlineoverridevirtual

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

Implements DocCommand.