Lomse library. API documentation  0.30.0
CmdDeleteRelation Class Reference

#include <lomse_command.h>

Inheritance diagram for CmdDeleteRelation:
CmdDelete DocCmdSimple DocCommand

Detailed Description

A command for deleting a relation object (e.g. beam, chord, slur, tie, tuplet, etc.).

See constructors for details.

Public Member Functions

 CmdDeleteRelation (const std::string &name="")
 
 CmdDeleteRelation (int type, const std::string &name="")
 
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

◆ CmdDeleteRelation() [1/2]

CmdDeleteRelation::CmdDeleteRelation ( const std::string &  name = "")

This command deletes the first object in current selection. It must be a relation object (e.g. beam, chord, slur, tie, tuplet, etc.).

Parameters
nameThe displayable name for the command. If not specified or empty will default to string "Delete " followed by the name of the object to delete.

Remarks

  • If the first object in current selection is not a relation object (imoRelObj) 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.

◆ CmdDeleteRelation() [2/2]

CmdDeleteRelation::CmdDeleteRelation ( int  type,
const std::string &  name = "" 
)

This command deletes all selected relation objects of type given by parameter type.

Parameters
typeType of relation object to insert. Must be one of the values for relation objects (ImoRelObj) in enum #EImoObjType.
nameThe displayable name for the command. If not specified or empty will default to string "Delete " followed by the name of the object to delete.

Remarks

  • If the first object in current selection is not a relation object (imoRelObj) the command will not be executed and will return a failure code.
  • After executing the command:
    • the selection will not be changed.
      Todo:
      Check. Selection should only contain all other objects but not the deleted ones.
void CommandHandler::delete_tuplet()
{
//Remove all selected tuplets
if (SpInteractor spInteractor = m_pPresenter->get_interactor(0).lock())
{
string name = gettext("Delete tuplet");
SpInteractor->exec_command( new CmdDeleteRelation(k_imo_tuplet, name) );
}
}

Member Function Documentation

◆ get_cursor_update_policy()

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

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

Implements DocCommand.