Hello Chris,

Take 2:  I believe you were not feeling well when I first posted this and you 
might have missed it.


Thank you for your first walk through.  That helped quite a bit.

I understand many general aspects of the commandRegistry system.  It has taken 
most of yesterday and part of today to try to grasp what is going on, though.  
I think I have a general understanding.  The abstraction seems pretty complex.

Could you lead me through this a bit?  Let's look at NotationView.cpp

line59:     m_commandRegistry = new NotationCommandRegistry(this);

This creates a new NotationCommandRegisty and stores in in m_commandRegistry

We don't do anything with this pointer, am I correct?

now inside NotationCommandRegistry.

line 58:     AddFingeringMarkCommand::registerCommand(this);

At this point I'm a little confused.  Is this where the constructor 
AddFingerMarkCommand() is called or is it never called?  Or is it somehow 
called implicitly elsewhere.  My knowledge of C++ is failing me here.

To me it looks as if we are calling AddFingeringMarkCommand::registerCommand() 
without object creation.

If the constructor is being called, I'm not certain how it is getting its 
arguments such as fingering, and selection passed to it.

If it is not called, that explains a lot.

Other functions inside AddFingerMarkCommand:
getGlobalName() appears just to be used by AddFingerMarkCommand() constructor 
but is called without arguments, so the getGlobalName() function code itself 
appears dead.

Is this true?

Or is getGlobalName() being called with an argument elsewhere?

getArgument(), is this dead as well or is something else using this.

Any help with these questions, would greatly increase my understanding of the 
process.

......

Where to go from here assuming I understand things correctly:
1. I would like to see the AddXXXCommand() functions re-factored.  We can 
remove much of the extraneous internal function calls like getActionName(), 
getArgument(), and other function like getStandardFingering() [as in 
AddFingerMarkCommand.cpp] and just leave class with just the essentials: 
modifySegment(), and registerCommand().  registerCommand() would simple call in 
plain fashion
Example for AddFingerMarkCommand::registerCommand():

void
AddFingeringMarkCommand::registerCommand(CommandRegistry *r)
{
        r->registerCommand("add_fingering_0", new
          ArgumentAndSelectionCommandBuilder<AddFingeringMarkCommand>());
        r->registerCommand("add_fingering_1", new
          ArgumentAndSelectionCommandBuilder<AddFingeringMarkCommand>());
        r->registerCommand("add_fingering_2", new
          ArgumentAndSelectionCommandBuilder<AddFingeringMarkCommand>());
        r->registerCommand("add_fingering_3", new
          ArgumentAndSelectionCommandBuilder<AddFingeringMarkCommand>());
        r->registerCommand("add_fingering_4", new
          ArgumentAndSelectionCommandBuilder<AddFingeringMarkCommand>());
        r->registerCommand("add_fingering_5", new
          ArgumentAndSelectionCommandBuilder<AddFingeringMarkCommand>());
        r->registerCommand("add_fingering_plus", new
          ArgumentAndSelectionCommandBuilder<AddFingeringMarkCommand>());
        r->registerCommand("add_fingering_mark", new
          ArgumentAndSelectionCommandBuilder<AddFingeringMarkCommand>());
}

This code example is essentially what I understood it to be doing, but the 
current version jumps through hoops to concatenate strings.

This changes would help people find where action listed in the .rc files are 
being created since grep would easily find these key phrases.  Also it just 
makes the whole process one less step removed. Making it that much more 
maintainable.

2. AddComments in .rc files that indicate which commands are created with the 
commandRegistry class.  This will help other as RG evolves.

...

Well, tell me what you think.  I do appreciate your helpfulness.

Sincerely,
Julie S.




      

------------------------------------------------------------------------------
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to