Lomse library. API documentation  0.30.0
CmdJoinBeam Class Reference

#include <lomse_command.h>

Inheritance diagram for CmdJoinBeam:
DocCmdSimple DocCommand

Detailed Description

A command for creating and joining beams, and for adding notes to a beam.

See constructor for details.

Public Member Functions

 CmdJoinBeam (const std::string &name="Join beam")
 
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

◆ CmdJoinBeam()

CmdJoinBeam::CmdJoinBeam ( const std::string &  name = "Join beam")

This command creates and joins beams, and adds notes to a beam, depending on the content of current selection. That is, all selected notes will form a single beamed group.

Parameters
nameThe displayable name for the command. If not specified will be replaced by the string "Join beam".

Remarks

  • The command will return a failure code if the selection is empty or the selected notes can not be on the same beam (e.g. notes in different voices or different instruments).
  • After executing the command:
    • the selection will not be altered.
    • the cursor will not change its position.

Example

void CommandHandler::join_beam()
{
//depending on current selection, either:
// - create a beamed group with the selected notes,
// - join two or more beamed groups
// - or add a note to a beamed group
if (SpInteractor spInteractor = m_pPresenter->get_interactor(0).lock())
{
string name = gettext("Add beam");
SpInteractor->exec_command( new CmdJoinBeam(name) );
}
}

Member Function Documentation

◆ get_cursor_update_policy()

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

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

Implements DocCommand.